This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Inconsistency in os' function naming
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: effbot, freso, gvanrossum
Priority: normal Keywords: patch

Created on 2006-03-01 12:29 by freso, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
setenv.diff freso, 2006-03-01 12:42
Messages (6)
msg49619 - (view) Author: Frederik 'Freso' S. Olesen (freso) Date: 2006-03-01 12:29
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.
msg49620 - (view) Author: Frederik 'Freso' S. Olesen (freso) Date: 2006-03-01 12:40
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.
msg49621 - (view) Author: Frederik 'Freso' S. Olesen (freso) Date: 2006-03-01 12:42
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... ?)
msg49622 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2006-03-02 23:21
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!)
msg49623 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2006-03-02 23:25
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).
msg49624 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2006-03-03 01:18
Logged In: YES 
user_id=6380

-1.

"We already got one."
History
Date User Action Args
2022-04-11 14:56:15adminsetgithub: 42959
2006-03-01 12:29:44fresocreate