[Patches] [ python-Patches-1440928 ] Inconsistency in os' function naming

SourceForge.net noreply at sourceforge.net
Fri Mar 3 02:18:12 CET 2006


Patches item #1440928, was opened at 2006-03-01 07:29
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1440928&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Frederik 'Freso' S. Olesen (freso)
Assigned to: Nobody/Anonymous (nobody)
Summary: Inconsistency in os' function naming

Initial Comment:
The os module uses get/set for pretty much everything,
except for env, where it uses get/put. It still uses
un_set_env though.
This patch makes a newfunction setenv if putenv is
available, and makes setenv(key, value) call
putenv(key, value). I wasn't sure whether to use
default values (key=None, value=None) or not, but I
ended up doing so anyway.

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2006-03-02 20:18

Message:
Logged In: YES 
user_id=6380

-1.

"We already got one."

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2006-03-02 18:25

Message:
Logged In: YES 
user_id=38376

(and yes, unsetenv is named that way because the underlying
Unix function is called unsetenv().  like setenv(), this
isn't a POSIX function, and is not available on all platforms).

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2006-03-02 18:21

Message:
Logged In: YES 
user_id=38376

the os module generally uses the same name as the underlying
POSIX API.  in this case, os.putenv maps to POSIX putenv(3)
and os.getenv maps to POSIX getenv(3).

there is a setenv() function available on some platforms,
which is more like:

  def setenv(key, value, overwrite):
    if not getenv(key) or overwrite:
      putenv(key, value)

(why are you using these functions anyway?  use the environ
dictionary, already!)

----------------------------------------------------------------------

Comment By: Frederik 'Freso' S. Olesen (freso)
Date: 2006-03-01 07:42

Message:
Logged In: YES 
user_id=287697

And apparently you can't upload/attach a file *and* delete
another one at the same time... ? (Or perhaps it's simple
due to the fact they were both of the same name... ?)

----------------------------------------------------------------------

Comment By: Frederik 'Freso' S. Olesen (freso)
Date: 2006-03-01 07:40

Message:
Logged In: YES 
user_id=287697

And I just realised that the __doc__ was far too wide and
that both arguments to putenv are required, and thus they
should be required be setenv as well.

Pray let me know if there is anything I can do to better the
patch.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1440928&group_id=5470


More information about the Patches mailing list