curly-brace-aphobic?

Quinn Dunkan quinn at cruzeiro.ugcs.caltech.edu
Wed Jan 31 18:40:50 EST 2001


On 31 Jan 2001 00:57:48 GMT, Remco Gerlich <scarblac at pino.selwerd.nl> wrote:
>Well, writing "string.split" is inconsistent, shouldn't it be string[split]
>or string["split"]?
>
>It's like indexing the module. It is actually a dict lookup internally.
>They're not the same thing really since an identifier suddenly becomes a
>string and so on, but it's just a connection my mind made...

You'd like lua, then.  Everything is a table.  Modules (which are not built
into the langauge, naturally) are tables.  Arrays are tables indexed with
numbers.  foo.bar is sugar for foo['bar'].  It's theoretically appealing, but
sometimes causes additional complexity, when, for example, you want to know
how long an array is (the convention is to have an 'n' key with the length).

And tables are created with {} but indexed with [] :)



More information about the Python-list mailing list