Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Python Language Gotchas -- things that fail in very obscure ways</p> <ul> <li><p>Using mutable default arguments.</p></li> <li><p>Leading zeroes mean octal. <code>09</code> is a very obscure syntax error in Python 2.x</p></li> <li><p>Misspelling overridden method names in a superclass or subclass. The superclass misspelling mistake is worse, because none of the subclasses override it correctly.</p></li> </ul> <p>Python Design Gotchas</p> <ul> <li><p>Spending time on introspection (e.g. trying to automatically determine types or superclass identity or other stuff). First, it's obvious from reading the source. More importantly, time spent on weird Python introspection usually indicates a fundamental failure to grasp polymorphism. 80% of the Python introspection questions on SO are failure to get Polymorphism.</p></li> <li><p>Spending time on code golf. Just because your mental model of your application is four keywords ("do", "what", "I", "mean"), doesn't mean you should build a hyper-complex introspective decorator-driven framework to do that. Python allows you to take DRY to a level that is silliness. The rest of the Python introspection questions on SO attempts to reduce complex problems to code golf exercises.</p></li> <li><p>Monkeypatching.</p></li> <li><p>Failure to actually read through the standard library, and reinventing the wheel.</p></li> <li><p>Conflating interactive type-as-you go Python with a proper program. While you're typing interactively, you may lose track of a variable and have to use <code>globals()</code>. Also, while you're typing, almost everything is global. In proper programs, you'll never "lose track of" a variable, and nothing will be global.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload