On Mon, Sep 8, 2008 at 1:29 PM, Jon Lang <[EMAIL PROTECTED]> wrote:
> TSa wrote:
>> Ahh, I see. Thanks for the hint. It's actually comma that builds lists.
>> So we could go with () for undef and require (1,) and (,) for the single
>> element and empty list respectively. But then +(1,2,3,()) == 4.
>
> Actually, note that both infix:<,> and circumfix:<[ ]> can be used to
> build lists; so [1] and [] can be used to construct single-element and
> empty lists, respectively.

It may be worth noting here that in Python, (1) is a scalar integer
value and (1,) is a tuple of length 1, but the empty tuple is
represented by commaless ().   Thus len(()) is 0, len((,)) is a syntax
error, len((1,)) is 1, and len((1)) is a type error.

Also, all three of the empty tuple (), the empty list [], and the nil
value None are distinct from each other.

-- 
Mark J. Reed <[EMAIL PROTECTED]>

Reply via email to