Puzzling difference between lists and tuples

Grant Edwards grant.b.edwards at gmail.com
Fri Sep 18 14:49:14 EDT 2020


On 2020-09-18, Chris Angelico <rosuav at gmail.com> wrote:
> On Fri, Sep 18, 2020 at 10:53 AM Grant Edwards
><grant.b.edwards at gmail.com> wrote:
>>
>> On 2020-09-17, MRAB <python at mrabarnett.plus.com> wrote:
>> >> The only time the parentheses are required for tuple building is when
>> >> they would otherwise not be interpreted that way:
>> >>
>> > They're needed for the empty tuple, which doesn't have a comma.
>> >
>> >> some_func('first', 'second')   # some_func called with two str args
>> >>
>> >> some_func(('first', 'second')) # some_func called with one tuple arg
>>
>> Yea, the syntax for tuple literals has always been a bit of an ugly
>> spot in Python.  If ASCII had only had one more set of open/close
>> brackets...
>
> ...then I'd prefer them to be used for sets, actually. I think the
> set/dict collision is more weird than the tuple/grouping one.
>
> Now, if only ASCII had *two* more sets of open/close brackets...

Rigth. I had forgotten about sets -- they're still a "new" feature in
my mind, and I rarely seem to run into situations where I use them.

There must be a few more sets of brackets in Unicode...

--
Grant




More information about the Python-list mailing list