Live data from Hacker News

Pythonpy – Command-line Kung Fu with Python

github.com

11–20 of 40 posts

Re: Pythonpy – Command-line Kung Fu with Python

#11
I had used a very similar one for a while https://github.com/ksamuel/Pyped and found it quite useful. In that other utility they mention "'py' has been renamed to 'pyp' to avoid conflict with the new tool in the Python stdlib named 'py'" I wonder if such a problem would arise for your project.

Re: Pythonpy – Command-line Kung Fu with Python

#12
post #11

I had used a very similar one for a while https://github.com/ksamuel/Pyped and found it quite useful. In that other utility they mention "'py' has been renamed to 'pyp' to avoid conflict with the new tool in the Python stdlib named 'py'" I wonder if such a problem would arise for your project.

[deleted]

Re: Pythonpy – Command-line Kung Fu with Python

#14
Very nice.

However, division behavior was unexpected in Python 2. It looks like it imports division from __future__ without asking.

  python -V
  Python 2.7.8
  
  python -c 'print(4 / 3)'
  1
  
  In [1]: 4 / 3
  Out[1]: 1
  
  py '4 / 3'
  1.33333333333
EDIT: Yes, it does do that import, and others from __future__.

Unless these imports are essential to the operation of pythonpy, I suggest making these optional/configurable, and default to Python 2 defaults, i.e. don't import.

Re: Pythonpy – Command-line Kung Fu with Python

#16
post #14

Very nice. However, division behavior was unexpected in Python 2. It looks like it imports division from __future__ without asking. python -V Python 2.7.8 python -c 'print(4 / 3)' 1 In [1]: 4 / 3 Out[1]: 1 py '4 / 3' 1.33333333333 EDIT: Yes, it does do that import, and others from __future__. Unless these imports are essential to the operation of pythonpy, I suggest making these optional/configurable, and default to…

OK, someone downvoted this. That's OK, but can you say why you think it's good for the default in Python 2 to not act like Python 2?

Re: Pythonpy – Command-line Kung Fu with Python

#17
post #16
post #14

Very nice. However, division behavior was unexpected in Python 2. It looks like it imports division from __future__ without asking. python -V Python 2.7.8 python -c 'print(4 / 3)' 1 In [1]: 4 / 3 Out[1]: 1 py '4 / 3' 1.33333333333 EDIT: Yes, it does do that import, and others from __future__. Unless these imports are essential to the operation of pythonpy, I suggest making these optional/configurable, and default to…

OK, someone downvoted this. That's OK, but can you say why you think it's good for the default in Python 2 to not act like Python 2?

It wasn't me, but I can understand that for sharing scripts this should be quite useful. Also, I think the Python 3 division is way more logical (like most things in Python 3) and the old division is only one / more away. (// is integer division)

Also in a shared code base where you use division this is almost always necessary, or at least easier.

Re: Pythonpy – Command-line Kung Fu with Python

#18
post #11

I had used a very similar one for a while https://github.com/ksamuel/Pyped and found it quite useful. In that other utility they mention "'py' has been renamed to 'pyp' to avoid conflict with the new tool in the Python stdlib named 'py'" I wonder if such a problem would arise for your project.

Yes, the name is controversial. But it's also highly functional. I do recommend that you try out pythonpy even though you have already tried one of the other similar tools. I think you'll find it to be simpler, without losing much in terms of functionality. Also, the others haven't implemented ipython style tab completion from the command line.

Re: Pythonpy – Command-line Kung Fu with Python

#20
post #15
post #2

Python 2 :(

why sad face? I have written thousands of lines of python and and never once wanted to go to 3.

You could certainly make an argument that people who are just starting to learn Python should learn Python 3 instead of 2 no? And that being the case, it'd be nice if they could just use what they are used to instead of having to learn all the changes on top of the language itself
Post reply on HN