Re: IsString



On Tue, 13 Dec 2005, Steven D'Aprano wrote:

On Mon, 12 Dec 2005 18:51:36 -0600, Larry Bates wrote:

[snippidy-doo-dah]

I had the same thought, but reread the post. He asks "if a given variable is a character or a number". I figured that even if he is coming from another language he knows the difference between "a given variable" and the "contents of a give variable". I guess we will see.... ;-). This list is so good, he gets BOTH questions answered.

The problem is, Python doesn't have variables (although it is oh-so-tempting to use the word, I sometimes do myself). It has names in namespaces, and objects.

In what sense are the names-bound-to-references-to-objects not variables?

It be a subtle difference, but an important one.

No, it's just spin, bizarre spin for which i can see no reason. Python has variables.


That's why, for instance, Python is neither call by reference nor call by value, it is call by object.

No, python is call by value, and it happens that all values are pointers. Just like java, but without the primitive types, and like LISP, and like a load of other languages. Python's parameter passing is NO DIFFERENT to that in those languages, and those languages are ALL described as call-by-value, so to claim that python does not use call-by-reference but some random new 'call-by-object' convention is incorrect, unneccessary, confusing and silly.


</rant>

I'm sure this has been argued over many times here, and we still all have our different ideas, so please just ignore this post!

tom

--
So the moon is approximately 24 toasters from Scunthorpe.
.



Relevant Pages

  • Re: IsString
    ... one which you should understand in order to understand the nature of Python. ... In C if you declare a variable as a character string of length 24, the compiler will generate code that allocates 24 bytes to this variable on the stack frame local to the function in which it's declared. ... Just like java, but without the primitive types, and like LISP, and like a load of other languages. ... Python's parameter passing is NO DIFFERENT to that in those languages, and those languages are ALL described as call-by-value, so to claim that python does not use call-by-reference but some random new 'call-by-object' convention is incorrect, unneccessary, confusing and silly. ...
    (comp.lang.python)
  • Re: Finding the instance reference of an object
    ... It's been a LONG time since I did anything in C, but yes, I believe that reference parameters were an addition that came with C++. ... If it doesn't, it's call-by-value. ... Python's behavior is exactly and always equivalent to the "ByVal" behavior of languages that have both behaviors. ... (Perhaps explaining why there appears to be far more confusion about call semantics in the Python community than in the community of other languages where the default semantics are exactly the same.) ...
    (comp.lang.python)
  • Re: VERY simple question about "?"
    ... don't see the equivalence between a string delimiter, or a character that signals the beginning of a symbol, and a symbol that is actually productive of something. ... Part of my difficulty understanding you is probably caused by the fact that you seem to try to tackle problems of computer languages with tools from a complete different domain. ... "Tom" - my name can also be called, but when one does so IT doesn't spring into action at all. ...
    (comp.lang.ruby)
  • Re: Any arguments for keeping Yum case-sensitive?
    ... original poster to a basic course on language and locales and character ... No - in fact in English it is basically OK but in other languages it is ... is RPM name A == RPM name B ... character set, case conversion and the like are huge. ...
    (Fedora)
  • Re: RfD: XCHAR wordset (for UTF-8 and alike)
    ... >encoding can be used; latin-1 is most widely used, ... >languages, different char-sets have to be used, several of them ... How does this fit in with the wide character and internationalisation ...
    (comp.lang.forth)