Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 4:57 PM, Marko Rauhamaa wrote: > What I'm saying is that every program must behave in a minimally > controlled manner regardless of its inputs (which are not in its > control). With UTF-8, it is dangerously easy to write programs that > explode surprisingly. What's more, re

Re: Python under PowerShell adds characters

2017-03-29 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Mar 30, 2017 at 4:43 PM, Marko Rauhamaa wrote: >> The input is not in my control, and bailing out may not be an option: >> >>$ echo >> aa\n\xdd\naa' | grep aa >>aa >>aa >>$ echo \xdd' | python2 -c 'import sys; sys.stdin.read(1)' >>$ echo \xdd' | pyth

Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 4:43 PM, Marko Rauhamaa wrote: > The input is not in my control, and bailing out may not be an option: > >$ echo > aa\n\xdd\naa' | grep aa >aa >aa >$ echo \xdd' | python2 -c 'import sys; sys.stdin.read(1)' >$ echo \xdd' | python3 -c 'import sys; sys.stdi

Re: Python under PowerShell adds characters

2017-03-29 Thread Marko Rauhamaa
Steven D'Aprano : > On Thu, 30 Mar 2017 07:29:48 +0300, Marko Rauhamaa wrote: >> I'd expect not having to deal with Unicode decoding exceptions with >> arbitrary input. > > That's just silly. If you have *arbitrary* bytes, not all > byte-sequences are valid Unicode, so you have to expect decoding

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 3:21 PM, Rick Johnson wrote: > On Sunday, March 26, 2017 at 2:53:49 PM UTC-5, Chris Angelico wrote: >> On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V wrote: >> > On 26 March 2017 at 20:10, Steve D'Aprano >> > wrote: >> >> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote: > >> I

Re: Python under PowerShell adds characters

2017-03-29 Thread Steven D'Aprano
On Thu, 30 Mar 2017 07:29:48 +0300, Marko Rauhamaa wrote: [...] > I'd expect not having to deal with Unicode > decoding exceptions with arbitrary input. That's just silly. If you have *arbitrary* bytes, not all byte-sequences are valid Unicode, so you have to expect decoding exceptions, if you'r

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-29 Thread Rick Johnson
On Sunday, March 26, 2017 at 6:42:36 PM UTC-5, Mikhail V wrote: > And all text I currently read on my monitor are prerendered > bitmaps, refined manually for frequently used sizes, and > that is how it should be made. IOW there are much more > important aspects than the ability to scale a text lin

Re: Python under PowerShell adds characters

2017-03-29 Thread Marko Rauhamaa
Steve D'Aprano : > On Thu, 30 Mar 2017 06:47 am, Marko Rauhamaa wrote: >> Huh? The standard input is the workload > > Which is usually typed by a human, read from a file containing > human-readable text, a file-name intended to be read by a human, or > some other data in human-readable form. The

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-29 Thread Rick Johnson
On Sunday, March 26, 2017 at 2:53:49 PM UTC-5, Chris Angelico wrote: > On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V wrote: > > On 26 March 2017 at 20:10, Steve D'Aprano > > wrote: > >> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote: > I generally find that when people say that Unicode doesn't > so

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-29 Thread Rick Johnson
On Sunday, March 26, 2017 at 1:21:18 PM UTC-5, Chris Angelico wrote: > On Mon, Mar 27, 2017 at 4:43 AM, Steve D'Aprano > wrote: > [...] So, for instance, Eryk Sun commented that my rounded > box example didn't render correctly in all fonts - but in > the future, a new version of those fonts could

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 2:19 PM, Rick Johnson wrote: > On Wednesday, March 29, 2017 at 8:17:01 PM UTC-5, Jan Gosmann wrote: >> On 29 Mar 2017, at 20:12, Steve D'Aprano wrote: >> >> > If you can demonstrate this effect using simple example >> > code without the external dependencies (using nothing

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-29 Thread Rick Johnson
On Wednesday, March 29, 2017 at 8:17:01 PM UTC-5, Jan Gosmann wrote: > On 29 Mar 2017, at 20:12, Steve D'Aprano wrote: > > > If you can demonstrate this effect using simple example > > code without the external dependencies (using nothing but > > the standard library) and people can replicate it,

Re: newbie question re classes and self

2017-03-29 Thread Rick Johnson
On Tuesday, March 28, 2017 at 3:09:45 AM UTC-5, loial wrote: > Can I pass self(or all its variables) to a class? > Basically, how do I make all the variables defined in self > in the calling python script available to the python class > I want to call? Your question, as presented, is difficult to

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-29 Thread Jan Gosmann
On 29 Mar 2017, at 20:12, Steve D'Aprano wrote: If you can demonstrate this effect using simple example code without the external dependencies (using nothing but the standard library) and people can replicate it, I think it should be reported as a bug. I probably won't be able to demonstrate

Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 11:14 AM, Steve D'Aprano wrote: > Just like the rest of the computation. Relatively few command-line > computations are performed by machines, for machines, using > machine-friendly human-hostile formats. And even most computations performed by machines for machines are do

Re: Python under PowerShell adds characters

2017-03-29 Thread Steve D'Aprano
On Thu, 30 Mar 2017 06:47 am, Marko Rauhamaa wrote: > Chris Angelico : >> But normally, the standard streams are connected ultimately to a >> human, so they're text. > > Huh? The standard input is the workload Which is usually typed by a human, read from a file containing human-readable text, a

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-29 Thread Steve D'Aprano
On Thu, 30 Mar 2017 07:19 am, Jan Gosmann wrote: > Running further trials indicate that the problem actually is related to > swapping. If I reduce the model size in the benchmark slightly so that > everything fits into the main memory, the problem disappears. Only when > the memory usage exceeds t

Re: K&L graph partitioning code offer

2017-03-29 Thread jladasky
On Wednesday, March 29, 2017 at 10:46:56 AM UTC-7, Michael Torrie wrote: > On 03/29/2017 11:17 AM, j...@itu.edu wrote: > > On Wednesday, March 29, 2017 at 1:23:48 AM UTC-7, arpitam...@gmail.com > > wrote: > >> Hi > >> I am planning to tweak the Kernighan Lin algorithm a bit use coercing of > >> c

Re: logging.LogRecord asctime aattribute - easily override somehow?

2017-03-29 Thread Skip Montanaro
Skip> Whoever thought you'd want to break up Skip> timestamps into two words by default, and hard-code a comma as the Skip> separator between seconds and milliseconds? Peter> In Germany the comma is the decimal separator, so this doesn't look like two Peter> words to my eye. The "two words" refer

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-29 Thread Jan Gosmann
On 28 Mar 2017, at 14:21, INADA Naoki wrote: On Wed, Mar 29, 2017 at 12:29 AM, Jan Gosmann wrote: I suppose smaller and faster benchmark is better to others looking for it. I already stopped the azure instance. [...] There are no maxrss difference in "smaller existing examples"? [...] I wan

Re: Python under PowerShell adds characters

2017-03-29 Thread eryk sun
On Wed, Mar 29, 2017 at 7:13 PM, Marko Rauhamaa wrote: > eryk sun : >> PowerShell is far more invasive. Instead of giving the child process a >> handle for the file, it gives it a handle for a *pipe*. PowerShell >> reads from the pipe, and like an annoying busybody that no asked for, >> decodes th

Re: Python under PowerShell adds characters

2017-03-29 Thread Marko Rauhamaa
Chris Angelico : > But normally, the standard streams are connected ultimately to a > human, so they're text. Huh? The standard input is the workload and the standard output is the result of the computation. Arguably, the standard error stream is meant for humans. Marko -- https://mail.python.

Re: logging.LogRecord asctime aattribute - easily override somehow?

2017-03-29 Thread Peter Otten
Skip Montanaro wrote: import logging logging.basicConfig(format="%(asctime)s" + logging.BASIC_FORMAT, datefmt="***%A***") logging.warn("foo") > ***Wednesday***WARNING:root:foo > > Thanks, Peter. I suppose a bit more detail of my environment would > have helped. I'm actually using

Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 6:13 AM, Marko Rauhamaa wrote: > eryk sun : >> PowerShell is far more invasive. Instead of giving the child process a >> handle for the file, it gives it a handle for a *pipe*. PowerShell >> reads from the pipe, and like an annoying busybody that no asked for, >> decodes th

Re: Python under PowerShell adds characters

2017-03-29 Thread Marko Rauhamaa
eryk sun : > PowerShell is far more invasive. Instead of giving the child process a > handle for the file, it gives it a handle for a *pipe*. PowerShell > reads from the pipe, and like an annoying busybody that no asked for, > decodes the output as text, You mean, a bit like Python3 does? Marko

Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 5:29 AM, Rob Gaddi wrote: > Engineer 1: Man, that old DOS shell we keep emulating is just getting older > and clunkier. > > Engineer 2: I know, we should rewrite it. You know, whole new thing, really > modernize it. > > E1: So, like, bring in bash like everyone else? > > E

Re: Python under PowerShell adds characters

2017-03-29 Thread Jay Braun
On Wednesday, March 29, 2017 at 11:20:45 AM UTC-7, eryk sun wrote: > On Wed, Mar 29, 2017 at 5:42 PM, Jay Braun wrote: > > > > I'm not using ISE. I'm using a pre-edited script, and running it with the > > python command. > > > > Consider the following simple script named hello.py (Python 2.7): >

Re: Python under PowerShell adds characters

2017-03-29 Thread Rob Gaddi
On 03/29/2017 11:23 AM, Chris Angelico wrote: On Thu, Mar 30, 2017 at 5:19 AM, eryk sun wrote: PowerShell is far more invasive. Instead of giving the child process a handle for the file, it gives it a handle for a *pipe*. PowerShell reads from the pipe, and like an annoying busybody that no ask

Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 5:19 AM, eryk sun wrote: > PowerShell is far more invasive. Instead of giving the child process a > handle for the file, it gives it a handle for a *pipe*. PowerShell > reads from the pipe, and like an annoying busybody that no asked for, > decodes the output as text, proce

Re: Python under PowerShell adds characters

2017-03-29 Thread eryk sun
On Wed, Mar 29, 2017 at 5:42 PM, Jay Braun wrote: > > I'm not using ISE. I'm using a pre-edited script, and running it with the > python command. > > Consider the following simple script named hello.py (Python 2.7): > > print "Hello" > > If I enter: > python hello.py > out.txt > > from cmd.exe I

Re: Python under PowerShell adds characters

2017-03-29 Thread Chris Angelico
On Thu, Mar 30, 2017 at 4:42 AM, Jay Braun wrote: > Consider the following simple script named hello.py (Python 2.7): > > print "Hello" > > If I enter: > > python hello.py > out.txt > > from cmd.exe I get a 6-character file (characters plus new-line). > > from PowerShell I get an extract ^@ charac

Re: K&L graph partitioning code offer

2017-03-29 Thread Michael Torrie
On 03/29/2017 11:17 AM, jlada...@itu.edu wrote: > On Wednesday, March 29, 2017 at 1:23:48 AM UTC-7, arpitam...@gmail.com wrote: >> Hi >> I am planning to tweak the Kernighan Lin algorithm a bit use coercing of >> certain vertices .I was wondering if u would be kind enough to share the >> python

Re: Python under PowerShell adds characters

2017-03-29 Thread Jay Braun
On Wednesday, March 29, 2017 at 10:28:58 AM UTC-7, eryk sun wrote: > On Wed, Mar 29, 2017 at 4:06 PM, wrote: > > I wrote a Python script, which executed as intended on Linux and > > from cmd.exe on Windows. Then, I ran it from the PowerShell > >command line, all print statements added ^@ after e

Re: Python under PowerShell adds characters

2017-03-29 Thread eryk sun
On Wed, Mar 29, 2017 at 4:06 PM, wrote: > I wrote a Python script, which executed as intended on Linux and > from cmd.exe on Windows. Then, I ran it from the PowerShell >command line, all print statements added ^@ after every character. ISE is the only command-line environment that's specific t

Re: K&L graph partitioning code offer

2017-03-29 Thread jladasky
On Wednesday, March 29, 2017 at 1:23:48 AM UTC-7, arpitam...@gmail.com wrote: > Hi > I am planning to tweak the Kernighan Lin algorithm a bit use coercing of > certain vertices .I was wondering if u would be kind enough to share the > python code with me so that i can include my idea in it. Goo

Re: logging.LogRecord asctime aattribute - easily override somehow?

2017-03-29 Thread Skip Montanaro
>>> import logging >>> logging.basicConfig(format="%(asctime)s" + logging.BASIC_FORMAT, >>> datefmt="***%A***") >>> logging.warn("foo") ***Wednesday***WARNING:root:foo Thanks, Peter. I suppose a bit more detail of my environment would have helped. I'm actually using the logging package indirectl

Re: logging.LogRecord asctime aattribute - easily override somehow?

2017-03-29 Thread Peter Otten
Skip Montanaro wrote: > Short of going into some Formatter creation exercise (which seems like > overkill to me, and somewhat obscure), is there some way to easily > change the format of the logging.LogRecord's asctime attribute? > > Thx, > > Skip Like >>> import logging >>> logging.basicConfi

Re: Python under PowerShell adds characters

2017-03-29 Thread Jussi Piitulainen
lyngw...@gmail.com writes: > I wrote a Python script, which executed as intended on Linux and from > cmd.exe on Windows. Then, I ran it from the PowerShell command line, > all print statements added ^@ after every character. > > Have you seen this? Do you know how to prevent this? Script is pri

Python under PowerShell adds characters

2017-03-29 Thread lyngwyst
I wrote a Python script, which executed as intended on Linux and from cmd.exe on Windows. Then, I ran it from the PowerShell command line, all print statements added ^@ after every character. Have you seen this? Do you know how to prevent this? Thank you, Jay -- https://mail.python.org/mailm

logging.LogRecord asctime aattribute - easily override somehow?

2017-03-29 Thread Skip Montanaro
Short of going into some Formatter creation exercise (which seems like overkill to me, and somewhat obscure), is there some way to easily change the format of the logging.LogRecord's asctime attribute? Thx, Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: K&L graph partitioning code offer

2017-03-29 Thread Steve D'Aprano
On Wed, 29 Mar 2017 07:29 pm, arpitamishra...@gmail.com wrote: > Hi > I am planning to tweak the Kernighan Lin algorithm a bit use coercing of > certain vertices .I was wondering if u would be kind enough to share the > python code with me so that i can include my idea in it. https://www.google.

K&L graph partitioning code offer

2017-03-29 Thread arpitamishrarkm
Hi I am planning to tweak the Kernighan Lin algorithm a bit use coercing of certain vertices .I was wondering if u would be kind enough to share the python code with me so that i can include my idea in it. -- https://mail.python.org/mailman/listinfo/python-list

K&L graph partitioning code offer

2017-03-29 Thread arpitamishrarkm
Hi I am planning to tweak the Kernighan Lin algorithm a bit use coercing of certain vertices .I was wondering if u would be kind enough to share the python code with me so that i can include my idea in it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Logging from different python scripts to different output files

2017-03-29 Thread Peter Otten
James McMahon wrote: [Please keep the discussion on the list] > Thank you Peter. Is it necessary to employ a close() on the handlers and a > shutdown() on the loggers themselves? -Jim Not unless you run into problems with the default mechanism -- logging.shutdown() is scheduled via atexit.regis