How to use os.access()??

Thomas Wouters thomas at xs4all.net
Sun Jul 15 11:02:07 EDT 2001


On Sat, Jul 14, 2001 at 12:52:20AM -0400, Peter Hansen wrote:

> >>> from os import *

"*bweep* *bweep* danger, Will Robinson!" And I didn't even like that movie :)

> >>> F_OK
> 0

> Unless you want to "from os import *", which is generally bad form,

In this case, it's not just bad form, it's disastrous! Do not import * from
os, unless you *really* *really* *really* know what you are doing. If you
don't understand why 'from os import *' is a bad idea, try this:

>>> from os import *

>>> f = open("spam")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: function requires at least 2 arguments; 1 given

>>> f = open("spam", "w")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation

If-you-do-import-*-from-os-or-any-other-module-and-it-ends-up-biting-you-in-the-rear-hind-end-posterior-keister-tushy-derriere-you'll-go-"d'oh-I-should-have-listened-to-Thomas"-and-I'll-go-"Yes-you-should-have-because-I-told-you-so-darnit!"-and-you'll-never-live-off-the-shame-ly y'rs,

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list