dummy/trash object

Xavier Defrang xavier at perceval.net
Mon Jul 9 11:36:35 CEST 2001


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?"

Using a "normal" variable like in the following snippet involves useless

>>> t = 1, 2, 3, 4
>>> x, _, z, _ = t
>>> _

Since I'm quite sure that the language designers have already thought
about this, the question is not whether such a magic object should be
added to the Python language but why it has not been done?  I'm sure there
are good reasons... The nearly-magic None value could have been used for
this purpose... Some could say that it would break the "no exception" rule
but we've already seen in previous threads (about assigning a value to
None) that the core of the interpreter has some special instructions to
handle None thus turning it into an actual exceptional thing...


Xavier Defrang
Perceval R&D Team
xavier at perceval.net

 Perceval Technologies SA/NV  Tel: +32-2-6409194
 Rue Tenbosch, 9              Fax: +32-2-6403154
 B-1000 Brussels         http://www.perceval.net
 BELGIUM                       info at perceval.net

More information about the Python-list mailing list