os.path.join

half.italian at gmail.com half.italian at gmail.com
Wed May 2 03:03:56 EDT 2007


On May 1, 11:10 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Wed, 02 May 2007 02:31:43 -0300, <half.ital... at gmail.com> escribió:
>
> > A better question is why this doesn't work.
>
> >>>> pathparts = ["/foo", "bar"]
> >>>> os.path.join(pathparts)
> > ['/foo', 'bar']
>
> > This should return a string in my opinion.
>
> I think it's a bug, but because it should raise TypeError instead.
> The right usage is os.path.join(*pathparts)
>
> --
> Gabriel Genellina

Wow.  What exactly is that * operator doing?  Is it only used in
passing args to functions?  Does it just expand the list into
individual string arguments for exactly this situation?  Or does it
have other uses?

~Sean




More information about the Python-list mailing list