Re: "." and ".." returned by dir()
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Aug 31, 2006
- 623 views
Juergen Luethje wrote: > > Julio C. Galaret Viera wrote: > > > Juergen Luethje wrote: > > > > > > Hello Rob and all, > > > > > > in the documentation of dir() it reads: > > > <quote> > > > If st names a *directory* you may have entries for "." and ".." > > > </quote> > > > > > > After my experience, those entries are normally at the _beginning_ > > > of the list which is returned by dir(). Can I rely on the assumption > > > that this is _always_ the case? > > > > > > Regards, > > > Juergen > > > > I suppose you can since the single dot refers to the directory itself and > > the > > two dots refer to its parent directory (i.e., the directory that contains > > it). > > Yes, that is the meaning of those entries. But does their meaning tell us > anything about the order, in which they are returned by dir()? > > Regards, > Juergen If Craig is not altering the output order... yes. The directory will refer to itself first and only then to the files contained in it. JG