Python vs. Io

Sean Ross sross at connectmail.carleton.ca
Sat Jan 31 15:28:59 EST 2004


"Daniel Ehrenberg" <LittleDanEhren at yahoo.com> wrote in message
news:711c7390.0401311134.26cd0a11 at posting.google.com...
[snip]
> (everything is public and methods
> can be called with just references),

Okay. So, is there no way to have private attributes/operations?
Or, like in Python, is there just a convention? "_slotName"

[snip]
>Also, when initializing variables,
> their scope must be specified (which is the whole reason for the
> difference between := and =), so id := allocated should probably be
> self id := allocated. self, along with a few other variables, is
> implicitly sent to all functions (and do).

Okay. So, if I set 'self id', like so

    self id := allocated

and want to update it later in the same block I can use

    id = "updated self 'id' slot value"

But, if I later use

    id := "set new local 'id' slot value"

in the same block I get a new local variable. Is that how it works?
Or does the first use of a slot determine its assignment scope
for the duration of the block?

    self a := "unchanged"
    a := "changed"
    write("self a is ", self a)   # changed or unchanged?





More information about the Python-list mailing list