(Don't seem to be getting much interest or traction on this so I'm about
ready to give up on it, but I should still respond)


> yeach! as you said, a string is a sequence, and that's a good thing.
>

Yes but as you said: it's a sequence of infinitely recursive length 1
sequences. It's definitely a different animal. And the type checking is a
chore regardless of whether it's the only string type (though there's also
the byte string).

and dicts being an iterable of the keys is kind of nice, too -- and once
you have that, they they should be able to be passed into into sequence
constructors.


But the other side to this is you end up on occasion also guarding against
dict with a type check, or both dict AND str-- and I could even see
guarding against set. Though certainly not nearly as often as str by itself.

(and I actually have done list(a_dict) on purpose when I needed a list of
the keys in a dict.


I think that is done all the time by lots of people. But if you are dealing
with dicts, a strict alt constructor would simply be the wrong choice.
Thinking about it more: if such a strict non-str-sequence constructor
existed, perhaps it should also exclude sets, which aren't even sequences.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to