"has" Operator
Joshua Marshall
jmarshal at mathworks.com
Mon Jul 9 01:09:11 EDT 2001
Quinn Dunkan <quinn at yak.ugcs.caltech.edu> wrote:
...
> 'x has y' would also have a nice resemblance to 'x in y', where one
> checks if y is in the object itself, and the other checks if y is in
> the container the object represents. I don't want the former
> functionality often enough to think a keyword is worth it, though.
In the case of 'x in y', 'x' and 'y' are both variables, but in the
case of 'x has y', 'x' is a variable but 'y' is a name. I think that
could be confusing.
On the other side of things, it seems this could be introduced into
the language without making 'has' a keyword--no syntactic rules
currently use concatenation.
More information about the Python-list
mailing list