[Python-ideas] ML Style Pattern Matching for Python
spir
denis.spir at gmail.com
Sun Dec 19 13:05:02 CET 2010
On Sun, 19 Dec 2010 12:03:43 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
> > List comprehensions are also cryptic if you see them for the first time. The
> > curly brackets with bars "{| |}" should symbolize that Python object are
> > glorified dicts. It is also quite close to Ocaml's syntax for records.
>
> Not really. A list comp looks like a cross between a list and a
> for-loop, which is exactly what a list comp is.
And actually python (composite) objects, conceptually, are closer to named tuples than to dicts; composite objects are _not_ collections. That they are based on dicts is, imo, an implementation detail. For this reason, I'm pleased their dict attr is weirdly called "__dict__".
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
More information about the Python-ideas
mailing list