471,310 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Quick shallow-copy idiom

y = type(x)(x)
Sep 19 '07 #1
1 1074
On Sep 19, 10:48 am, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealandwrote:
y = type(x)(x)
Nice trick, but is it better than the explicit:
y = copy.copy(x)

(I think not, because copy.copy works for example, on classes
which take more than one argument to their constructor).

--
Paul Hankin

Sep 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.