Thanks, but I can't take all the credit. I think we're up to 4-5
active collaborators on this project.
I think the speed that this project is progressing is a great
testament to the power of Python as a platform. Things like defrecord
and proxy are full of "hacks" and complexity in the JVM. In python,
they're basically just classes with a few extra methods tossed in. For
those who don't know, this project was started around Dec 20th, 2011.
So yeah, we're doing really well for only 3 months of development.
Timothy
I think the speed that this project is progressing is a great
testament to the power of Python as a platform. Things like defrecord
and proxy are full of "hacks" and complexity in the JVM. In python,
they're basically just classes with a few extra methods tossed in. For
those who don't know, this project was started around Dec 20th, 2011.
So yeah, we're doing really well for only 3 months of development.
Timothy
After looking into it, I think you're right. And these may actually
make records extremely fast in some cases on pypy....we'll see.
Timothy
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)
Keep in mind that different namedtuples with the same contents are
equal to each other:
>>> from collections import namedtuple
>>> A = namedtuple('A', 'x y z')
>>> B = namedtuple('B', 'x y z')
>>> A(1, 2, 3) == B(1, 2, 3)
True
records are not:
user=> (defrecord A [x y z])
user.A
user=> (defrecord B [x y z])
user.B
user=> (= (A. 1 2 3) (B. 1 2 3))
false
Ivan
Keep in mind that different namedtuples with the same contents areequal to each other:
Actually it's exactly the same. We generate a COMPARE_OP "==" bytecode.
> I assume that Clojure-Py's = is not Python's == though.Actually it's exactly the same. We generate a COMPARE_OP "==" bytecode.
That's probably possible. Remember to add a __slots__ = () in the
subclass as well to avoid creating dict for every namedtuple.
Another possibility is to create namedtuples whose first item is a
per-namedtuple object() marker, making different namedtuples unequal.
Ivan
At this point I have to ask "what's the point"? Why not just use
setattr/getattr and copy?
Another possibility is to create namedtuples whose first item is a
per-namedtuple object() marker, making different namedtuples unequal.