Skip to content

Comment on Is Python call-by-value or call-by-reference? Neither.parent

Comments

The usual phrase I've seen to describe this is "passes references by value". And it's the norm in almost all popular OOP languages since the mid-90s.

I like to think of this as "call-by-name". That's because every name in python is actually a lookup in a dictionary mapping strings to values. This is different from languages like C# and Java where some things such as class and function references can actually be thought of as "values". In python, everything that isn't a keyword or a literal is a name, thinking otherwise leads to gotchas.

The term call-by-name already exists and means something entirely different. It will blow your mind. http://www.cs.sfu.ca/~cameron/Teaching/383/PassByName.html

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.