Re: [Pyobjc-dev] Re: Structs, tuples and instances
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-11-04 10:29:09
|
Ronald Oussoren wrote: > The patch for Python is easy enough, but there is one major downside > of this patch: writeable structseqs are not hashable, which makes it > impossible to use these objects as keys in dictionaries. Making them > hashable would be easy, it would even decrease the size of the patch, > but would make it possible to create invalid dicts: Under *no* circumstance this should be possible. If an object is hashable, it should be immutable. If this is not true, you're breaking a major dict invariant and you can't blame the user if things go wrong. For the same reason I think that pyobjc_unicode.syncFromNSString() is an extremely bad idea and should be removed. It's not even needed: if you work with an NSMutableString that actually mutates, you can get the up-to-date Python value with unicode(aMutableString.nsstring()). Just |