Live data from Hacker News

Python 3.4 Beta 1 Released

python.org

1–10 of 29 posts

Re: Python 3.4 Beta 1 Released

#3

Wow, I haven't heard of pathlib [1] before now, but it looks awesome! In particular, using the slash operator to join paths is brilliant. >>> p = PurePath('/etc') >>> p / 'init.d' / 'apache2' PurePosixPath('/etc/init.d/apache2') [1]: http://docs.python.org/3.4/library/pathlib.html

FWIW, the boost::filesystem C++ package uses the / operator in the same way

Re: Python 3.4 Beta 1 Released

#4

Wow, I haven't heard of pathlib [1] before now, but it looks awesome! In particular, using the slash operator to join paths is brilliant. >>> p = PurePath('/etc') >>> p / 'init.d' / 'apache2' PurePosixPath('/etc/init.d/apache2') [1]: http://docs.python.org/3.4/library/pathlib.html

Scala does something similarly neat with using #| for piping system commands.

Slash for Scala is not used by default though for path joining, but it can be by adding an implicit function:

  implicit def slash(str: String) = new { def /(joinStr: String) = str + java.io.File.separatorChar + joinStr} 

  val joinedStr = "abc"/"def"/"ghi"
  > joinedStr : java.lang.String = abc/def/ghi
Shell friendly syntax can be used for stdin/stdout in Scala as well (already in the stdlib with no implicits required):

##> 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-...

Re: Python 3.4 Beta 1 Released

#5

Wow, I haven't heard of pathlib [1] before now, but it looks awesome! In particular, using the slash operator to join paths is brilliant. >>> p = PurePath('/etc') >>> p / 'init.d' / 'apache2' PurePosixPath('/etc/init.d/apache2') [1]: http://docs.python.org/3.4/library/pathlib.html

One of the many things I like about Python is their pragmatic approach to operator overloading. Well, their pragmatic approach to everything, really.

Re: Python 3.4 Beta 1 Released

#6
post #4

Wow, I haven't heard of pathlib [1] before now, but it looks awesome! In particular, using the slash operator to join paths is brilliant. >>> p = PurePath('/etc') >>> p / 'init.d' / 'apache2' PurePosixPath('/etc/init.d/apache2') [1]: http://docs.python.org/3.4/library/pathlib.html

Scala does something similarly neat with using #| for piping system commands. Slash for Scala is not used by default though for path joining, but it can be by adding an implicit function: implicit def slash(str: String) = new { def /(joinStr: String) = str + java.io.File.separatorChar + joinStr} val joinedStr = "abc"/"def"/"ghi" > joinedStr : java.lang.String = abc/def/ghi Shell friendly syntax can be used for stdin/…

There are Plumbum shell combinators in Python http://plumbum.readthedocs.org/en/latest/

Re: Python 3.4 Beta 1 Released

#8

Wow, I haven't heard of pathlib [1] before now, but it looks awesome! In particular, using the slash operator to join paths is brilliant. >>> p = PurePath('/etc') >>> p / 'init.d' / 'apache2' PurePosixPath('/etc/init.d/apache2') [1]: http://docs.python.org/3.4/library/pathlib.html

No one objected to using "pure" instead of the more common "abstract" (which is the actual antonym of "concrete") ?? Why do people do this?

Re: Python 3.4 Beta 1 Released

#9
post #6
post #4

Earlier quoted context omitted.

Scala does something similarly neat with using #| for piping system commands. Slash for Scala is not used by default though for path joining, but it can be by adding an implicit function: implicit def slash(str: String) = new { def /(joinStr: String) = str + java.io.File.separatorChar + joinStr} val joinedStr = "abc"/"def"/"ghi" > joinedStr : java.lang.String = abc/def/ghi Shell friendly syntax can be used for stdin/…

There are Plumbum shell combinators in Python http://plumbum.readthedocs.org/en/latest/

There are a couple of modules that do this kind of thing but Plumbum looks interesting, particularly

http://plumbum.readthedocs.org/en/latest/local_commands.html...

>from plumbum.cmd import cat

>>cat('tmp.txt') #invokes cat tmp.txt on the system

Re: Python 3.4 Beta 1 Released

#10
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.

Post reply on HN