[path-PEP] Path inherits from basestring again

Tony Meyer t-meyer at ihug.co.nz
Fri Jul 29 21:26:13 EDT 2005


> We're talking at this point about how Path should work, not 
> whether it's preferable to os.path.join, even though that was
> really the point of Reinhard's original post.

That's not what I'm talking about.  I'm talking about whether __div__ should
be a shortcut to joinwith, or whether users should be forced to use joinwith
explicitly.

So far, there have been various statements that look like +0 for __div__,
but no-one with a +1.  (And I've said this a couple of times now, which
really is just trolling for a +1 from someone).

> It's not a question of saving characters, but readability which, as 
> you've said, is a matter of opinion.

(Those who are offended by sweeping generalisations should ignore this next
bit)

I think it's also worth considering that Windows users are more clueless
than users of posix systems.  The readability of __div__ comes from
familiarity with posix filesystems; for a Windows user, \ would be the
natural character.  So we're making things more readable for users that are
already more likely figure things out, and less readable for users that have
trouble figuring things out.

> I can live with the latter, but as *someone who has used the 
> path module already* I can only say that you might want to try it
> for a few months before condemning the approach using / as being
> unacceptable.

1.  ISTM that standard library modules should be as readable as possible,
even for those that don't use them.  If I'm reading the source for module X
and it uses a Path object, then it should be pretty straightforward to
understand what is happening without also having to read the Path
source/docs.  This (readability without knowing the language/standard
libraries) is a huge benefit of using Python.

2.  If I did use the Path module, then I wouldn't use __div__, because it
looks less readable to me.  I suppose I might find that I got annoyed typing
joinpath, but I doubt it.  Also, because I have followed this PEP, I know
that __div__ means joinwith, so if I read code that used path, I would
understand it - it's too late for me to try reading code as a 'fresh' user
and see if it confuses me or not.

=Tony.Meyer




More information about the Python-list mailing list