f python?

Xah Lee xahlee at gmail.com
Sun Apr 8 08:04:19 EDT 2012


On Apr 8, 4:34 am, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Sun, 08 Apr 2012 04:11:20 -0700, Xah Lee wrote:
>
> [...]
>
> I have read Xah Lee's post so that you don't have to.
>
> Shorter Xah Lee:
>
>     "I don't know Python very well, and rather than admit I made
>      some pretty lousy design choices in my code, I blame Python.
>      And then I cross-post about it, because I'm the most important
>      person in the Universe."
>
> When the only tool you know how to use is a hammer, everything looks like
> a nail. Instead of using regexes ("now you have two problems"), use the
> right tool: to count path components, split the path, then count the
> number of path components directly.
>
> import os
> components = os.path.split(some_path)
> print len(components)
>
> No matter what separator the OS users, os.path.split will do the right
> thing. There's no need to mess about escaping separators so you can
> hammer it with the regex module, when Python comes with the perfectly
> functional socket-wrench you actually need.

Lol. i think you tried to make fun of me too fast.

check your code.

O, was it you who made fun of my python tutorial before? i was busy,
i'll have to get back on that down the road.

 Xah



More information about the Python-list mailing list