Reply to post: Re: Extinct

Everyone loves programming in Python! You disagree? But it's the fastest growing, says Stack Overflow

Yes Me Silver badge

Re: Extinct

"Everything is assigned by reference"

True. But

x=1

y=x

assigns a reference to the constant "1" to y, so this behaves like an assignment in every other language I've ever seen. Whereas if x is (the name of) a compound object you get a reference to the object. If that's not what you want, you have to use copy or deepcopy or whatever.

I have no intellectual difficulty understanding this. But it really is a trap for the unwary.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon