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

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 > 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 want to > cons

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 > 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 want to > cons

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 > 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 the path? On Linux i

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 wrote: >> Charles R Harris Wrote in message: >>> >> >> Imo the lesson here is never write in low level c. Use modern >> languages with well designed exception handling. > > What, and rely on someone else's low level

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 calculation

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 , > Andrew Cooper wrote: > >> On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote: >>> Thought this group would appreciate this: >>> www.metabright.com/challenges/python >>> >>> MetaBright mak

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 can

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 pil

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... > > > 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: >> >>> >> >> >> >>> Note that this difference mainly applies to how the processes are >> >>> themselves are created... How the library

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! >>>

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

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 entri

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 top

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 st

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 J

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 > 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 and Windows both.

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 >

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 > c

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 (http:/

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" :