A small inconsistency in syntax?
Michael Abbott
michael at rcp.co.uk
Thu Oct 25 12:01:04 EDT 2001
"Steve Holden" <sholden at holdenweb.com> wrote in
news:x3WB7.28536$Nx2.553375 at atlpnn01.usenetserver.com:
> "Michael Abbott" <michael at rcp.co.uk> wrote in message
> news:Xns91459674D7271michaelrcpcouk at 194.238.50.13...
>
> Oh, no it isn't. The best parallel I can think of is writing
>
>>>> 2 = 34
> Traceback (SyntaxError: can't assign to literal
>
> although in your case you are trying to assign to a constructor rather
> than a literal
Hmm. Ok, I think I'll buy that. Yes, I guess I might expect to get a run-
time whinge about mismatching values instead, but I think I'm getting silly
now.
>> time, status, _ = myobject.read()
>>
>
> Or, if you really don't want to do that, how about
>
> time, status = myobject.read()[:2]
No, I think I prefer my original! Ta.
More information about the Python-list
mailing list