Python 3.4 Beta 1 Released
python.org
Python 3.4 Beta 1 Released
1–10 of 29 posts
Re: Python 3.4 Beta 1 Released
#2 >>> p = PurePath('/etc')
>>> p / 'init.d' / 'apache2'
PurePosixPath('/etc/init.d/apache2')
[1]: http://docs.python.org/3.4/library/pathlib.htmlRe: Python 3.4 Beta 1 Released
#3Wow, 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
Re: Python 3.4 Beta 1 Released
#4Wow, 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
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
#5Wow, 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
Re: Python 3.4 Beta 1 Released
#6Wow, 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/…
Re: Python 3.4 Beta 1 Released
#7Wow. This'll lead to some interesting hacks, I think.
Re: Python 3.4 Beta 1 Released
#8Wow, 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
Re: Python 3.4 Beta 1 Released
#9Earlier 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/
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
#10Features look great, cant wait to "play" with them. But that;s about all. Play.