Python vs Julia Observations
medium.com
Python vs Julia Observations
1–10 of 10 posts
Re: Python vs Julia Observations
#2> I have to know empty collections in python are false: ... That fits poorly Zen of Python:
I disagree. I found that code to be completely Pythonic.
> In Julia you can write e.g.: joinpath(homedir(), "bar", "foo") ; But there is no such natural extension in python
It's in Python 3.5:
>>> from pathlib import Path
>>> Path.home()
PosixPath('/Users/dalke')
>>> Path.home().joinpath("bar", "foo")
PosixPath('/Users/dalke/bar/foo')
Yes, I quite dislike the location of "shutil.rmtree".The author writes "I can run call command but that will not print result to console." The subprocess.call() prints its results to my console, so I don't know what is going on.
Re: Python vs Julia Observations
#3> See how when you assign to a variable you don’t get to see the result.
Yes. Because assignment doesn't return any value in Python.
> Instead I have to know empty collections in python are false
No. There's always `len(collection) == 0` available.
> import os / Python had no idea what os was.
That's just some mistake the author made. Importing modules works just fine and in many style guides it's preferred over importing specific functions/classes.
> Instead we have to look at an entirely different module named shutil with the function rmtree.
This is exactly because of being explicit, like the author wanted Python to be a few lines above. The `os` module maps pretty much exactly onto basic OS operations. There's no rmtree, because it's not a basic mapping. It's a complex procedure, so it's somewhere else (with other complex functions).
> Shell commands like cat are in my fingertips for such things.
This is not a feature of bpython as far as I understand. It's a feature of ipython though. Just choose your repl.
> I run it like this: run(`codesign --verify $app`)
Whatever the language, this is a bad way to run external applications. What if the `$app` contains spaces? Or hyphens? Or semicolons? Again, author approved of the explicit approach in the same article, so they should just pass an array of command and arguments instead.
> In contrast Python distinguishes the two with: ["codesign", "--verify", app] "codesign --verify {}".format(app)
They're different things, and that's a good thing. If you want to print out a list as if it was a single command, you can do `' '.join(the_list)`, but without proper escaping, it's not always going to be correct.
> Here are some examples of what I do in Julia which does not require extensive libraries:
And I call BS at this point. If the author can do "Modifying and resigning iOS apps." in Julia without extensive libraries, they should show that. Calling an external command does not count.
Re: Python vs Julia Observations
#4Re: Python vs Julia Observations
#5[1] http://blog.jupyter.org/2016/07/08/ipython-5-0-released/
Re: Python vs Julia Observations
#6Re: Python vs Julia Observations
#7Many of the points are based on personal taste. But others are just wrong / misunderstood. Specifically: > See how when you assign to a variable you don’t get to see the result. Yes. Because assignment doesn't return any value in Python. > Instead I have to know empty collections in python are false No. There's always `len(collection) == 0` available. > import os / Python had no idea what os was. That's just some mis…
The author writes "Whether dealing with string literals or back-ticks for expressing a command line, you can refer to a variable foo as $foo and it will be escaped properly."
http://docs.julialang.org/en/release-0.4/manual/running-exte... confirms that `` has special escaping rules designed to prevent the problems you pointed out.
> Or hyphens?
The interpretation of hyphens depends on the program being called, not the shell. There is no automated way to escape them.
I agree with everything else you wrote.
Re: Python vs Julia Observations
#8As someone using (and loving) both Python and Julia, I found the title overpromises and the content underdelivers. More accurate header would be "Personal take on REPL/shell interactions in bpython and Julia".
Re: Python vs Julia Observations
#9Many of the points are based on personal taste. But others are just wrong / misunderstood. Specifically: > See how when you assign to a variable you don’t get to see the result. Yes. Because assignment doesn't return any value in Python. > Instead I have to know empty collections in python are false No. There's always `len(collection) == 0` available. > import os / Python had no idea what os was. That's just some mis…
> What if the `$app` contains spaces? The author writes "Whether dealing with string literals or back-ticks for expressing a command line, you can refer to a variable foo as $foo and it will be escaped properly." http://docs.julialang.org/en/release-0.4/manual/running-exte... confirms that `` has special escaping rules designed to prevent the problems you pointed out. > Or hyphens? The interpretation of hyphens depen…
Re: Python vs Julia Observations
#10As someone using (and loving) both Python and Julia, I found the title overpromises and the content underdelivers. More accurate header would be "Personal take on REPL/shell interactions in bpython and Julia".
What is your opinion on both languages?
I'm still betting on Julia https://news.ycombinator.com/item?id=11516374 and, since I do not use it for "production", I'm not giving up https://news.ycombinator.com/item?id=11692155
That said, if it's all about speed, then Python can be, well, faster: https://news.ycombinator.com/item?id=10735840 (especially so if you need BigInt, these still suck in Julia.)
Recently, discovered Go(language). Clean design rules! https://news.ycombinator.com/item?id=4158865, (but you shouldn't take it for what it is not https://news.ycombinator.com/item?id=12330573)