Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Chris Angelico
On Thu, May 7, 2015 at 1:33 PM, Steven D'Aprano wrote: > On Thursday 07 May 2015 12:19, Chris Angelico wrote: > >> On Thu, May 7, 2015 at 10:58 AM, Dave Angel wrote: >>> There's nothing Windows-specific about that behaviour. In Linux, there >>> are >>> bash commands that can only be run by using

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Steven D'Aprano
On Thursday 07 May 2015 12:19, Chris Angelico wrote: > On Thu, May 7, 2015 at 10:58 AM, Dave Angel wrote: >> There's nothing Windows-specific about that behaviour. In Linux, there >> are >> bash commands that can only be run by using shell=True. Fortunately >> Popen didn't make the mistake of p

Re: Throw the cat among the pigeons

2015-05-06 Thread Dan Sommers
On Wed, 06 May 2015 09:12:05 -0400, Dave Angel wrote: > Remember the days when you knew how many cycles each assembly > instruction took, and could simply add them up to compare algorithms? I do! I do! :-) And then the MC68020 came out, and instruction execution overlapped in weird (but predic

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Chris Angelico
On Thu, May 7, 2015 at 10:58 AM, Dave Angel wrote: > There's nothing Windows-specific about that behaviour. In Linux, there are > bash commands that can only be run by using shell=True. Fortunately Popen > didn't make the mistake of pretending it's a shell. But bash commands aren't the same as

Re: Writing list of dictionaries to CSV [correction]

2015-05-06 Thread Tim Chase
On 2015-05-06 20:22, Tim Chase wrote: > As ChrisA posted earlier, you have to use Excel's Import > functionality (there are several ways to get this wizard, but not > all ways of opening a .csv trigger the wizard), then specify those > particular columns as "Text" rather than "General" Sorry, it w

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Jon Ribbens
On 2015-05-06, Denis McMahon wrote: > You need to format your CSV date into a date format that Excel > understands when it imports it. > > First thing to try would be to export some dates from excel as CSV and > see what format excel puts them in. Beware of assuming that Excel can import its ow

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Tim Chase
On 2015-05-06 23:31, Denis McMahon wrote: > On Tue, 05 May 2015 22:32:28 -0700, Kashif Rana wrote: > > thanks for the feedback. I think its problem with excel itself, > > showing wrong value. Because when I opened the csv file in text > > editor, I can see correct value but opening in excel showing

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Dave Angel
On 05/06/2015 06:11 PM, Stefan Zimmermann wrote: Hi. I don't like that subprocess.Popen(['command']) only works on Windows if there is a command.exe in %PATH%. As a Windows user you would normally expect that also command.bat and command.cmd can be run that way. and command.com. If it'

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Denis McMahon
On Tue, 05 May 2015 22:32:28 -0700, Kashif Rana wrote: > thanks for the feedback. I think its problem with excel itself, showing > wrong value. Because when I opened the csv file in text editor, I can > see correct value but opening in excel showing wrong value. What I can > do to see correct in e

Re: [SciPy-User] Is there existing code to log-with-bells-on for runtime algorithm diagnostics?

2015-05-06 Thread Rob Clewley
Just to follow up on this thread, for interested readers' future reference... On Tue, Apr 21, 2015 at 4:22 PM, Robert Kern wrote: > On Tue, Apr 21, 2015 at 8:02 PM, Rob Clewley wrote: >> In fact, I'm trying to build a general purpose tool for exploring the >> inner workings of numerical algorith

Re: CHALLENGE HELP - GOOGLE DEVELOPER DAY

2015-05-06 Thread Denis McMahon
On Tue, 05 May 2015 09:59:03 -0700, worship.brother wrote: > Archaeologists have found a scroll with the following texts: First you need to visit the hidden Temple of Offler, where you will find the Tears of Offler (they're the big gems set into the statue just above the teeth) after making you

PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Stefan Zimmermann
Hi. I don't like that subprocess.Popen(['command']) only works on Windows if there is a command.exe in %PATH%. As a Windows user you would normally expect that also command.bat and command.cmd can be run that way. There are simple workarounds like Popen(..., shell=True) but that is a heavy ove

Re: Encrypt python files

2015-05-06 Thread Emile van Sebille
On 5/6/2015 12:23 AM, Palpandi wrote: On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: Hi, What are the ways to encrypt python files? No, I just want to hide the scripts from others. See http://stackoverflow.com/questions/261638/how-do-i-protect-python-code Emile -- htt

Re: extracting zip item to in-memory

2015-05-06 Thread Mark Lawrence
On 06/05/2015 21:27, noydb wrote: I have a zip file containing several files and I want to extract out just the .xml file. I have that code. Curious if this xml file can be extracted into memory. If so, how to? I only need to move the file around, and maybe read some tags. Thanks for any

Re: extracting zip item to in-memory

2015-05-06 Thread Dave Angel
On 05/06/2015 04:27 PM, noydb wrote: I have a zip file containing several files and I want to extract out just the .xml file. I have that code. Curious if this xml file can be extracted into memory. If so, how to? I only need to move the file around, and maybe read some tags. Thanks for a

extracting zip item to in-memory

2015-05-06 Thread noydb
I have a zip file containing several files and I want to extract out just the .xml file. I have that code. Curious if this xml file can be extracted into memory. If so, how to? I only need to move the file around, and maybe read some tags. Thanks for any help! python 2.7 -- https://mail.p

Re: Throw the cat among the pigeons

2015-05-06 Thread Mark Lawrence
On 06/05/2015 17:17, Ian Kelly wrote: On Wed, May 6, 2015 at 1:08 AM, Steven D'Aprano Besides, "typical load" is a myth -- there is no such thing. A high-end Windows web server getting ten thousand hits a minute, a virtual machine starved for RAM, a Mac laptop, a Linux server idling away with a

Re: Throw the cat among the pigeons

2015-05-06 Thread Dave Angel
On 05/06/2015 11:36 AM, Alain Ketterlin wrote: Yes, plus the time for memory allocation. Since the code uses "r *= ...", space is reallocated when the result doesn't fit. The new size is probably proportional to the current (insufficient) size. This means that overall, you'll need fewer reallocat

Re: Bitten by my C/Java experience

2015-05-06 Thread Mark Lawrence
On 06/05/2015 17:03, Steven D'Aprano wrote: On Wed, 6 May 2015 10:40 pm, BartC wrote: But I had in mind not implementing ++ and --, but detecting them and issuing a warning, That's a job for a linter, not the compiler. The compiler should be as flexible as possible in what it accepts: a ,

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Tim Chase
On 2015-05-06 12:27, Ian Kelly wrote: > On Wed, May 6, 2015 at 12:22 PM, Tim Chase > wrote: > > On 2015-05-06 19:08, MRAB wrote: > >> You could tell it to quote any value that's not a number: > >> > >> w = csv.DictWriter(f, pol_keys, > >> quoting=csv.QUOTE_NONNUMERIC) > >> > >> It looks like

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Ian Kelly
On Wed, May 6, 2015 at 12:22 PM, Tim Chase wrote: > On 2015-05-06 19:08, MRAB wrote: >> You could tell it to quote any value that's not a number: >> >> w = csv.DictWriter(f, pol_keys, >> quoting=csv.QUOTE_NONNUMERIC) >> >> It looks like all of the values you have are strings, so they'll >> a

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Tim Chase
On 2015-05-06 19:08, MRAB wrote: > You could tell it to quote any value that's not a number: > > w = csv.DictWriter(f, pol_keys, > quoting=csv.QUOTE_NONNUMERIC) > > It looks like all of the values you have are strings, so they'll > all be quoted. > > I would hope that Excel will then treat

Re: Writing list of dictionaries to CSV

2015-05-06 Thread MRAB
On 2015-05-06 06:32, Kashif Rana wrote: Hello guys thanks for the feedback. I think its problem with excel itself, showing wrong value. Because when I opened the csv file in text editor, I can see correct value but opening in excel showing wrong value. What I can do to see correct in excel as

Re: Throw the cat among the pigeons

2015-05-06 Thread Paul Rubin
Ian Kelly writes: > That was my initial thought as well, but the problem is that this > actually predicts the *opposite* of what is being reported: upward > should be less expensive, not more. Wait, what? Hmm, you're right. Needed coffee, will think about it more later. -- https://mail.python.

Re: Json Comaprision

2015-05-06 Thread John Gordon
In pra devOPS writes: > I wanted to compare two json files ignoring few of the keys in the json > files. > Can anybody suggest me few things? Load each json file into a python object, delete the keys you don't care about, and compare the two objects. -- John Gordon Imagine what it m

Re: Throw the cat among the pigeons

2015-05-06 Thread Ian Kelly
On Wed, May 6, 2015 at 1:08 AM, Steven D'Aprano wrote: > On Wednesday 06 May 2015 15:58, Ian Kelly wrote: > >> On Tue, May 5, 2015 at 7:27 PM, Steven D'Aprano >> wrote: >>> Only the minimum is statistically useful. >> >> I disagree. The minimum tells you how fast the code *can* run, under >> opti

Re: Bitten by my C/Java experience

2015-05-06 Thread Steven D'Aprano
On Wed, 6 May 2015 10:40 pm, BartC wrote: > But I had in mind not implementing ++ and --, but detecting them and > issuing a warning, That's a job for a linter, not the compiler. The compiler should be as flexible as possible in what it accepts: a ,b=12+3 * 4,"hello"

Re: Throw the cat among the pigeons

2015-05-06 Thread Ian Kelly
On Wed, May 6, 2015 at 9:12 AM, Paul Rubin wrote: > Steven D'Aprano writes: >> Multiplying upwards seems to be more expensive than multiplying >> downwards... I can only guess that it has something to do with the way >> multiplication is implemented, or perhaps the memory management >> involved,

Re: Throw the cat among the pigeons

2015-05-06 Thread Alain Ketterlin
Paul Rubin writes: > Steven D'Aprano writes: >> Multiplying upwards seems to be more expensive than multiplying >> downwards... I can only guess that it has something to do with the way >> multiplication is implemented, or perhaps the memory management >> involved, or something. Who the hell kno

Re: Throw the cat among the pigeons

2015-05-06 Thread Paul Rubin
Steven D'Aprano writes: > Multiplying upwards seems to be more expensive than multiplying > downwards... I can only guess that it has something to do with the way > multiplication is implemented, or perhaps the memory management > involved, or something. Who the hell knows? It seems pretty natura

Re: Throw the cat among the pigeons

2015-05-06 Thread Dave Angel
On 05/06/2015 09:55 AM, Chris Angelico wrote: On Wed, May 6, 2015 at 11:12 PM, Dave Angel wrote: I had guessed that the order of multiplication would make a big difference, once the product started getting bigger than the machine word size. Reason I thought that is that if you multiply startin

Re: Throw the cat among the pigeons

2015-05-06 Thread Chris Angelico
On Wed, May 6, 2015 at 11:12 PM, Dave Angel wrote: > I had guessed that the order of multiplication would make a big difference, > once the product started getting bigger than the machine word size. > > Reason I thought that is that if you multiply starting at the top value (and > end with multipl

Re: Throw the cat among the pigeons

2015-05-06 Thread Dave Angel
On 05/06/2015 02:26 AM, Steven D'Aprano wrote: On Wednesday 06 May 2015 14:05, Steven D'Aprano wrote: My interpretation of this is that the difference has something to do with the cost of multiplications. Multiplying upwards seems to be more expensive than multiplying downwards, a result I nev

Re: Bitten by my C/Java experience

2015-05-06 Thread Chris Angelico
On Wed, May 6, 2015 at 11:11 PM, wrote: > On Mon, May 4, 2015, at 18:02, BartC wrote: >> (I think I would have picked up "++" and "--" as special tokens even if >> increment/decrement ops weren't supported. Just because they would >> likely cause errors through misunderstanding.) > > There's prec

Re: Bitten by my C/Java experience

2015-05-06 Thread random832
On Mon, May 4, 2015, at 18:02, BartC wrote: > (I think I would have picked up "++" and "--" as special tokens even if > increment/decrement ops weren't supported. Just because they would > likely cause errors through misunderstanding.) There's precedent for not doing this in C itself - even thou

Re: Bitten by my C/Java experience

2015-05-06 Thread Rustom Mody
On Wednesday, May 6, 2015 at 6:09:08 PM UTC+5:30, Antoon Pardon wrote: > Op 05-05-15 om 18:24 schreef Rustom Mody: > > > Yeah I happen to me in that minuscule minority that regards '= denotes > > assignment' a bigger mistake than ++ > > Nice to know I'm not alone. I Especially think it is a mist

Re: Bitten by my C/Java experience

2015-05-06 Thread BartC
On 06/05/2015 12:19, Gregory Ewing wrote: BartC wrote: So why pretend that ++ and -- don't exist? Probably because Python would gain very little from having them. Main uses of ++ in C are things like integer for loops: for (i = 0; i < 10; i++) {... and stepping through arrays: a[i

Re: Bitten by my C/Java experience

2015-05-06 Thread Antoon Pardon
Op 05-05-15 om 18:24 schreef Rustom Mody: > Yeah I happen to me in that minuscule minority that regards '= denotes > assignment' a bigger mistake than ++ Nice to know I'm not alone. I Especially think it is a mistake, because it is then used as a reason for not allowing something like if a =

Re: Json Comaprision

2015-05-06 Thread Mark Lawrence
On 05/05/2015 20:55, pra devOPS wrote: Hi All: I wanted to compare two json files ignoring few of the keys in the json files. Can anybody suggest me few things? Thanks, Siva https://docs.python.org/3/library/json.html#module-json -- My fellow Pythonistas, ask not what our language can do

Re: Encrypt python files

2015-05-06 Thread Steven D'Aprano
On Wed, 6 May 2015 07:45 pm, Albert-Jan Roskam wrote: > I used the marshal module before as a faster alternative to shelve (I > marshalled a huge dictionary). I always understood marshal files require > the *exact* same interpreter version (incl. built number). Do the same > limitations apply for

Re: Bitten by my C/Java experience

2015-05-06 Thread Gregory Ewing
BartC wrote: So why pretend that ++ and -- don't exist? Probably because Python would gain very little from having them. Main uses of ++ in C are things like integer for loops: for (i = 0; i < 10; i++) {... and stepping through arrays: a[i++] = b[j++]; Python code usually operates a

Re: Bitten by my C/Java experience

2015-05-06 Thread Gregory Ewing
Steven D'Aprano wrote: The first one just does a name lookup and then throws the result away. The second one looks up names a and b, then adds them together, throwing away the result. Actually, it's worse than that. :-) It's possible for a to have an __add__ method with a side effect, althoug

Re: Encrypt python files

2015-05-06 Thread Albert-Jan Roskam via Python-list
- On Wed, May 6, 2015 11:04 AM CEST Steven D'Aprano wrote: >On Wednesday 06 May 2015 17:23, Palpandi wrote: > >> On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: >> Hi, >> >> What are the ways to encrypt python files? >> >> No, I just want to hide t

Re: DRM is self-defeating (was: Encrypt python files)

2015-05-06 Thread Chris Angelico
On Wed, May 6, 2015 at 6:24 PM, Albert-Jan Roskam via Python-list wrote: >>The only feasible solution is to distribute files only to those >>recipients you want to have them, and can trust to do with them as you >>ask. If you don't trust a recipient, don't hand the files to them. > > Can tools lik

Re: Encrypt python files

2015-05-06 Thread Steven D'Aprano
On Wednesday 06 May 2015 17:23, Palpandi wrote: > On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: >> Hi, >> >> What are the ways to encrypt python files? > > No, I just want to hide the scripts from others. Why, are you ashamed of your code? Python is free, open source softw

Json Comaprision

2015-05-06 Thread pra devOPS
Hi All: I wanted to compare two json files ignoring few of the keys in the json files. Can anybody suggest me few things? Thanks, Siva -- https://mail.python.org/mailman/listinfo/python-list

Re: DRM is self-defeating (was: Encrypt python files)

2015-05-06 Thread Albert-Jan Roskam via Python-list
- On Wed, May 6, 2015 9:41 AM CEST Ben Finney wrote: >Palpandi writes: > >> On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: > >> > What are the ways to encrypt python files? >> >> No, I just want to hide the scripts from others. > >Which others? You

Re: DRM is self-defeating (was: Encrypt python files)

2015-05-06 Thread Chris Angelico
On Wed, May 6, 2015 at 5:41 PM, Ben Finney wrote: > The only feasible solution is to distribute files only to those > recipients you want to have them, and can trust to do with them as you > ask. If you don't trust a recipient, don't hand the files to them. in today's world, that basically gives

DRM is self-defeating (was: Encrypt python files)

2015-05-06 Thread Ben Finney
Palpandi writes: > On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: > > What are the ways to encrypt python files? > > No, I just want to hide the scripts from others. Which others? You can hide the scripts from them by never showing those others the scripts. If you don't trus

Re: Encrypt python files

2015-05-06 Thread Palpandi
On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: > Hi, > > What are the ways to encrypt python files? No, I just want to hide the scripts from others. -- https://mail.python.org/mailman/listinfo/python-list

Re: Throw the cat among the pigeons

2015-05-06 Thread Steven D'Aprano
On Wednesday 06 May 2015 15:58, Ian Kelly wrote: > On Tue, May 5, 2015 at 7:27 PM, Steven D'Aprano > wrote: >> Only the minimum is statistically useful. > > I disagree. The minimum tells you how fast the code *can* run, under > optimal circumstances. The mean tells you how fast it *realistically

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Cecil Westerhof
Op Wednesday 6 May 2015 07:32 CEST schreef Kashif Rana: > thanks for the feedback. I think its problem with excel itself, > showing wrong value. Because when I opened the csv file in text > editor, I can see correct value but opening in excel showing wrong > value. What I can do to see correct in