[PythonCAD] First set of changes for the new year
Art Haas
ahaas at airmail.net
Wed Jan 7 08:26:44 EST 2004
Hi.
One of the items I wanted to add into PythonCAD has been the use of weak
references, and they are now in. The Subpart class now uses them when it
stores references to objects. Adding them into the code was relatively
simple, and I haven't found a problem yet, so we'll give them a chance
and see how things work out.
I've also added a small change to the file saving code that should
decrease the entity storage in the dictionary used for mapping object
id() to an integer index. The change is to store only objects used in
other objects in the dictionary. I'd mentioned in an earlier mail that I
thought making this change would be good, and it was in that it flushed
out a bug present in storing construction circles.
One more change made to the code was to remove nearly every xrange()
call and replace with range(). I've seen on the python-dev mailing list
that xrange() is not popular and seems to be heading towards
deprecation, so out it went. Python itself seems to be revising the way
lists are made in that various PEPs (Python Enhancement Proposals)
suggest alternatives to range()/xrange(), so the range() usage may some
day be changed again.
I'm now trying to get started working on an undo/redo system, and it
looks like adding this much-needed feature will take some time. More
details to follow when I have a better idea as to how things are going.
The code with the weak reference, file saving, and xrange() removal changes
are synced up to public repository, so a 'svn update' should get them
for you.
Art
--
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.
-Thomas Jefferson to James Smith, 1822
More information about the PythonCAD
mailing list