[Python-ideas] Module aliases and/or "real names"

Nick Coghlan ncoghlan at gmail.com
Wed Jan 5 16:57:12 CET 2011


On Wed, Jan 5, 2011 at 11:42 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> So should I do this in unittest for Python 2.7 / 3.2?
>
> The problem this *would* solve is that pickled unittest objects from 2.7 /
> 3.2 can't be unpickled on earlier versions of Python.
>
> I don't know how *real* a problem it is or whether it is worth losing /
> faking the __module__ information on these classes to solve it. Sure it's a
> problem that is likely to bite *someone* at some point, but not very many
> people. If someone is using __module__ information to find source code (or
> anything else) for a class then changing __module__ will break that, so I'm
> not convinced it's a worthwhile tradeoff.

The two examples I looked at (functools and datetime) favoured hiding
the implementation details at the cost of causing introspection
problems. Despite my comments in the opening post of the thread, I
think that is the better trade-off to make.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list