On Jul 7, 2:28 pm, Kyle VanderBeek <[email protected]> wrote:
> On Tue, Jul 7, 2009 at 1:09 PM, Mike Orr<[email protected]> wrote:
> > As a contrary view, 'map' is a logical name for it. Many people have
> > a variable 'file', which also shadows a builtin. 'route_map' is
> > oververbose, especially with long arguments. 'rmap' might be OK.
>
> Just because people "get away with" doing a dangerous thing doesn't
> make it an argument in favor of doing it. As almost anyone's father
> would opine, "Just because others are jumping off a cliff doesn't mean
> you should go do it too." That built-ins are not reserved words is a
> matter of design pragmatism in Python (keeping the grammar small) more
> than anything else. Leaving those names alone should be a matter of
> shared convention among coders to avoid confusion.
[Hit Send accidentally last time]
I don't agree that this is "dangerous." I don't even think it's a
slightly big deal. Sometimes `map` is the best name for a var;
sometimes `id` is. I rarely (never?) use those built-ins, and I'd
rather use the most appropriate (and not overly-verbose name) in a
local scope than worry about a name clash, which is unlikely and can
be easily worked around in those rare cases where it's an issue.
> As for saving a couple characters when typing, I generally find that
> to be fruitless and non-pythonic (otherwise we should save typing by
> renaming the whole project pylns with the libraries ctrlrs, db, and
> tmplt). Since this is template code, it ought ought to exemplify good
> style; that includes unambiguous, non-abbreviated variable names.
Cutting vowels is a bit different from using a shorter name in a given
scope where the meaning is clear (i.e., I don't think `route_map`
conveys more meaning than `map`). And there are plenty of (possibly
domain-specific) cases where an abbreviation or acronym is
appropriate. I bet you use `i` as a loop counter. I use well-known
acronyms like `db`, `exc`, and `wkt` ("well known text"). In my
`make_map` function I use `mc` for `map.connect` and `mr` for
`map.resource`.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---