[Python] Ritornare un oggetto None quando dichiaro una classe...

Simone Federici s.federici a gmail.com
Mar 25 Giu 2013 14:37:19 CEST


2013/6/25 Luca Bacchi <bacchilu a gmail.com>

> una presentazione di Martelli sui Design Pattern in Python in cui ne fa
> uso per implementare, mi sembra un Singleton.


Questa?
http://www.aleax.it/gdd_pydp.pdf

Ma che centra, non è brutto sovrascrivere __new__
è brutto che ritorni None

Per me non è leggibile l'utilizzo

>>> a = Pippo(1, 2, 3)
>>> a.jump()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'jump'
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20130625/bf00e471/attachment.html>


Maggiori informazioni sulla lista Python