Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95324 > unrolled thread

Re: Ensure unwanted names removed in class definition

Started byBen Finney <ben+python@benfinney.id.au>
First post2015-08-13 08:55 +1000
Last post2015-08-13 08:55 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Ensure unwanted names removed in class definition Ben Finney <ben+python@benfinney.id.au> - 2015-08-13 08:55 +1000

#95324 — Re: Ensure unwanted names removed in class definition

FromBen Finney <ben+python@benfinney.id.au>
Date2015-08-13 08:55 +1000
SubjectRe: Ensure unwanted names removed in class definition
Message-ID<mailman.147.1439420405.3627.python-list@python.org>
MRAB <python@mrabarnett.plus.com> writes:

> Have you thought about catching the NameError?

I had not, but that is obvious now you say it. Thanks.

Where there isn't a more elegant solution, I'll use that. It might not
be elegant, but it's at least clear and expressive of the intent.


Jussi Piitulainen <ei@kun.ei.invalid> writes:

> Make them an implementation detail:
>
>     plumage = [
>         (__foo__, __bar__) for (__foo__, __bar__) in feathers.items()
>         if __bar__ == "beautiful" ]

That still makes the name persist, so doesn't meet the requirements. It
also commits the further mistake of using a ‘__dunder__’ name style for
something that *isn't* a Python magic attribute.

Thanks for the attempt :-)

-- 
 \                 “Teeth extracted by the latest Methodists.” dentist |
  `\                                          advertisement, Hong Kong |
_o__)                                                                  |
Ben Finney

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web