New submission from Rémi Lapeyre <remi.lape...@henki.fr>:

The documentation states that "*key*, *default* and the result are str." at 
https://github.com/python/cpython/blame/3.8/Doc/library/os.rst#L224 but either 
I'm missing something or it's not actually true:

$ python -c 'import os; print(type(os.getenv("FOO")))'           
<class 'NoneType'>
$ python -c 'import os; print(type(os.getenv("FOO", default=1)))'
<class 'int'>

Only *key* needs to be a string as it is used to lookup the value in os.environ.

I think this can be fixed by a new contributor

----------
assignee: docs@python
components: Documentation
messages: 362689
nosy: docs@python, remi.lapeyre
priority: normal
severity: normal
status: open
title: os.getenv documentation is misleading
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39759>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to