Language design

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Sep 10 03:58:22 EDT 2013


Op 10-09-13 08:09, Steven D'Aprano schreef:
> Some time ago, Tom Christiansen wrote about the "Seven Deadly Sins of 
> Perl":
> 
> http://www.perl.com/doc/FMTEYEWTK/versus/perl.html
> 
> 
> What design mistakes, traps or gotchas do you think Python has? Gotchas 
> are not necessarily a bad thing, there may be good reasons for it, but 
> they're surprising.
> 
> To get started, here are a couple of mine:
> 
> 
> - Python is so dynamic, that there is hardly anything at all that can be 
> optimized at compile time.
> 
> - The behaviour of mutable default variables is a gotcha.
> 
> - Operators that call dunder methods like __add__ don't use the same 
> method resolution rules as regular methods, they bypass the instance and 
> go straight to the type, at least for new-style classes.

Slice semantics in combination with negative indices.

Take ls = range[10]

What is the reverse of ls[a : b]? It is [b-1 : a-1: -1]

Except of course when a == 0 or b == 0.

-- 
Antoon Pardon




More information about the Python-list mailing list