Fredrik Lundh wrote: > > tim wrote: > > It's a std way to get a clone of an object, and when you don't want mutations > > of the clone to have any effect on the original (or vice versa). Perhaps if > > I call it the Clone Pattern, people will assume that makes it a good thing > > and cut that part of the debate mercifully short <wink>. > > which leads to a followup question: the current approach > seems to be to hack the copy.py file for each and every > type. imo, that's rather unpythonic, and also introduces > lots of unnecessary module dependencies. > > time to add a __clone__ slot? > > or could someone who knows what he's doing here address > this comment in copy.py: > > # XXX need to support copy_reg here too... All you have to do is implement the copy protocol (ie. .copy()) for the type/class in question. -- Marc-Andre Lemburg ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4