terminological obscurity

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Elaine Jackson

    terminological obscurity

    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'):
    [color=blue][color=green][color=darkred]
    >>> prince=tuple()
    >>> king=[prince]
    >>> del prince[/color][/color][/color]

    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[i] " count as a 'name'?


  • Terry Reedy

    #2
    Re: terminological obscurity


    "Elaine Jackson" <elainejackson7 355@home.com> wrote in message
    news:L6erc.5196 86$Pk3.412259@p d7tw1no...[color=blue]
    > Some questions from a curious monkey.
    >
    > All tuple methods are also list methods, and most list methods are also[/color]
    tuple[color=blue]
    > methods; among those that are NOT also tuple methods, there are exactly[/color]
    two[color=blue]
    > ('count' and 'index') that do not involve mutation. Is there any special[/color]
    reason[color=blue]
    > why they AREN'T also tuple methods?[/color]

    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.

    ############### ############### ############### ############### #####[color=blue]
    > A question about terminology ('namespace'):
    >[color=green][color=darkred]
    > >>> prince=tuple()
    > >>> king=[prince]
    > >>> del prince[/color][/color]
    >
    > At this point, does the object formerly known as prince belong to the[/color]
    namespace[color=blue]
    > implemented by globals()?[/color]

    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.
    [color=blue]
    > More generally, is there a terminological way to
    > distinguish between (1) a function from a set of names into a set of[/color]
    objects,
    a namespace[color=blue]
    > and (2) the aforementioned set of objects?[/color]
    a dataspace

    ############### ############### ############### ############### #####[color=blue]
    > Is there a handy noun that refers to sameness of identity in the same way[/color]
    that[color=blue]
    > 'equality' refers to sameness of value?[/color]

    identity
    [color=blue]
    > ('Identicalness ' is pretty clumsy, and
    > 'identity' is confusing, since it already has a meaning that is closely[/color]
    related[color=blue]
    > but needs to be kept distinct.)[/color]

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

    ############### ############### ############### ############### #####[color=blue]
    > A question about terminology ('name'):
    >
    > Suppose X is a container that contains n items (incidentally, is 'items'[/color]
    the[color=blue]
    > right term?)[/color]

    Yes (which is to say, I use it all the time ;-).
    [color=blue]
    >and i in an integer with 0<=i<=n. Does " X[i] " count as a 'name'?[/color]

    Only allegorically in that it does identify an item. In an expression
    context, 'X[i]' 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




    Comment

    • Donn Cave

      #3
      Re: terminological obscurity

      In article <L6erc.519686$P k3.412259@pd7tw 1no>,
      "Elaine Jackson" <elainejackson7 355@home.com> wrote:
      [color=blue]
      > 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?[/color]

      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 indiscriminatel y to the
      values of a tuple, because they lose their meaning out of context.

      [color=blue]
      > A question about terminology ('namespace'):
      >[color=green][color=darkred]
      > >>> prince=tuple()
      > >>> king=[prince]
      > >>> del prince[/color][/color]
      >
      > 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?[/color]

      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.
      [color=blue]
      > 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.)[/color]

      What meaning is that? I would use identity.
      [color=blue]
      > 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[i] " count as a
      > 'name'?[/color]

      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@u.washingt on.edu

      Comment

      • Aahz

        #4
        Re: terminological obscurity

        In article <L6erc.519686$P k3.412259@pd7tw 1no>,
        Elaine Jackson <elainejackson7 355@home.com> wrote:[color=blue]
        >
        >A question about terminology ('namespace'):
        >[color=green][color=darkred]
        >>>> prince=tuple()
        >>>> king=[prince]
        >>>> del prince[/color][/color]
        >
        >At this point, does the object formerly known as prince belong to
        >the namespace implemented by globals()? More generally, is there a
        >terminologic al way to distinguish between (1) a function from a set of
        >names into a set of objects, and (2) the aforementioned set of objects?[/color]

        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.
        [color=blue]
        >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.)[/color]

        "Identity"
        [color=blue]
        >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[i]
        >" count as a 'name'?[/color]

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

        Adopt A Process -- stop killing all your children!

        Comment

        Working...