JetBrains Fleet 1.44 Help

List of Python live templates

Use live templates to insert common constructs into your code, such as loops, conditions, declarations, or print statements.

Live templates expanding into code constructs in the editor

To expand a code snippet, type the corresponding template abbreviation and press . Keep pressing to jump from one variable in the template to the next one. Press ⇧ ⇥ to move to the previous variable.

This table summarizes the live templates that you can use with your Python code.

Abbreviation

Description

Template text

compd

Dict comprehension

{$KEY_EXPR$: $VAL_EXPR$ for $VAR$ in $ITERABLE$}
compdi

Dict comprehension with 'if'

{$KEY_EXPR$: $VAL_EXPR$ for $VAR$ in $ITERABLE$ if $VAR_EXPR_IF$}
compg

Generator comprehension

($VAR_EXPR$ for $VAR$ in $ITERABLE$)
compgi

Generator comprehension with 'if'

($VAR_EXPR$ for $VAR$ in $ITERABLE$ if $VAR_EXPR_IF$)
compl

List comprehension

[$VAR_EXPR$ for $VAR$ in $ITERABLE$]
compli

List comprehension with 'if'

[$VAR_EXPR$ for $VAR$ in $ITERABLE$ if $VAR_EXPR_IF$]
comps

Set comprehension

{$VAR_EXPR$ for $VAR$ in $ITERABLE$}
compsi

Set comprehension with 'if'

{$VAR_EXPR$ for $VAR$ in $ITERABLE$ if $VAR_EXPR_IF$}
iter

Iterate (for ... in ...)

for $VAR$ in $ITERABLE$: $END$
itere

Iterate (for ... in enumerate)

for $INDEX$, $VAR$ in enumerate($ITERABLE$): $END$
main

if __name__ == '__main__'

if __name__ == '__main__': $END$
prop

Property getter

@property def $NAME$(self): return $END$
props

Property getter/setter

@property def $NAME$(self): return $END$ @$NAME$.setter def $NAME$(self, value): pass
propsd

Property getter/setter/deleter

@property def $NAME$(self): return $END$ @$NAME$.setter def $NAME$(self, value): pass @$NAME$.deleter def $NAME$(self): pass
super

'super(...)' call

super($args$).$method$($end$)
Last modified: 03 December 2024