Re: Bitten by my C/Java experience

2015-05-04 Thread Andrew Cooper
On 04/05/2015 18:43, Ian Kelly wrote: Some other gotchas that aren't necessarily related to C/Java but can be surprising nonetheless: *() is a zero-element tuple, and (a, b) is a two-element tuple, but (a) is not a one-element tuple. Tuples are created by commas, not parentheses, so

Re: Strange syntax error, occurs only when script is executed directly

2014-04-22 Thread Andrew Cooper
On 22/04/2014 13:52, Chris Angelico wrote: On Tue, Apr 22, 2014 at 10:36 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: These are the 15 first lines of the script: #! /opt/local/bin/python This being Solaris, what happens if you remove the space between the hash- bang and

Re: Strange syntax error, occurs only when script is executed directly [solved]

2014-04-22 Thread Andrew Cooper
On 22/04/2q014 13:26, Chris Angelico wrote: On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Yes that was it. I changed the first line of my script to: #!/opt/local/bin/python2.7 and it now works. Excellent! Shebangs are *extremely* specific, so you may

Re: Strange syntax error, occurs only when script is executed directly [solved]

2014-04-22 Thread Andrew Cooper
On 22/04/2q014 13:26, Chris Angelico wrote: On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Yes that was it. I changed the first line of my script to: #!/opt/local/bin/python2.7 and it now works. Excellent! Shebangs are *extremely* specific, so you may

Re: How security holes happen

2014-03-04 Thread Andrew Cooper
On 03/03/2014 22:19, Cameron Simpson wrote: On 03Mar2014 09:17, Neal Becker ndbeck...@gmail.com wrote: Charles R Harris charlesr.har...@gmail.com Wrote in message: Imo the lesson here is never write in low level c. Use modern languages with well designed exception handling. What, and

Re: PyMyth: Global variables are evil... WRONG!

2013-11-13 Thread Andrew Cooper
On 13/11/2013 02:45, Rick Johnson wrote: math.pi should be math.PI. and PI should be a CONSTANT. And not just a pseudo constant, but a REAL constant that cannot be changed. And what do you do when the wizards bend space-time to make PI exactly 3, for the ease of other calculations when

Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote: Thought this group would appreciate this: www.metabright.com/challenges/python MetaBright makes skill assessments to measure how talented people are at different skills. And recruiters use MetaBright to find outrageously skilled job

Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:24, Roy Smith wrote: In article jWAeu.102858$rN3.45213@fx21.am4, Andrew Cooper root@127.0.0.1 wrote: On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote: Thought this group would appreciate this: www.metabright.com/challenges/python MetaBright makes skill assessments

Re: 10 sec poll - please reply!

2012-11-21 Thread Andrew Cooper
On 21/11/2012 07:01, Steven D'Aprano wrote: On Wed, 21 Nov 2012 17:35:27 +1100, Chris Angelico wrote: And yet, trivial though it may seem, function naming in a permanent API is pretty important. Threads like this can be the difference between coherent and useful APIs and veritable piles of

Re: Is there a way to create kernel log messages via Python?

2012-10-16 Thread Andrew Cooper
On 16/10/2012 04:43, J wrote: Hi... snip So, what I REALLY want is to inject my start/stop markers into klogd rather than syslogd. This will, I hope, give my markers kernel timestamps rather than syslog timestamps which are not as accurate. So does anyone know of a way to do this?

Re: Looking for an IPC solution

2012-09-09 Thread Andrew Cooper
On 08/09/2012 16:11, Ramchandra Apte wrote: On Friday, 7 September 2012 02:25:15 UTC+5:30, Dave Angel wrote: On 09/06/2012 04:33 PM, Dennis Lee Bieber wrote: snip Note that this difference mainly applies to how the processes are themselves are created... How the library wraps shared

Re: OT: Monty Python in Syria

2012-08-15 Thread Andrew Cooper
On 16/08/2012 01:01, Terry Reedy wrote: On 8/15/2012 6:07 PM, Mark Lawrence wrote: On 15/08/2012 20:15, Tamer Higazi wrote: Exactly! NOT PROGRAMMING related has NOTHING TODO HERE! Please don't shout, please don't top post agreed. and what gives you the right to determine what is or

Re: OT: Monty Python in Syria

2012-08-15 Thread Andrew Cooper
On 16/08/2012 01:52, Andrew Cooper wrote: On 16/08/2012 01:01, Terry Reedy wrote: On 8/15/2012 6:07 PM, Mark Lawrence wrote: On 15/08/2012 20:15, Tamer Higazi wrote: Exactly! NOT PROGRAMMING related has NOTHING TODO HERE! Please don't shout, please don't top post agreed. and what gives

Re: save dictionary to a file without brackets.

2012-08-09 Thread Andrew Cooper
On 09/08/2012 22:34, Roman Vashkevich wrote: Actually, they are different. Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred thousand entries, and you will feel the difference. Dict uses hashing to get a value from the dict and this is why it's O(1). Sligtly off topic,

Re: save dictionary to a file without brackets.

2012-08-09 Thread Andrew Cooper
On 09/08/2012 23:26, Dave Angel wrote: On 08/09/2012 06:03 PM, Andrew Cooper wrote: On 09/08/2012 22:34, Roman Vashkevich wrote: Actually, they are different. Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred thousand entries, and you will feel the difference. Dict uses

Re: Is there a clever way to pass arguments

2012-08-08 Thread Andrew Cooper
On 09/08/2012 01:41, bruceg113...@gmail.com wrote: Is there a way in Python to pass arguments without listing each argument? For example, my program does the following: testData (z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7]) Is there a clever way to pass arguments in a single

Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-29 Thread Andrew Cooper
On 28/07/2012 16:51, Chris Angelico wrote: On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: I highly recommend the use of notepad++. If anyone knows of a better text editor for Windows please let me know :) My current preference is SciTE, available on Linux

Re: Is Python a commercial proposition ?

2012-07-29 Thread Andrew Cooper
On 29/07/2012 17:01, lipska the kat wrote: Pythoners Firstly, thanks to those on the tutor list who answered my questions. I'm trying to understand where Python fits into the set of commonly available, commercially used languages of the moment. My most recent experience is with Java.

Re: What's wrong with this code?

2012-07-23 Thread Andrew Cooper
On 23/07/2012 15:50, Stone Li wrote: I'm totally confused by this code: Code: a = None b = None c = None d = None x = [[a,b], [c,d]] e,f = x[1] print e,f c = 1 d = 2 print e,f e = 1 f = 2 print c,d Output:

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Cooper
On 17/07/2012 19:36, Lipska the Kat wrote: On 17/07/12 19:18, Mark Lawrence wrote: On 17/07/2012 18:29, Ethan Furman wrote: Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code

Re: Diagramming code

2012-07-16 Thread Andrew Cooper
On 16/07/2012 21:41, Andrea Crotti wrote: On 07/16/2012 02:26 AM, hamilton wrote: Is there any software to help understand python code ? Thanks hamilton Sometimes to get some nice graphs I use gprof2dot (http://code.google.com/p/jrfonseca/wiki/Gprof2Dot) or doxygen

Re: 2 + 2 = 5

2012-07-05 Thread Andrew Cooper
On 05/07/2012 22:46, Evan Driscoll wrote: On 01/-10/-28163 01:59 PM, Alexander Blinne wrote: 5+0 is actually 4+0, because 5 == 4, so 5+0 gives 4. 5+1 is actually 4+1, which is 5, but 5 is again 4. 5+2 is 4+2 which is 6. Now all I can think is Hoory for new math, new-hoo-hoo math :-) Evan