dummy/trash object

Xavier Defrang xavier at perceval.net
Mon Jul 9 05:36:35 EDT 2001


Hello,

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
assignations...

<snip>
>>> t = 1, 2, 3, 4
>>> x, _, z, _ = t
>>> _
4
</snip>

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...

Regards,

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