dummy/trash object

Emile van Sebille emile at fenx.com
Mon Jul 9 12:46:22 CEST 2001


As I read the OPs question, it has to do with the unneeded assignment being
performed.  I took this in part as a performance issue, in which case simple
use of _ performs much better, as on my system I can to 10M assigns a
second.

--

Emile van Sebille
emile at fenx.com

---------
"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message
news:slrn.pl.9kj26i.nof.qrczak at qrnik.zagroda...
> Mon, 9 Jul 2001 11:36:35 +0200 (CEST), Xavier Defrang
<xavier at perceval.net> pisze:
>
> > I'm sure that someone already came with a question like : "why is
> > there no real dummy or trash object in Python which could by used
> > like the magic '_' in Prolog?"
>
> You can implement it yourself, but it will look a bit ugly:
>
> class trash:
>     def __setattr__(self, attr, val): pass
> _ = trash()
>
> x, _.y, z, _.u = t
>
> --
>  __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
>  \__/
>   ^^                      SYGNATURA ZASTĘPCZA
> QRCZAK




More information about the Python-list mailing list