This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mbussonn
Recipients mbussonn, py.user, serhiy.storchaka
Date 2015-05-31.23:43:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433115823.98.0.947813976529.issue24338@psf.upfronthosting.co.za>
In-reply-to
Content
Minimal changes to the repr seem to work.
I can submit a proper patch.

class N2(Namespace):
    
    def __repr__(self):
        type_name = type(self).__name__
        arg_strings = []
        unarg={}
        for arg in self._get_args():
            arg_strings.append(repr(arg))
        for name, value in self._get_kwargs():
            if name.isidentifier():
                arg_strings.append('%s=%r' % (name, value))
            else:
                unarg[name] = value
        if unarg:
            r_unarg = ', **%s' %(repr(unarg))
        else:
            r_unarg = ''
        return '%s(%s%s)' % (type_name, ', '.join(arg_strings), r_unarg)

>>> N2(a=1, b=2, **{"single ' quote ":"'", 'double " quote':'"'})
N = N2(a=1, b=2, **{"single ' quote ":"'", 'double " quote':'"'})
History
Date User Action Args
2015-05-31 23:43:44mbussonnsetrecipients: + mbussonn, py.user, serhiy.storchaka
2015-05-31 23:43:43mbussonnsetmessageid: <1433115823.98.0.947813976529.issue24338@psf.upfronthosting.co.za>
2015-05-31 23:43:43mbussonnlinkissue24338 messages
2015-05-31 23:43:43mbussonncreate