terminological obscurity

Discussion in 'Python' started by Elaine Jackson, May 21, 2004.

  1. Some questions from a curious monkey.

    All tuple methods are also list methods, and most list methods are also tuple
    methods; among those that are NOT also tuple methods, there are exactly two
    ('count' and 'index') that do not involve mutation. Is there any special reason
    why they AREN'T also tuple methods?

    #################################################################

    A question about terminology ('namespace'):

    >>> prince=tuple()
    >>> king=[prince]
    >>> del prince


    At this point, does the object formerly known as prince belong to the namespace
    implemented by globals()? More generally, is there a terminological way to
    distinguish between (1) a function from a set of names into a set of objects,
    and (2) the aforementioned set of objects?

    #################################################################

    Is there a handy noun that refers to sameness of identity in the same way that
    'equality' refers to sameness of value? ('Identicalness' is pretty clumsy, and
    'identity' is confusing, since it already has a meaning that is closely related
    but needs to be kept distinct.)

    #################################################################

    A question about terminology ('name'):

    Suppose X is a container that contains n items (incidentally, is 'items' the
    right term?) and i in an integer with 0<=i<=n. Does " X " count as a 'name'?
     
    Elaine Jackson, May 21, 2004
    #1
    1. Advertising

  2. Elaine Jackson

    Terry Reedy Guest

    "Elaine Jackson" <> wrote in message
    news:L6erc.519686$Pk3.412259@pd7tw1no...
    > Some questions from a curious monkey.
    >
    > All tuple methods are also list methods, and most list methods are also

    tuple
    > methods; among those that are NOT also tuple methods, there are exactly

    two
    > ('count' and 'index') that do not involve mutation. Is there any special

    reason
    > why they AREN'T also tuple methods?


    Is history a special reason? Once upon a time, (before 2.2) tuples (and
    some other types) had no methods. Those it now has are generic object and
    sequence methods. Guido did not add the two non-mutating list methods
    because he does not consider them needed for tuples. That is related to
    his view that tuples are for hetero and not for homo sequences.

    Others have made the same observation you did. Google might reveal more,
    or some posts might be on the PyDev archives.

    #################################################################
    > A question about terminology ('namespace'):
    >
    > >>> prince=tuple()
    > >>> king=[prince]
    > >>> del prince

    >
    > At this point, does the object formerly known as prince belong to the

    namespace
    > implemented by globals()?


    I personally do not think of objects as 'belonging' to a namespace. They
    'exist' in a separate 'dataspace' and get non-exclusively associated with 0
    or more names in 0 or more namespaces.

    If the above is the complete program up to that point, then the empty tuple
    is not directly associated with 'king', the only remaining name, but is
    associated with the first slot of king, king[0]. So pick your answer or
    reformulate your question.

    > More generally, is there a terminological way to
    > distinguish between (1) a function from a set of names into a set of

    objects,
    a namespace
    > and (2) the aforementioned set of objects?

    a dataspace

    #################################################################
    > Is there a handy noun that refers to sameness of identity in the same way

    that
    > 'equality' refers to sameness of value?


    identity

    > ('Identicalness' is pretty clumsy, and
    > 'identity' is confusing, since it already has a meaning that is closely

    related
    > but needs to be kept distinct.)


    English words sometimes have similar but distinct meanings. In brief, my
    dictionary says 'identity': 1. sameness; 2. individuality.

    #################################################################
    > A question about terminology ('name'):
    >
    > Suppose X is a container that contains n items (incidentally, is 'items'

    the
    > right term?)


    Yes (which is to say, I use it all the time ;-).

    >and i in an integer with 0<=i<=n. Does " X " count as a 'name'?


    Only allegorically in that it does identify an item. In an expression
    context, 'X' is an expression. To the left of '=', it is a 'target':
    names are a subset of targets.

    'name' is pretty strictly defined as <alpha> <alnum>*. There are proposals
    to expand the set but that is another thread (and controversy).

    Terry J. Reedy
     
    Terry Reedy, May 21, 2004
    #2
    1. Advertising

  3. Elaine Jackson

    Donn Cave Guest

    In article <L6erc.519686$Pk3.412259@pd7tw1no>,
    "Elaine Jackson" <> wrote:

    > All tuple methods are also list methods, and most list methods are also tuple
    > methods; among those that are NOT also tuple methods, there are exactly two
    > ('count' and 'index') that do not involve mutation. Is there any special
    > reason
    > why they AREN'T also tuple methods?


    Not to speculate on the reason (that would be for Guido or someone
    who channels him to say), but suppose you accept the proposition that
    a tuple is not just an immutable list, it's intended to serve in a
    really distinct role. Now you can invert your question to ask, what's
    the apparent role of a sequence type that isn't interested in its
    length, nor in sequential searches?

    If you look at common use of tuple in the core language, I think it
    might be fairly clear what that's about. Take dict.items(), for
    example - a list, of tuples. The list is not a list because we want
    it to be mutable (what a horrible thought), but because it's a
    collection of conceptually similar objects ... so naturally, we
    want to know how many (length) and maybe we'd be interested in
    searching the list for things (though that would probably be silly
    in this particular case.)

    On the other hand, the key, value pair is a tuple because it always
    contains two values, and they're not interchangeable at all. What
    good is the length here? If it isn't two, something has gone very
    wrong. It makes no sense to apply a search indiscriminately to the
    values of a tuple, because they lose their meaning out of context.


    > A question about terminology ('namespace'):
    >
    > >>> prince=tuple()
    > >>> king=[prince]
    > >>> del prince

    >
    > At this point, does the object formerly known as prince belong to the
    > namespace
    > implemented by globals()? More generally, is there a terminological way to
    > distinguish between (1) a function from a set of names into a set of objects,
    > and (2) the aforementioned set of objects?


    Well, the "prince" binding disappears, but the object continues to
    belong to it indirectly, through that list reference. The more
    general question you pose is not clear to me.

    > Is there a handy noun that refers to sameness of identity in the same way
    > that
    > 'equality' refers to sameness of value? ('Identicalness' is pretty clumsy,
    > and
    > 'identity' is confusing, since it already has a meaning that is closely
    > related
    > but needs to be kept distinct.)


    What meaning is that? I would use identity.

    > A question about terminology ('name'):
    >
    > Suppose X is a container that contains n items (incidentally, is 'items' the
    > right term?) and i in an integer with 0<=i<=n. Does " X " count as a
    > 'name'?


    I imagine in some contexts we may use name that way, as an expedient
    in casual usage, but I hope it isn't official nomenclature. You could
    call it a "binding". (If you're trying to square this all up in some
    kind of CS context, see if you can compare the Lisp usage of that term.)

    Donn Cave,
     
    Donn Cave, May 21, 2004
    #3
  4. Elaine Jackson

    Aahz Guest

    In article <L6erc.519686$Pk3.412259@pd7tw1no>,
    Elaine Jackson <> wrote:
    >
    >A question about terminology ('namespace'):
    >
    >>>> prince=tuple()
    >>>> king=[prince]
    >>>> del prince

    >
    >At this point, does the object formerly known as prince belong to
    >the namespace implemented by globals()? More generally, is there a
    >terminological way to distinguish between (1) a function from a set of
    >names into a set of objects, and (2) the aforementioned set of objects?


    Objects don't have a namespace, only names and attributes do. Names are
    bound to objects. All objects are global to the entire interpreter (not
    just within a module by the usual meaning of "global").

    It's not clear to me what your (1) and (2) are supposed to refer to.

    >Is there a handy noun that refers to sameness of identity in the same
    >way that 'equality' refers to sameness of value? ('Identicalness' is
    >pretty clumsy, and 'identity' is confusing, since it already has a
    >meaning that is closely related but needs to be kept distinct.)


    "Identity"

    >A question about terminology ('name'):
    >
    >Suppose X is a container that contains n items (incidentally, is
    >'items' the right term?) and i in an integer with 0<=i<=n. Does " X
    >" count as a 'name'?


    "Item" or "element" are both correct. X is a target. See the
    Language Reference, section 6.3.
    --
    Aahz () <*> http://www.pythoncraft.com/

    Adopt A Process -- stop killing all your children!
     
    Aahz, May 22, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tino Lange
    Replies:
    7
    Views:
    485
    Paul Rubin
    Jul 31, 2003
  2. Michael Chermside

    terminological obscurity

    Michael Chermside, May 21, 2004, in forum: Python
    Replies:
    84
    Views:
    1,621
    Donn Cave
    Jun 2, 2004
  3. Perry Smith

    .gemrc obscurity

    Perry Smith, Jul 26, 2009, in forum: Ruby
    Replies:
    1
    Views:
    145
    Eric Hodel
    Jul 27, 2009
Loading...

Share This Page