>> I think we might need to have a frozenbytes object too.
Guido> I believe YAGNI. Also, I'm not keen on all these frozen variants.
Guido> Hands up who's ever used a frozen set or needed a frozen dict?
On the rare occasion where I've wanted to use a dict (for example) as a key
in another dict, I've just used tuple(dict1.values()). In this context I've
obviously only cared about shallow dicts.
Idle thought alert:
Would it be possible in principle to implement a freeze object which returns
a proxy that prevents the proxied object from being modified, e.g.:
def freeze(obj):
return Freezer(obj)
where the Freezer class is suitably powerful (knowing at least about all the
various methods which can modify an object, maybe about some protocol to
describe methods that can modify an object)?
Now I know it could get messy (__setattr__, list.append, etc.), and like I
said, this is just an idle thought, but still, if it was possible, you could
freeze just about anything and not have to create special frozen varieties
of every containiner type.
Skip
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins