I hadn't heard of it either, although I have played with Twisted's FilePath[1] class previously.
I didn't really understand the attraction of an OO filesystem API until I actually used it in anger and realised how handy it was that all the relevant functions were on the object I was messing with, instead of arbitrarily divided between the "os" and "os.path" modules.
Some (hopefully constructive) suggestions for the pathlib API:
- Python 3 dicts ditched .iterkeys(), .itervalues() and .iteritems(); why does pathlib use the clumsy .iterdir() when it could just be called .children?
- Like many Python programmers (I assume), I'm more familiar with POSIX command-line tools than I am with POSIX APIs. Command-line tools generally have an option to control whether they dereference symlinks (cp -L, find -L, etc) rather than having a separate. parallel tool that does the same thing. I think it would be neater if .lstat() and .lchmod() were removed in favour of a "follow_symlinks" parameter to .stat() and .chmod() (and .is_dir() and .touch() and .owner(), and, and, and..)
- If you're going to have convenience functions that pick out interesting bits from the .stat() return value, I would find .size() far more practical than .is_socket()
I thought operator overloading like that was considered bad practise. It seems to me that the + operator should have been overloaded, not the / operator.
Been using python for 7+ years now. Does everyone really think people are willing to adopt 3.x anything...? The reality of it is every place I have worked (and currently working at). Is bound by 3rd party tools and what ever interpreter they built against. Mostly that 2.6,2.7 right now. And it does not look like anyone will be switching anytime soon.
Features look great, cant wait to "play" with them. But that;s about all. Play.
I certainly can't speak to big enterprise companies, but we've used Py3 in production at the last 2 startups I've worked at, and I use it extensively in my own side projects.
I certainly understand it can be somewhat tedious to convert legacy projects -- I've had to do it a few times myself -- but for any new dev, I'd highly recommend using Python3.
It's come to the point that Python3 is the assumed default for any new project - If someone wants to use Py2 for a project, they better have a compelling reason.. Almost every library we'd want uses Py3, or there's an alternative that does (such as PIL->Pillow).
I find it rather annoying when I go back to a Python2 project and have to constantly jump through hoops to avoid what I know are solved problems :/
Admittedly, my experiences (like yours) are anecdotal - But to answer your question, from what I've seen, Python3 is used in production quite a bit.
Everyone is aware of this reality. Everyone was aware of this reality when the transition was planned. It's been years now and we're still maybe halfway through the transition and that's ok.
I've done some internal work written entirely in Python 3.3. We largely did it as a "proof of concept" to try out the new language. And yeah, we did indeed have dependencies. No complaints.
Going back to 2 is kind of a bummer when you add up all the little niceties you get with 3(.3): unicode native strings, smarter import system, yield from, keyword-only arguments... at least those were the features I used. It has some other stuff that I never got around to touching.
I don't understand why you are being downvoted for your data-point. I've not seen 3.x used anywhere in anger either. But I've seen plenty of people embarking on new 2.7 projects. That's just my data-point too.
Well, some people are bound to already installed interpreters. And those come with Linux distros. Many of which will be using Python 3 as the default for their 2014 releases (Fedora, Ubuntu, Arch). Plus these distributions are helping/pushing 3rd party Python developers to port to Python 3.
I'm feeling optimistic about Python 3. For personal and work projects I've been writing 3-compatible code, and am hoping to have a production system using it by the end of the month.
I think everyone is expecting a really long tail to the transition, but we'll get there eventually.
Mostly interested by Python3 because of asyncio (formely tulip). Trying to beat nodejs at its own game. I'm waiting for PyPy Python3 compatible to be released to do some comparisons. Anyway PyPy seems to already beat nodejs, Python 3 will just make working with async code easier.
"Debug tool for Python injecting memory allocation faults to simulate a low memory system to test how your application handles MemoryError exceptions."
The most exciting feature in 3.4 (at least in my opinion) is the addition of asyncio to the standard library, which aims to provide a standard event loop which libraries like Twisted can then use to make themselves interoperable with other async Python solutions:
"The event loop is the place where most interoperability occurs. It should be easy for (Python 3.3 ports of) frameworks like Twisted, Tornado, or even gevents to either adapt the default event loop implementation to their needs using a lightweight adapter or proxy, or to replace the default event loop implementation with an adaptation of their own event loop implementation. (Some frameworks, like Twisted, have multiple event loop implementations. This should not be a problem since these all have the same interface.)"
[+] [-] taylorfausak|12 years ago|reply
[+] [-] yareally|12 years ago|reply
Slash for Scala is not used by default though for path joining, but it can be by adding an implicit function:
Shell friendly syntax can be used for stdin/stdout in Scala as well (already in the stdlib with no implicits required):#< Redirect STDIN
#> Redirect STDOUT
#>> Append to STDOUT
#&& Create an AND list
#!! Create an OR list
http://stackoverflow.com/questions/12772605/scala-shell-comm...
http://alvinalexander.com/scala/scala-execute-exec-external-...
[+] [-] thristian|12 years ago|reply
I didn't really understand the attraction of an OO filesystem API until I actually used it in anger and realised how handy it was that all the relevant functions were on the object I was messing with, instead of arbitrarily divided between the "os" and "os.path" modules.
Some (hopefully constructive) suggestions for the pathlib API:
- Python 3 dicts ditched .iterkeys(), .itervalues() and .iteritems(); why does pathlib use the clumsy .iterdir() when it could just be called .children?
- Like many Python programmers (I assume), I'm more familiar with POSIX command-line tools than I am with POSIX APIs. Command-line tools generally have an option to control whether they dereference symlinks (cp -L, find -L, etc) rather than having a separate. parallel tool that does the same thing. I think it would be neater if .lstat() and .lchmod() were removed in favour of a "follow_symlinks" parameter to .stat() and .chmod() (and .is_dir() and .touch() and .owner(), and, and, and..)
- If you're going to have convenience functions that pick out interesting bits from the .stat() return value, I would find .size() far more practical than .is_socket()
[1]: http://twistedmatrix.com/documents/current/api/twisted.pytho...
[+] [-] yen223|12 years ago|reply
[+] [-] bodyfour|12 years ago|reply
[+] [-] avdd_|12 years ago|reply
[+] [-] reinhardt|12 years ago|reply
[1] https://pypi.python.org/pypi/path.py/1.2
[+] [-] Flimm|12 years ago|reply
[+] [-] computerhead|12 years ago|reply
Features look great, cant wait to "play" with them. But that;s about all. Play.
[+] [-] e1ven|12 years ago|reply
I certainly understand it can be somewhat tedious to convert legacy projects -- I've had to do it a few times myself -- but for any new dev, I'd highly recommend using Python3.
It's come to the point that Python3 is the assumed default for any new project - If someone wants to use Py2 for a project, they better have a compelling reason.. Almost every library we'd want uses Py3, or there's an alternative that does (such as PIL->Pillow).
I find it rather annoying when I go back to a Python2 project and have to constantly jump through hoops to avoid what I know are solved problems :/
Admittedly, my experiences (like yours) are anecdotal - But to answer your question, from what I've seen, Python3 is used in production quite a bit.
[+] [-] MBlume|12 years ago|reply
[+] [-] spamizbad|12 years ago|reply
Going back to 2 is kind of a bummer when you add up all the little niceties you get with 3(.3): unicode native strings, smarter import system, yield from, keyword-only arguments... at least those were the features I used. It has some other stuff that I never got around to touching.
[+] [-] willvarfar|12 years ago|reply
[+] [-] oblio|12 years ago|reply
So 2014 really looks like Python 3 mass adoption.
[+] [-] bcj|12 years ago|reply
I think everyone is expecting a really long tail to the transition, but we'll get there eventually.
[+] [-] amirouche|12 years ago|reply
[+] [-] makmanalp|12 years ago|reply
Wow. This'll lead to some interesting hacks, I think.
[+] [-] amirouche|12 years ago|reply
[+] [-] haypo|12 years ago|reply
"Debug tool for Python injecting memory allocation faults to simulate a low memory system to test how your application handles MemoryError exceptions."
[+] [-] the1|12 years ago|reply
[+] [-] simonw|12 years ago|reply
http://www.python.org/dev/peps/pep-3156/
"The event loop is the place where most interoperability occurs. It should be easy for (Python 3.3 ports of) frameworks like Twisted, Tornado, or even gevents to either adapt the default event loop implementation to their needs using a lightweight adapter or proxy, or to replace the default event loop implementation with an adaptation of their own event loop implementation. (Some frameworks, like Twisted, have multiple event loop implementations. This should not be a problem since these all have the same interface.)"