[Python-Dev] an alternative to embedding policy in PEP 418 (was: PEP 418: Add monotonic clock)

Oleg Broytman phd at phdru.name
Thu Apr 5 18:01:48 CEST 2012


On Thu, Apr 05, 2012 at 07:22:17PM +0400, Oleg Broytman wrote:
> On Thu, Apr 05, 2012 at 11:45:06PM +0900, Stephen J. Turnbull wrote:
> > find it
> > hard to imagine use cases where "file = open(thisfile) or
> > open(thatfile)" makes sense.  Not even for the case where thisfile ==
> > 'script.pyc' and thatfile == 'script.py'.
> 
>    Counterexamples - any configuration file: a program looks for its config
> at $HOME and not finding it there looks in /etc. So
>     config = open('~/.someprogram.config') or open('/etc/someprogram/config')
> would make sense.

   A counterexample with gethostbyname - a list of proxies. It's not an
error if some or even all proxies in the list are down - one just
connect to the first that's up. So a chain like
    proxy_addr = gethostbyname(FIRST) or gethostbyname(SECOND)
would make sense.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list