Matthias Bussonnier added the comment:

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':'"'})

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to