[Python-Dev] Assignment to class (original) (raw)
Kevin Jacobs jacobs@penguin.theopalgroup.com
Thu, 9 Jan 2003 07:07:41 -0500 (EST)
- Previous message: [Python-Dev] Any Lasso'ers on the list ?
- Next message: [Python-Dev] Assignment to __class__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all,
I'm testing large chunks of our code base with Python 2.3a1 and have run into another minor snag. Five months ago Guido committed a patch to prevent assigning class for non-heap-types, which was backported to 2.2-maint two weeks ago in response to SF #658106. This is a great idea for preventing nonsensical assignments to None.class, or 2.class, but it is too heavy handed in preventing assignments to [1,2,3].class, (1,2,3).class or {1:2,3:4}.class.
My specific use-case involves dictionary and list objects. I define a classes that inherits from list or dict and add specialized algebraic, vector and tensor functions over the range and domain of the data in the list or dictionary. I could just copy the data into my new objects, but it is wasteful since these structures can be very large and deeply nested.
I suspect that it is possible to come up with better criteria for allowing safe assignment to class that will still allow the useful technique I describe above.
Thanks, -Kevin
-- Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com
- Previous message: [Python-Dev] Any Lasso'ers on the list ?
- Next message: [Python-Dev] Assignment to __class__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]