What are your opinions on .NET Core vs Python?

2017-01-28 Thread Juan C.
As you guys might know, .NET Core is up and running, promising a "cross-platform, unified, fast, lightweight, modern and open source experience" (source: .NET Core official site). What do you guys think about it? Do you think it will be able to compete with and overcome Python in the opensource med

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Grant Edwards
On 2017-01-28, Marko Rauhamaa wrote: > (Although if I were to design an operating system, I don't know if I > would bother with controlling terminals, job control or chirping > modems.) I've been using serial ports on Unix for 35 years, and maintaining serial drivers for Linux for almost 20. Man

Re: How coding in Python is bad for you

2017-01-28 Thread pavlovevidence
On Monday, January 23, 2017 at 9:24:56 AM UTC-8, bream...@gmail.com wrote: > The article is here http://lenkaspace.net/index.php/blog/show/111 > > Kindest regards. > > Mark Lawrence. I remember the old days of Python when it was just Perl's little brother. Sometimes I feel moments of amazement

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Jan 29, 2017 at 7:04 AM, eryk sun wrote: >> Now let's get rid of the terminal via setsid: >> >>$ echo spam | >> > 2>&1 setsid python3 -c 'import os >> > fd = os.open("/dev/tty", os.O_RDONLY) >> > print(os.get_terminal_size(fd))' | >> > cat >> Tra

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Chris Angelico
On Sun, Jan 29, 2017 at 7:04 AM, eryk sun wrote: > Now let's get rid of the terminal via setsid: > >$ echo spam | > > 2>&1 setsid python3 -c 'import os > > fd = os.open("/dev/tty", os.O_RDONLY) > > print(os.get_terminal_size(fd))' | > > cat > Traceback (most recent call las

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread eryk sun
On Sat, Jan 28, 2017 at 5:58 PM, Chris Angelico wrote: > Processes in the middle of pipelines *do not have* terminals. No, in the following case stderr is a terminal: $ echo spam | > python3 -c 'import os > print(os.get_terminal_size(2))' | > cat os.terminal_size(columns=132,

Re: Is Python SSL API thread-safe?

2017-01-28 Thread Grant Edwards
On 2017-01-22, Christian Heimes wrote: > OpenSSL and Python's ssl module are thread-safe. However IO is not > safe concerning reentrancy. You cannot safely share a SSLSocket > between threads without a mutex. Certain aspects of the TLS protocol > can cause interesting side effects. A recv() call

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Marko Rauhamaa
Chris Angelico : > Background processes don't have terminal access. Whether it's a daemon > or something started as "commandname >/dev/null 2>/dev/null &" from bash, it doesn't have access to a terminal. A nitpick: a process running in the background or a process with no open terminal file descri

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Chris Angelico
On Sun, Jan 29, 2017 at 3:15 AM, Steve D'Aprano wrote: > On Sat, 28 Jan 2017 10:50 pm, Chris Angelico wrote: > >> On Sat, Jan 28, 2017 at 9:49 PM, Steve D'Aprano >> wrote: >>> The terminal size doesn't change just because I'm piping output to >>> another process. Using the terminal size as a prox

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Grant Edwards
On 2017-01-28, Steve D'Aprano wrote: > On Sat, 28 Jan 2017 10:50 pm, Chris Angelico wrote: > >> On Sat, Jan 28, 2017 at 9:49 PM, Steve D'Aprano >> wrote: >>> The terminal size doesn't change just because I'm piping output to >>> another process. Using the terminal size as a proxy for "being piped

Reviews of book on introductory Python (was: Need reviews for my book on introductory python)

2017-01-28 Thread Thomas 'PointedEars' Lahn
mm0fmf wrote: > […] Python, the name of the language, is a proper noun and should be > captialised. In the few pages I read, Python appears as "python" and > "Python", randomly losing the capital letter. Lacking capitalisation > would suggest to me that some or all words are consistently written >

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Michael Torrie
On 01/28/2017 09:15 AM, Steve D'Aprano wrote: > Then explain why os.get_terminal_size() returns the correct answer. Basically you were asking two different questions there. shutil.get_terminal_size always asks the question of size of the terminal that the standard output file handle is connected t

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Michael Torrie
On 01/28/2017 09:15 AM, Steve D'Aprano wrote: > Then get_terminal_size() should raise, unless you explicitly ask for a > default size. Which it does if you call it on the standard out file handle, which is the default, and for most applications, the most useful. -- https://mail.python.org/mailm

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Michael Torrie
On 01/28/2017 09:03 AM, Michael Torrie wrote: > On 01/28/2017 04:00 AM, Steve D'Aprano wrote: >>> $ COLUMNS=123 python3 test_gts.py | cat >>> shutil: os.terminal_size(columns=123, lines=999) >>> os: os.terminal_size(columns=72, lines=48) > > Interesting. On my machine with Python 3.4, calling > os

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Steve D'Aprano
On Sat, 28 Jan 2017 10:50 pm, Chris Angelico wrote: > On Sat, Jan 28, 2017 at 9:49 PM, Steve D'Aprano > wrote: >> The terminal size doesn't change just because I'm piping output to >> another process. Using the terminal size as a proxy for "being piped" is >> sheer insanity. > > In a sense, ther

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Michael Torrie
On 01/28/2017 04:00 AM, Steve D'Aprano wrote: >> $ COLUMNS=123 python3 test_gts.py | cat >> shutil: os.terminal_size(columns=123, lines=999) >> os: os.terminal_size(columns=72, lines=48) Interesting. On my machine with Python 3.4, calling os.get_terminal_size() and piping the output results in the

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Grant Edwards
On 2017-01-28, Steve D'Aprano wrote: > Right: I want to know what the terminal window is sized to. What do you mean by "the terminal"? Do you mean the device to which the program's output is connected? Since output is what you have control over, and what's width you might want to change, that's

Update to Python 3 Cheat Sheet

2017-01-28 Thread Laurent Pointal
Hi, I updated the cheat sheet on the aesthetic side. Parts bloc and their title are now more easily identified with colors (but its nice with B&W printing too). French and german versions have also been updated. See https://perso.limsi.fr/pointal/python:memento A+ L.Pointal. -- https://mail.p

Re: GUI

2017-01-28 Thread Peter Otten
hany.amin.mishr...@gmail.com wrote: > hay , i am new in the coding world,i would like to understand how a python > program is communicating with GUI, for example, if i have a code that > require the user to enter a value ,then this code will do some > calculations and return a value to the user, h

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Peter Otten
Steve D'Aprano wrote: >> One potential advantage of shutil.get_terminal_size() is that you can >> affect it with an environment variable: >> >> $ python3 test_gts.py | cat >> shutil: os.terminal_size(columns=999, lines=999) >> os: os.terminal_size(columns=72, lines=48) >> >> $ COLUMNS=123 python3

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread eryk sun
On Sat, Jan 28, 2017 at 8:03 AM, Steve D'Aprano wrote: > print('shutil:', shutil.get_terminal_size(fallback=(999, 999))) > print('os:', os.get_terminal_size(0)) [snip] > But if I pipe the output to something else, the shutil version fails to > determine the correct terminal size, and falls back on

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Chris Angelico
On Sat, Jan 28, 2017 at 9:49 PM, Steve D'Aprano wrote: > The terminal size doesn't change just because I'm piping output to another > process. Using the terminal size as a proxy for "being piped" is sheer > insanity. In a sense, there _is no_ terminal size when you're being piped to another proce

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Steve D'Aprano
On Sat, 28 Jan 2017 07:39 pm, Peter Otten wrote: > One potential advantage of shutil.get_terminal_size() is that you can > affect it with an environment variable: > > $ python3 test_gts.py | cat > shutil: os.terminal_size(columns=999, lines=999) > os: os.terminal_size(columns=72, lines=48) > > $

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Steve D'Aprano
On Sat, 28 Jan 2017 07:27 pm, Chris Angelico wrote: > On Sat, Jan 28, 2017 at 7:03 PM, Steve D'Aprano > wrote: >> But if I pipe the output to something else, the shutil version fails to >> determine the correct terminal size, and falls back on the default: >> >> >> [steve@ando ~]$ python3.5 test_

GUI

2017-01-28 Thread hany . amin . mishriky
hay , i am new in the coding world,i would like to understand how a python program is communicating with GUI, for example, if i have a code that require the user to enter a value ,then this code will do some calculations and return a value to the user, how to do that? -- https://mail.python.org

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Peter Otten
Steve D'Aprano wrote: > shutil.get_terminal_size returns the wrong values when you pipe your > output to another process, even it you do so in a terminal. Consider this > script: > > > import os > import shutil > print('shutil:', shutil.get_terminal_size(fallback=(999, 999))) > print('os:', os.g

Re: Is shutil.get_terminal_size useless?

2017-01-28 Thread Chris Angelico
On Sat, Jan 28, 2017 at 7:03 PM, Steve D'Aprano wrote: > But if I pipe the output to something else, the shutil version fails to > determine the correct terminal size, and falls back on the default: > > > [steve@ando ~]$ python3.5 test_gts.py | cat > shutil: os.terminal_size(columns=999, lines=999

Is shutil.get_terminal_size useless?

2017-01-28 Thread Steve D'Aprano
shutil.get_terminal_size returns the wrong values when you pipe your output to another process, even it you do so in a terminal. Consider this script: import os import shutil print('shutil:', shutil.get_terminal_size(fallback=(999, 999))) print('os:', os.get_terminal_size(0)) That uses two diff

Re: Need reviews for my book on introductory python

2017-01-28 Thread mm0fmf
On 27/01/2017 21:36, MRAB wrote: On 2017-01-27 21:18, mm0fmf wrote: On 27/01/2017 20:17, bob gailer wrote: On 1/25/2017 9:25 PM, Sandeep Nagar wrote: Hi, A few month ago I wrote a book on introductory python based on my experinces while teaching python to Bachelor students of engineering. It