[Python-ideas] os.listdir with current working directory as default

Zac Burns zac256 at gmail.com
Sat Aug 1 20:28:05 CEST 2009


Yes, I always do use the full path.

--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games



On Tue, Jun 9, 2009 at 11:25 PM, Lie Ryan<lie.1296 at gmail.com> wrote:
> Zac Burns wrote:
>>> You'd better be careful with it. The "current directory" is process-wide and so
>>> modifying it in a thread will affect all other threads in your program. I'm not
>>> saying all programs have this characteristic, but relying on the current
>>> directory rather than explicit paths isn't always a good idea...
>>
>> I agree with Antoine, but would go further to say that making it a
>> default argument is an enablement - just making it easier for people
>> to follow a bad pattern.
>>
>> This doesn't apply to all default arguments of course, just that the
>> working directory is "considered harmful" and we probably shouldn't
>> make changes that make it easier for people to use.
>
> When you open() files do you always use full path? Why don't we
> eliminate all modules and built-in function that uses relative path by
> default then? That way we will always be safe? Making open(), etc raise
> RelativePathError if using relative path.
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list