[ python-Feature Requests-1637926 ] Empty class 'Object'

SourceForge.net noreply at sourceforge.net
Sat Jan 20 19:35:53 CET 2007


Feature Requests item #1637926, was opened at 2007-01-17 09:51
Message generated for change (Comment added) made by josiahcarlson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1637926&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: kxroberto (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: Empty class 'Object'

Initial Comment:
An empty class 'Object' in builtins, which can be instantiated (with optional inline arguments as attributes (like dict)), and attributes added. Convenience - Easy OO variable container - known to pickle etc.

http://groups.google.com/group/comp.lang.python/msg/3ff946e7da13dba9

http://groups.google.de/group/comp.lang.python/msg/a02f0eb4efb76b24

idea:

class X(object):
    def __init__(self,_d={},**kwargs):
        kwargs.update(_d)
        self.__dict__=kwargs
class Y(X):
    def __repr__(self):
        return '<Y:%s>'%self.__dict__

------

x=X(spam=1) 
x.a=3




Robert

----------------------------------------------------------------------

Comment By: Josiah Carlson (josiahcarlson)
Date: 2007-01-20 10:35

Message:
Logged In: YES 
user_id=341410
Originator: NO

This has been requested in various forms over the years.  See the "bunch"
discussion on the python-dev mailing list from over a year ago.  There may
have even been a PEP.  I believe the general consensus was "it would be
convenient sometimes, but it is *trivial* to implement it as necessary". 
Also, not every X-line function or class should be included with Python.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1637926&group_id=5470


More information about the Python-bugs-list mailing list