[Python-ideas] Python Users Aren't Perfect

Georg Brandl g.brandl at gmx.net
Thu Dec 15 21:24:27 CET 2011


On 12/13/2011 03:44 AM, Stephen J. Turnbull wrote:
> Greg Ewing writes:
>  > Masklinn wrote:
>  > 
>  > > FWIW, Haskell does not have a literal singleton (the standard defines 
>  > > "unit" `()` and 2-tuple through 15-tuple)
>  > 
>  > That's because, due to its static typing, there is no
>  > reason you would ever need to use a 1-tuple rather than
>  > a bare value. We're not that lucky in Python, though.
> 
> I think you have misstated your point?  That's not due to static
> typing, that's because you may *always* identify 1-factor products
> with the only factor, and Haskell made a deliberate decision to
> consistently represent the isomorphism class by the factor rather than
> the product.

Well, I would say the reason is that the type "tuple of any length" does
not exist in Haskell.  So there's no way you will have to pass a 1-tuple
to a function that operates on tuples only.

But of course, if we all used tuples as tuples only, we wouldn't have to do
that either.  It's only because we use tuples as sequences every so often.

Georg




More information about the Python-ideas mailing list