14 ms·
I've seen most the points discussed several times already on python-ideas, python-dev lists -- that is at the very least some of the points have merit and if th
by d0mine 10y ago
I've seen most the points discussed several times already on python-ideas, python-dev lists -- that is at the very least some of the points have merit and if the author has anything new to add then these lists might be also the place to do it.
> Even weirder, str and list both have find, but list does not have index (a related method).
It is in reverse: both str and list has index() methods. str has find(). To find out whether an item is in the list in Python:
if item in your_list:
...
> class FooNode
There is attrs package [1], to avoid boilerplate for a mutable analog of collections.namedtuple ("case classes" [2]):
@attr.s
class C(object):
x = attr.ib(default=42)
y = attr.ib(default=attr.Factory(list))
> Lack of switch
It is hard to discuss it without a specific code example from an existing popular codebase that shows the advantages of "switch" statement (to compare the current code and how it looks like with a suggested "switch" syntax). To justify a new syntax you should be able to find dozens of applicable examples easily.
[1] https://pypi.python.org/pypi/attrs https://pypi.python.org/pypi/attrs
[2] http://www.codecommit.com/blog/scala/case-classes-are-cool http://www.codecommit.com/blog/scala/case-classes-are-cool