[Tutor] How is "set(ls).add('a') evaluated? [Was: Re: A program that can check if all elements of the list are mutually disjoint]
Marc Tompkins
marc.tompkins at gmail.com
Sun Jun 6 20:01:18 EDT 2021
On Sun, Jun 6, 2021 at 4:11 PM Mats Wichmann <mats at wichmann.us> wrote:
> On 6/6/21 5:05 PM, Cameron Simpson wrote:
>
> > "add" is a verb. It modifies the set. "union" is a noun: it returns a
> > thing computed from the set(s).
> ...
> > Grammar helps, provided that people have put a little effort into naming
> > the API calls.
>
> Yeah, that: API design is actually not that easy. Including naming :)
>
This reminds me of a conversation I had, years ago, when I was puzzled over
whether a particular (Los Angeles) street was a boulevard or an avenue. My
associate was shocked - SHOCKED! - that I didn't know that avenues are
always north/south and boulevards always east/west. So I pulled out the
Thomas Guide and showed him multiple intersections in our
neighborhood where two avenues, or two boulevards, crossed at right angles.
It's all very well knowing the canonical rules, but if there are enough
exceptions the rules become almost a hindrance to understanding.
More information about the Tutor
mailing list