Posts Tagged ‘pydev’

PyDev (Eclipse) key bindings

press CTRL+ALT+ENTER to send the selected lines to the interactive console
EditRectangular editionShift+Alt+AEditing Text
EditFind NextCtrl+KEditing Text
EditFind and ReplaceCtrl+FIn Windows
EditWord CompletionAlt+/Editing Text
FileCloseCtrl+F4In Windows
FileNewCtrl+NIn Windows
FileSaveCtrl+SIn Windows
NavigateBackward HistoryAlt+LeftIn Windows
NavigateForward HistoryAlt+RightIn Windows
NavigateGo to LineCtrl+LEditing Text
NavigateLast Edit LocationCtrl+QIn Windows
NavigateOpen ResourceCtrl+Shift+RIn Windows
NavigateShow In menuAlt+Shift+WIn Windows
NavigateGo to next problem markerCtrl+.In Windows
PyDev – EditorQuick Fix / Content AssistantsCtrl+1PyDev editor scope
PyDev – EditorCode CompletionCtrl+SpacePyDev editor scope
PyDev – EditorAdd Comment BlockCtrl+4PyDev editor scope
PyDev – EditorAdd Single Comment BlockCtrl+Shift+4PyDev editor scope
PyDev – EditorConvert space-tabs to tabsCtrl+Shift+TabPyDev editor scope
PyDev – EditorConvert tabs to space-tabsCtrl+TabPyDev editor scope
PyDev – EditorNext Method or ClassCtrl+Shift+DownPyDev editor scope
PyDev – EditorPrevious Method or ClassCtrl+Shift+UpPyDev editor scope
PyDev – EditorPython CollapseCtrl+-PyDev editor scope
PyDev – EditorPython Collapse AllCtrl+9PyDev editor scope
PyDev – EditorToggle Mark OccurrencesAlt+Shift+OPyDev editor scope
PyDev – EditorPython Format CodeCtrl+Shift+FPyDev editor scope
PyDev – EditorPython Go To DefinitionF3PyDev editor scope
PyDev – EditorPython Organize ImportsCtrl+Shift+OPyDev editor scope
PyDev – EditorPython Show Quick OutlineCtrl+OPyDev editor scope
PyDev – EditorPython Open Definition Quick OutlineCtrl+Shift+TPyDev editor scope
PyDev – EditorPython Un CollapseCtrl+=PyDev editor scope
PyDev – EditorPython Un Collapse AllCtrl+0PyDev editor scope
PyDev – EditorPython Comment/UncommentCtrl+/ (for both)PyDev editor scope
PyDev – EditorRemove Comment BlockCtrl+5PyDev editor scope
PyDev – EditorStart interactive sessionCtrl+Alt+EnterPyDev editor scope
PyDev – EditorSend line to interactive sessionF2PyDev editor scope
PyDev – EditorList commands binded to Ctrl+2 (only the most important are below)Ctrl+2+helpPyDev editor scope
PyDev – EditorAssigns method parameters to attributes of selfCtrl+2+aPyDev editor scope
PyDev – EditorForces code analysis in the current editorCtrl+2+cPyDev editor scope
PyDev – EditorKills all the python shells spawned by PyDevCtrl+2+killPyDev editor scope
PyDev – EditorRenames local occurrencesCtrl+2+rPyDev editor scope
PyDev – EditorWraps the current selected paragraphCtrl+2+wPyDev editor scope
PyDev – EditorEnables/Disables wrapping in the editorCtrl+2+setwrapPyDev editor scope
PyDev – EditorPasses the passed command to in DjangoCtrl+2+dj commandPyDev editor scope
PyDev – EditorPuts a new line after each comma (split lines)Ctrl+2+slPyDev editor scope
PyDev – EditorTransforms an import into a string (import string)Ctrl+2+isPyDev editor scope
PyDev – EditorSearches the passed (or selected) string in the open editorsCtrl+2+s string_to_findPyDev editor scope
PyDev – SearchFind referencesCtrl+Shift+GPyDev editor scope
PyDev – RefactorPython Extract Local VariableAlt+Shift+LPyDev editor scope
PyDev – RefactorPython Extract MethodAlt+Shift+MPyDev editor scope
PyDev – RefactorPython Inline Local VariableAlt+Shift+IPyDev editor scope
PyDev – RefactorPython RenameAlt+Shift+RPyDev editor scope
Run/DebugRun current editorF9PyDev editor scope
Run/DebugRun current editor unit-testsCtrl+F9PyDev editor scope
Run/DebugDebug Last LaunchedF11In Windows
Run/DebugRun Last LaunchedCtrl+F11In Windows
Run/DebugStep IntoF5Debugging
Run/DebugStep OverF6Debugging
Run/DebugStep ReturnF7Debugging
SearchOpen Search DialogCtrl+HIn Windows
Text EditingCopy LinesCtrl+Alt+DownEditing Text
Text EditingDelete LineCtrl+DEditing Text
Text EditingDelete Next WordCtrl+DeleteEditing Text
Text EditingDuplicate LinesCtrl+Alt+UpEditing Text
Text EditingInsert Line Below Current LineShift+EnterEditing Text
Text EditingMove Lines DownAlt+DownEditing Text
Text EditingMove Lines UpAlt+UpEditing Text
Text EditingScroll Line DownCtrl+DownEditing Text
Text EditingScroll Line UpCtrl+UpEditing Text
Text EditingTo Lower CaseCtrl+Shift+YEditing Text
Text EditingTo Upper CaseCtrl+Shift+XEditing Text
WindowActivate EditorF12In Windows
WindowMaximize Active View or EditorCtrl+MIn Windows
WindowNext EditorCtrl+F6 (LiClipse adds Ctrl+Tab too)In Windows
WindowNext PerspectiveCtrl+F8In Windows
WindowNext ViewCtrl+F7In Windows
WindowOpen Editor Drop DownCtrl+EIn Windows
WindowShow Key AssistCtrl+Shift+LIn Dialogs and Windows
WindowShow Ruler Context MenuCtrl+F10Editing Text
WindowShow System MenuAlt+-In Windows
WindowShow View MenuCtrl+F10In Windows
WindowSwitch to EditorCtrl+Shift+EIn Windows

Python: Notes on Indentation

In Python the interpreter identifies blocks of code based on indentation.

By way of example, in an if-loop if the next line is indented then it means that this indented block is within the loop. You can use either spaces or tabs, e.g. you can not mix both, to quote PEP 8 – Style Guide for Python Code:

Python 3 disallows mixing the use of tabs and spaces for indentation.
Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.

The standard method is to use 4 spaces for indentation, which also happens to be the necessary number of spaces to designate a codeblock on Stackoverflow.

Fortunately, if you’re using the PyDev plugin for Eclipse or many other popular IDE’s, then you can press tab in the text editor and the IDE will automatically translate that to 4 spaces.