Passing a callable object to Thread
Jeff Schwab
jeff at schwabcenter.com
Mon Feb 18 23:26:23 CET 2008
Lie wrote:
> On Feb 16, 12:29 pm, Jeff Schwab <j... at schwabcenter.com> wrote:
>> Paul Rubin wrote:
>>> Jeff Schwab <j... at schwabcenter.com> writes:
>>>> Why not? They seem intuitive to me. I would find it weird if you
>>>> couldn't have 0-tuple, and even weirder if you couldn't have a
>>>> 1-tuple. Maybe my brain has been warped by too much C++ code.
>>> The idea is that a 2-tuple (of numbers, say) is a pair of numbers, a
>>> 3-tuple is three numbers, and a 1-tuple is one number. That would
>>> mean a number and a 1-tuple of numbers are the same thing, not
>>> separate types.
>> No, that doesn't follow. A set with one element is not the same thing
>> as that element, a sequence of one element is not the same thing as that
>> element, and a tuple with one element is not the same thing as that element.
>
> Probably the analogue of tuples in human language would be like this:
> A: What ice-cream flavour do you have?
> B: "Vanilla", "Chocolate", and "Strawberry"
>
> If, for example, he only have Vanilla:
> A: What ice-cream flavour do you have?
> B: "Vanilla"
>
> This way of thinking makes 1-tuple the same as the element itself.
Yes. I first heard the term "tuple" in a physics class, where it was
used to mean that a mathematical function took an arbitrary number of
objects. It was by analog with "triple, quadruple, quintuple...
n-tuple." That's a different context than computer science, though,
which is a specific branch of mathematics with its own terminology. In
CS, a tuple is a kind of data structure that is specifically not
identical with any of its elements. That's the sort of tuple used in
Python.
More information about the Python-list
mailing list