0 k
| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| devices/ | 2026-07-01 18:13 | - | ||
| drivers/ | 2026-07-01 18:13 | - | ||
| drivers_autoprobe | 2026-07-01 18:17 | 4.0K | ||
| drivers_probe | 2026-07-01 18:16 | 4.0K | ||
| uevent | 2026-07-01 18:13 | 4.0K | ||
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
" lY> Tm q@p.i1h h 7.9 , lm_JJh Ȯ2o Yx?_I| ,u ************************************ Idioms and Anti-Idioms in Python ************************************ :Author: Moshe Zadka This document is placed in the public domain. .. topic:: Abstract This document can be considered a companion to the tutorial. It shows how to use Python, and even more importantly, how *not* to use Python. Language Constructs You Should Not Use ====================================== While Python has relatively few gotchas compared to other languages, it still has some constructs which are only useful in corner cases, or are plain dangerous. from module import \* --------------------- Inside Function Definitions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``from module import *`` is *invalid* inside function definitions. While many versions of Python do not check for the invalidity, it does not make it more valid, no more than having a smart lawyer makes a man innocent. Do not use it like that ever. Even in versions where it was accepted, it made the function execution slower, because the compiler could not be certain which names were local and which were global. In Python 2.1 this construct causes warnings, and sometimes even errors. At Module Level ^^^^^^^^^^^^^^^ While it is valid to use ``from module import *`` at module level it is usually a bad idea. For one, this loses an important property Python otherwise has --- you can know where each toplevel name is defined by a simple "search" function in your favourite editor. You also open yourself to trouble in the future, if some module grows additional functions or classes. One of the most awful questions asked on the newsgroup is why this code:: f = open("www") f.read() does not work. Of course, it works just fine (assuming you have a file called "www".) But it does not work if somewhere in the module, the statement ``from os import *`` is present. The :mod:`os` module has