Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63606 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-01-10 02:24 +1100 |
| Last post | 2014-01-10 02:24 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: argparse action on default values Chris Angelico <rosuav@gmail.com> - 2014-01-10 02:24 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-01-10 02:24 +1100 |
| Subject | Re: argparse action on default values |
| Message-ID | <mailman.5263.1389281054.18130.python-list@python.org> |
On Thu, Jan 9, 2014 at 5:20 AM, Florian Lindner <mailinglists@xgm.de> wrote:
> def norm_path(*parts):
> """ Returns the normalized, absolute, expanded and joined path, assembled of all parts. """
> parts = [ str(p) for p in parts ]
> return os.path.abspath(os.path.expanduser(os.path.join(*parts)))
Apologies for responding to something that's not the point of your
post, but I see this as a job for map, rather than a list comp:
def norm_path(*parts):
""" Returns the normalized, absolute, expanded and joined path,
assembled of all parts. """
path = os.path.join(*map(str,parts))
return os.path.abspath(os.path.expanduser(path))
(or completely onelinered, since you don't seem to mind longish lines).
ChrisA
Back to top | Article view | comp.lang.python
csiph-web