[Python-Dev] syntactic support for sets
John J Lee
jjl at pobox.com
Thu Feb 2 21:30:00 CET 2006
On Wed, 1 Feb 2006, Greg Wilson wrote:
>> Like many things in Python where people pre-emptively believe one thing
>> or another, the interpreter's corrective feedback is immediate:
>
> Yup, that's the theory; it's a shame practice is different.
So what mistake(s) *do* your students make? As people have pointed out,
the mistake you complain about *does* usually result in an immediate
traceback:
>>> set(1, 2, 3)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: set expected at most 1 arguments, got 3
>>> set(1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: iteration over non-sequence
>>>
Perhaps this?
>>> set("argh")
set(['a', 'h', 'r', 'g'])
>>>
[...]
> the language, but I'd rather eliminate the sand traps than reuqire people
> to learn to recognize and avoid them.
I'm sure nobody would disagree with you, but of course the devil is in
the detail.
John
More information about the Python-Dev
mailing list