Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #13209
| References | <mailman.793.1315297135.27778.python-list@python.org> <4e6ecde2$0$29965$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2011-09-13 13:42 +1000 |
| Subject | Re: strang thing: |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1057.1315885379.27778.python-list@python.org> (permalink) |
On Tue, Sep 13, 2011 at 1:28 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> The best solution is to avoid using the name "open", instead call it "open_"
> (underscore at the end is the usual convention to avoid shadowing
> built-ins). Or "open_value" or any other appropriate name.
>
This is why every good programmer keeps a thesaurus handy. I just now
had a "concept collision" on the word 'cancel', and did a quick search
to come up with 'annul' as an alternative. Although in this case I
didn't search my thesaurus, I actually looked for Magic: The Gathering
cards... yeah, I'm a nerd, aren't you? :)
There's lots of synonyms for open, and it's entirely possible that one
will work. Otherwise, Steven's other solution works just fine too, and
you can go humorous with that too:
sesame = open
open = "something"
file = sesame("filename", "r")
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
strang thing: "守株待兔" <1248283536@qq.com> - 2011-09-06 16:18 +0800
Re: strang thing: Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-13 13:28 +1000
Re: strang thing: Chris Angelico <rosuav@gmail.com> - 2011-09-13 13:42 +1000
csiph-web