On 22/08/12 20:03, Evan Driscoll wrote:
On 08/22/2012 12:46 PM, lipska the kat wrote:
If you can show me a 'type' that cannot be assigned to

a

in the same scope then I would be most interested to know, I haven't
found one yet.

[snip]


Second, this concept isn't *so* unfamiliar to you. If I give you the
following Java code:

   void foo(Object o) { ... }

and ask what type 'o' is, there are kind of two answers. The first is
that 'o' is an 'Object'. But you can't make an Object -- that's an
abstract class. (IIRC. If it's not then just bear with me; you get the
idea. :-)) So from a strictly static type-theory point of view, 'foo' is
unusable because it takes a type which you can never create. But of
course that's not the case, because in actual Java 'o' has some dynamic
type which is a subclass of 'Object'.

Well I think this is where I'm struggling a bit.

looking at this method declaration I can see that the method takes an argument of type Object (and just FYI class Object is not abstract and you can do Object o = new Object()) and does not return a value. I know that for the lifetime of this JVM, whatever o turns out to be it will always be an Object. I can't assign a primitive to o as ints chars floats etc are certainly not Objects. There are certain invariants that give me a warm and comfortable feeling inside.

compare this to a function declaration in Python

def foo(self):

... I can learn nothing about this function by looking at the first line

If I see

def foo(self, someVar=1):

I can determine that foo takes an argument that, at some time or other is or has been a number of some description but I can't rely on it and I have no idea what is returned and that's where I think I'm having trouble.

But I will get over it and I will learn the language and I may look back on these exchanges and say ... I was wrong, this is so much better that what I was used to, or maybe I won't. I'll let you know

Thank you for your calm and reasoned response.

Disclaimer:
None of my comments above should be construed as criticisms
they are just observations.

lipska

--
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to