python Programming Glossary: pep
Should Python import statements always be at the top of a module? http://stackoverflow.com/questions/128478/should-python-import-statements-always-be-at-the-top-of-a-module Python import statements always be at the top of a module PEP 08 states Imports are always put at the top of the file just..
The meaning of a single- and a double-underscore before an object name in Python http://stackoverflow.com/questions/1301346/the-meaning-of-a-single-and-a-double-underscore-before-an-object-name-in-python nothing special is done with the name itself. To quote PEP 8 _single_leading_underscore weak internal use indicator. E.g...
Proper way to declare custom exceptions in modern Python? http://stackoverflow.com/questions/1319615/proper-way-to-declare-custom-exceptions-in-modern-python meaning for attributes named message . I gather from PEP 352 that attribute did have a special meaning in 2.5 they're..
PyLint, PyChecker or PyFlakes? [closed] http://stackoverflow.com/questions/1428872/pylint-pychecker-or-pyflakes that you can change it and that the default is to match PEP 8 but is it such a crime to write 'for x in seq' Apparently.. PyLint found stuff that were not specifically linked to PEP8 but interesting. Both tools are interesting and complementary...
Differences between isinstance() and type() in python http://stackoverflow.com/questions/1549801/differences-between-isinstance-and-type-in-python . The concept is obviously a growing one in Python since PEP 3119 which introduces a generalization of it was accepted and.. has been implemented starting with Python 2.6 and 3.0. The PEP makes it clear that while ABCs can often substitute for duck..
Does python have 'private' variables in classes? http://stackoverflow.com/questions/1641219/does-python-have-private-variables-in-classes for some reason you can always use the __ prefix from PEP 8 . Python mangles the names of variables like __foo so that..
Why doesn't this division work in python? http://stackoverflow.com/questions/1787249/why-doesnt-this-division-work-in-python truncated down when there would be a fractional part. See PEP 238 n 29 d 1009 print str float n d 0.0287413280476 In python..
How can I represent an 'Enum' in Python? http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python Enums have been added to Python 3.4 as described in PEP 435 . ie. from enum import Enum Animal Enum 'Animal' 'ant bee..
Why doesn't Python have a switch statement? [closed] http://stackoverflow.com/questions/374239/why-doesnt-python-have-a-switch-statement improve this question It was proposed and rejected in PEP 3103 . I don't know why it didn't have it initially. There's..
What is the best (idiomatic) way to check the type of a Python variable? [duplicate] http://stackoverflow.com/questions/378927/what-is-the-best-idiomatic-way-to-check-the-type-of-a-python-variable to use collections.Mapping instead of dict as per the ABC PEP . def value_list x if isinstance x dict return list set x.values..
Accessing the index in Python for loops http://stackoverflow.com/questions/522563/accessing-the-index-in-python-for-loops
How do you retrieve items from a dictionary in the order that they're inserted? http://stackoverflow.com/questions/60848/how-do-you-retrieve-items-from-a-dictionary-in-the-order-that-theyre-inserted python dict isn't able to do this. There is a proposal PEP 372 to add an ordered dictionary that keeps track of the order.. want to stick with the reference implementation in the PEP if you want your code to be compatible with the official version.. version if the proposal is eventually accepted . EDIT The PEP was accepted and added in python 2.7 and 3.1. See the docs ...
What does the @ symbol do in Python http://stackoverflow.com/questions/6392739/what-does-the-symbol-do-in-python for class function and method decorators . Read more here PEP 318 Decorators Python Decorators The most common Python decorators..
How to do relative imports in Python? http://stackoverflow.com/questions/72852/how-to-do-relative-imports-in-python The behaviour I'm looking for is the same as described in PEP 366 thanks John B python share improve this question Everyone.. the mod1.py as an argument to the interpreter. From PEP 328 Relative imports use a module's __name__ attribute to determine..
list comprehension without [ ], Python http://stackoverflow.com/questions/9060653/list-comprehension-without-python This is called a generator expression and is explained in PEP 289 . The main difference between generator expressions and..
looking for a more pythonic way to access the database http://stackoverflow.com/questions/1107297/looking-for-a-more-pythonic-way-to-access-the-database
Why does Python pep-8 strongly recommend spaces over tabs for indentation? http://stackoverflow.com/questions/120926/why-does-python-pep-8-strongly-recommend-spaces-over-tabs-for-indentation does Python pep 8 strongly recommend spaces over tabs for indentation I see..
Accessing class variables from a list comprehension in the class definition http://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition scoping is a little uhm strange . This is documented in pep 227 Names in class scope are not accessible. Names are resolved..
Python relative imports for the billionth time http://stackoverflow.com/questions/14132789/python-relative-imports-for-the-billionth-time the billionth time I've been here http www.python.org dev peps pep 0328 http docs.python.org 2 tutorial modules.html#packages.. time I've been here http www.python.org dev peps pep 0328 http docs.python.org 2 tutorial modules.html#packages Python.. package message I built an exact replica of the package on pep 0328 package __init__.py subpackage1 __init__.py moduleX.py..
PyLint, PyChecker or PyFlakes? [closed] http://stackoverflow.com/questions/1428872/pylint-pychecker-or-pyflakes ease of use and learning curve. python pylint pep8 pyflakes pychecker share improve this question Well I am.. START_TIME EDIT Thanks to Rudiger Wolf I discovered pep8 that does exactly what is name suggests matching the pep8... pep8 that does exactly what is name suggests matching the pep8. It has found found several syntax pep no no that PyLint did..
How do I run python 2 and 3 in windows 7? http://stackoverflow.com/questions/15912063/how-do-i-run-python-2-and-3-in-windows-7 Python launcher for Windows see http www.python.org dev peps pep 0397 . After installation of Python 3.3 the py.exe and.. launcher for Windows see http www.python.org dev peps pep 0397 . After installation of Python 3.3 the py.exe and pyw.exe..
SyntaxError of Non-ASCII character http://stackoverflow.com/questions/18078851/syntaxerror-of-non-ascii-character on line 3 but no encoding declared see http www.python.org peps pep 0263.html for details in the terminal it's working but.. 3 but no encoding declared see http www.python.org peps pep 0263.html for details in the terminal it's working but while..
SQLite, python, unicode, and non-utf data http://stackoverflow.com/questions/2392732/sqlite-python-unicode-and-non-utf-data line 81 but no encoding declared see http www.python.org peps pep 0263.html for details Once your program is working correctly.. 81 but no encoding declared see http www.python.org peps pep 0263.html for details Once your program is working correctly..
Asynchronous background processes in Python? http://stackoverflow.com/questions/2496772/asynchronous-background-processes-in-python I also was reading this http www.python.org dev peps pep 3145 For our project we have 5 svn checkouts that need.. I also was reading this http www.python.org dev peps pep 3145 For our project we have 5 svn checkouts that need to update..
Python try…except comma vs 'as' in except http://stackoverflow.com/questions/2535760/python-try-except-comma-vs-as-in-except share improve this question http www.python.org dev peps pep 3110 Summary In Python 2.6 use the as syntax since it is.. share improve this question http www.python.org dev peps pep 3110 Summary In Python 2.6 use the as syntax since it is far..
Unicode identifiers in Python? http://stackoverflow.com/questions/2649544/unicode-identifiers-in-python lexical_analysis.html#identifiers http www.python.org dev peps pep 3131 But in Python 2 identifiers can only be letters numbers.. http www.python.org dev peps pep 3131 But in Python 2 identifiers can only be letters numbers..
Temporary file association for single cmd.exe session http://stackoverflow.com/questions/5583024/temporary-file-association-for-single-cmd-exe-session for Python under Windows. See http www.python.org dev peps pep 0397 for PEP http www.red dove.com screencasts launcher.. for Python under Windows. See http www.python.org dev peps pep 0397 for PEP http www.red dove.com screencasts launcher launcher.html..
Python spawn off a child subprocess, detach, and exit http://stackoverflow.com/questions/5772873/python-spawn-off-a-child-subprocess-detach-and-exit creating a daemon the python way http www.python.org dev peps pep 3143 #reference implementation share improve this answer..
working with utf-8 encoding in python source http://stackoverflow.com/questions/6289474/working-with-utf-8-encoding-in-python-source on line 1 but no encoding declared see http www.python.org peps pep 0263.html for details How can I declare utf 8 strings in.. 1 but no encoding declared see http www.python.org peps pep 0263.html for details How can I declare utf 8 strings in source.. utf 8 .... It is described at http www.python.org dev peps pep 0263 Then you can use UTF 8 in strings # usr bin env python..
Better to 'try' something and catch the exception or test if its possible first to avoid an exception? http://stackoverflow.com/questions/7604636/better-to-try-something-and-catch-the-exception-or-test-if-its-possible-first baz python exception handling if statement try catch pep share improve this question You should prefer try except..
python relative import example code does not work [duplicate] http://stackoverflow.com/questions/9123062/python-relative-import-example-code-does-not-work www.mediafire.com oug42nzvxrvoms4 http www.python.org dev peps pep 0328 #guido s decision moduleX contains from .moduleY import.. oug42nzvxrvoms4 http www.python.org dev peps pep 0328 #guido s decision moduleX contains from .moduleY import.. this question From the docs http www.python.org dev peps pep 0328 #guido s decision you can see this Relative imports..
|