Re: psss...I want to move from Perl to Python

2016-01-29 Thread James Harris
On 29/01/2016 09:12, Ulli Horlacher wrote: Steven D'Aprano wrote: Every time I make a half-hearted attempt to learn enough Perl syntax to get started, I keep running into the differences between $foo, %foo and @foo and dire warnings about what happens if you use the wrong sigil I have starte

List comprehensions and evaluation of elements therein

2015-09-23 Thread James Harris
A list comprehension has various components. Anyone know when each of the elements is evaluated? In the form [v0 for v0 in expr0 if expr1] If v0 appears in expr0 or expr1 the evaluation order matters. I think of the above as being a rewrite of results = [] for v0 in expr0: if expr1:

Re: A little test for you Guys😜

2015-09-22 Thread James Harris
wrote in message news:5218c7f9-74ea-4ca0-abd1-46a9bcd3d...@googlegroups.com... ... Pretty sure this guy is asking us to do his homework. :-P Maybe (and I hope not) but asking what PEP8 is could be easily found on the internet and asking what the values would be at the end of the program

Re: Lightwight socket IO wrapper

2015-09-22 Thread James Harris
"Marko Rauhamaa" wrote in message news:8737y6cgp6@elektro.pacujo.net... "James Harris" : I agree with what you say. A zero-length UDP datagram should be possible and not indicate end of input but is that guaranteed and portable? The zero-length payload size should

Re: A little test for you Guys😜

2015-09-22 Thread James Harris
On Tuesday, September 22, 2015 at 7:45:00 PM UTC+1, Lj Fc wrote: > you have 10 minutes😂 Good luck!! A good set of questions, IMO. Am answering as someone coming back to Python after a few years. > 1. What is PEP8 ? Coding guidelines, I think. > 2. What are the different ways to distribute some

Re: Lightwight socket IO wrapper

2015-09-22 Thread James Harris
"Akira Li" <4kir4...@gmail.com> wrote in message news:mailman.18.1442804862.28679.python-l...@python.org... "James Harris" writes: ... There are a few things and more crop up as time goes on. For example, over TCP it would be helpful to have a function to receive a s

Re: Lightwight socket IO wrapper

2015-09-22 Thread James Harris
"Dennis Lee Bieber" wrote in message news:mailman.12.1442794762.28679.python-l...@python.org... On Sun, 20 Sep 2015 23:36:30 +0100, "James Harris" declaimed the following: There are a few things and more crop up as time goes on. For example, over TCP it would be helpfu

Re: Lightwight socket IO wrapper

2015-09-20 Thread James Harris
"Akira Li" <4kir4...@gmail.com> wrote in message news:mailman.37.1442754893.21674.python-l...@python.org... "James Harris" writes: I guess there have been many attempts to make socket IO easier to handle and a good number of those have been in Python. The trou

Lightwight socket IO wrapper

2015-09-20 Thread James Harris
I guess there have been many attempts to make socket IO easier to handle and a good number of those have been in Python. The trouble with trying to improve something which is already well designed (and conciously left as is) is that the so-called improvement can become much more complex and ov

Re: Shutting down a cross-platform multithreaded app

2015-09-19 Thread James Harris
"Chris Angelico" wrote in message news:mailman.13.1442657702.21674.python-l...@python.org... On Sat, Sep 19, 2015 at 7:49 PM, James Harris wrote: "Chris Angelico" wrote in message news:mailman.8.1442612439.21674.python-l...@python.org... ... If you're usin

Re: Shutting down a cross-platform multithreaded app

2015-09-19 Thread James Harris
"Laura Creighton" wrote in message news:mailman.5.1442609448.21674.python-l...@python.org... In a message of Fri, 18 Sep 2015 20:09:19 +0100, "James Harris" writes: Set the daemon flag on the worker threads, so when the main thread exits, the workers also exit. Interes

Re: Shutting down a cross-platform multithreaded app

2015-09-19 Thread James Harris
"Chris Angelico" wrote in message news:mailman.8.1442612439.21674.python-l...@python.org... On Sat, Sep 19, 2015 at 3:17 AM, James Harris wrote: Needless to say, on a test Windows machine AF_UNIX is not present. The only cross-platform option, therefore, seems to be to use each s

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread James Harris
"Paul Rubin" wrote in message news:87zj0jd1ta@jester.gateway.sonic.net... "James Harris" writes: I have a multithreaded app that I want to be able to shut down easily such as by hitting control-c or sending it a signal. Set the daemon flag on the worker threa

Shutting down a cross-platform multithreaded app

2015-09-18 Thread James Harris
Well, this is fun ... for some definition of the word. ;-( I have a multithreaded app that I want to be able to shut down easily such as by hitting control-c or sending it a signal. What follows is the way I have come up with given the common elements of different environments. Suggestions for

Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread James Harris
"James Harris" wrote in message news:msv21t$n1m$1...@dont-email.me... "Grant Edwards" wrote in message news:msum6c$hv$1...@reader1.panix.com... ... Waking up twice per second and immediately calling select() again on any hardware/OS built in the past 50 years

Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread James Harris
"Grant Edwards" wrote in message news:msum6c$hv$1...@reader1.panix.com... On 2015-09-11, Chris Angelico wrote: This is what I meant when I said you would be polling. Effectively, you wake up your program every half-second, check if Ctrl-C has been pressed, and if it hasn't, you go back to s

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread James Harris
"Chris Angelico" wrote in message news:mailman.337.1441913195.8327.python-l...@python.org... On Fri, Sep 11, 2015 at 5:11 AM, James Harris wrote: ... However, on Windows the recognition of Control-C does not happen until after something connects to the socket. ... This

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread James Harris
"Chris Angelico" wrote in message news:mailman.332.1441910212.8327.python-l...@python.org... On Fri, Sep 11, 2015 at 4:24 AM, James Harris wrote: I have a listening socket, self.lsock, which is used in an accept() call as follows endpoint = self.lsock.accept() The problem

Signal SIGINT ignored during socket.accept

2015-09-10 Thread James Harris
I have a listening socket, self.lsock, which is used in an accept() call as follows endpoint = self.lsock.accept() The problem is that if control-C is pressed it is not recognised until something connects to that socket. Only when the accept() call returns is the signal seen. The question,

Re: converting strings to hex

2014-04-03 Thread James Harris
"Mark H Harris" wrote in message news:533e1b2e.5040...@gmail.com... > On 4/3/14 9:10 PM, dave em wrote: >> >> I am taking a cryptography class and am having a >> tough time with an assignment similar to this. >> > > hi Dave, if your instructor wanted you to work on this with other people > she w

Re: How to get Mac address of ethernet port?

2014-01-11 Thread James Harris
"Andriy Kornatskyy" wrote in message news:mailman.5329.1389450993.18130.python-l...@python.org... > Sam, > > How about this? > > from uuid import getnode as get_mac > '%012x' % get_mac() AIUI that will return a mac address even if there isn't one. That may or may not suit the OP. To the OP, de

Re: With this artifact, everyone can easily invent new languages

2014-01-11 Thread James Harris
"Simeon Chaos" wrote in message news:d7878ab7-2f6d-4bc4-9a28-3ea567bdf...@googlegroups.com... > Thank you, James. I didn't know this group before. I'll post this message > there. You're welcome. It can be hard to find apt groups on Usenet because there are so many. I don't think there was ever

Re: With this artifact, everyone can easily invent new languages

2014-01-10 Thread James Harris
"Simeon Chaos" wrote in message news:bb7d8d30-845a-4a3d-9b03-dee71ef42...@googlegroups.com... > ? 2014?1?11UTC+8??10?17?33?,Chris Angelico??: > > On Sat, Jan 11, 2014 at 11:59 AM, Simeon Chaos wrote: > > > > > All along, the design of programming languages is a complex task. > > > Because we

Re: Weird problem with UDP and gevent

2013-10-18 Thread James Harris
"Roy Smith" wrote in message news:l3riea$82$1...@panix2.panix.com... > I'm running: > > Ubuntu Precise > Python 2.7.3 > django 1.4.5 > gunicorn 0.17.4 > gevent 1.0dev (rc3) > > I haven't been able to pin this down exactly, but it looks like if I > do (inside of a custom logging.Handler subclass):

Re: How to streamingly read text file and display whenever updated text

2013-10-05 Thread James Harris
wrote in message news:04ee91f9-1cbf-4364-bca3-da25aa4db...@googlegroups.com... > > > #!/usr/bin/python > import time > f = open('/home/martin/Downloads/a.txt') Looks like you are on Unix so you can do this from the shell tail -F /home/martin/Downloads/a.txt James -- https://mail.python.or

Re: Handling 3 operands in an expression without raising an exception

2013-09-26 Thread James Harris
"?" wrote in message news:l20utg$278$1...@dont-email.me... > 26/9/2013 12:07 ??, ?/? Antoon Pardon ??: >> Experiment and find out for yourself. That is the only way you will >> acquire the experience and understanding you need. Sure we could >> spoon feed you the line you need, but t

Re: Python TUI that will work on DOS/Windows and Unix/Linux

2013-09-11 Thread James Harris
"Michael Torrie" wrote in message news:mailman.229.1378858009.5461.python-l...@python.org... ... > A toolkit (that's old, arguably), that might help you is TVision, a port > of the old Turbo Vision library that formed the foundation for Borland's > old DOS IDEs back in the day (check wikipedia)

Re: Python TUI that will work on DOS/Windows and Unix/Linux

2013-09-04 Thread James Harris
"James Harris" wrote in message news:kvmvpg$g96$1...@dont-email.me... > Am looking for a TUI (textual user interface) mechanism to allow a Python > program to create and update a display in text mode. For example, if a > command prompt was sized 80x25 it would be made u

Python TUI that will work on DOS/Windows and Unix/Linux

2013-08-29 Thread James Harris
Am looking for a TUI (textual user interface) mechanism to allow a Python program to create and update a display in text mode. For example, if a command prompt was sized 80x25 it would be made up of 80 x 25 = 2000 characters. The Python program would need to be able to write to any of those 200

RFD: comp.sys.raspberry-pi

2013-03-09 Thread James Harris
groups news.groups.proposals comp.lang.forth comp.lang.python comp.os.linux.misc PROPONENT: James Harris james.harris.1Agmail.com (replace A with @ - but please discuss the proposal on Usenet!) CHANGE HISTORY: 2013-03-09 Initial RFD -- http://mail.python.org/mailman/listinfo/python-list

Re: Shebang line on Windows?

2013-02-22 Thread James Harris
On Feb 22, 6:40 pm, Zachary Ware wrote: > On Fri, Feb 22, 2013 at 12:16 PM, Walter Hurry > wrote: > > I use FreeBSD or Linux, but my son is learning Python and is using > > Windows. > > > My question is this: Would it be good practice for him to put #!/usr/bin/ > > env python at the top of his

Re: What was your strategy?

2010-11-14 Thread James Harris
On Nov 14, 10:32 pm, Jorge Biquez wrote: > Hello all. > Quick question. I know some of you are with Python since started, > some other maybe later. > > I was wondering if you can share what was the strategy you followed > to master Python (Yes I know I have to work hard study and practice a > lot)

Re: Does everyone keep getting recruiting emails from google?

2010-10-14 Thread James Harris
On 14 Oct, 16:49, Daniel Fetchinson wrote: > I keep getting recruiting emails from charlesngu...@google.com about > working for google as an engineer. The messages are pretty much the > same and go like this: ... > I'm guessing I'm not the only one on this list to get these emails and > suspect

Re: if the else short form

2010-10-06 Thread James Harris
On 5 Oct, 06:52, Lawrence D'Oliveiro wrote: > In message > , James > > Harris wrote: > > On 29 Sep, 18:20, Seebs wrote: > > >> On 2010-09-29, Tracubik wrote: > > >>> button = gtk.Button(("False,", "True,")[fill==True])

Re: if the else short form

2010-10-04 Thread James Harris
On 29 Sep, 18:20, Seebs wrote: > On 2010-09-29, Tracubik wrote: > > > Hi all, > > I'm studying PyGTK tutorial and i've found this strange form: > > > button = gtk.Button(("False,", "True,")[fill==True]) > > > the label of button is True if fill==True, is False otherwise. > > > i have googled for

Re: Sharing a program I wrote

2010-05-05 Thread James Harris
On 5 May, 04:25, Scott wrote: > James, > > Thanks for the comprehensive reply. I would like to post it to > comp.lang.python but the main file is 169 lines long and the file for > functions is 316 lines long. I'm thinking that is a little long for > this format. You're welcome. Yes, it sounds a b

Re: Sharing a program I wrote

2010-05-04 Thread James Harris
On 4 May, 22:40, Scott wrote: > I'm looking for suggestions on what to do (and how to do it) if I want > to share a program that I wrote in Python. There seem to be quite a > few places to post code and I don't know how to choose. Perhaps look at the options and then select whichever suits your n

Re: Python database of plain text editable by notepad or vi

2010-03-27 Thread James Harris
On 26 Mar, 14:58, Jon Clements wrote: > On 26 Mar, 09:49, James Harris wrote: ... > > I'm toying with some > > ideas for a way to help generate source code (in various languages, > > not just Python). If it goes ahead the text files would be mainly > > marked-up

Re: Python database of plain text editable by notepad or vi

2010-03-26 Thread James Harris
On 26 Mar, 10:04, Harishankar wrote: ... > > Think of the database as similar to an associative array stored on > > disk. The only difference is I may want to play fast and loose with > > the keys in some ways - e.g. check for partial key matches or return a > > list of part-matched keys. The lang

Re: Python database of plain text editable by notepad or vi

2010-03-26 Thread James Harris
On 25 Mar, 22:56, Jon Clements wrote: > On 25 Mar, 22:40, James Harris wrote: > > > I am looking to store named pieces of text in a form that can be > > edited by a standard editor such as notepad (under Windows) or vi > > (under Unix) and then pulled into Python as

Python database of plain text editable by notepad or vi

2010-03-25 Thread James Harris
I am looking to store named pieces of text in a form that can be edited by a standard editor such as notepad (under Windows) or vi (under Unix) and then pulled into Python as needed. The usual record locking and transactions of databases are not required. Another way to look at it is to treat the

Re: Anything like "Effective Java" for Python?

2010-03-11 Thread James Harris
On 10 Mar, 15:19, kj wrote: > Subject line pretty much says it all: is there a book like "Effective > Java" for Python.  I.e. a book that assumes that readers are > experienced programmers that already know the basics of the language, > and want to focus on more advanced programming issues? I don

Re: Named loops for breaking

2010-03-10 Thread James Harris
On 10 Mar, 06:29, "Gabriel Genellina" wrote: > En Tue, 09 Mar 2010 18:41:10 -0300, Daniel Klein   > escribi : > > > Basically I'm wondering if there are any plans to implemented named > > loops in Python, so I can tell a break command to break out of a > > specific loop in the case of nested loop

Re: Executing Python code on another computer

2010-02-19 Thread James Harris
On 19 Feb, 15:52, SiWi wrote: > Hello community, > I googled for an answer of the following problem, but I couldn't find > anything. > I've got a netbook and my fast workstation compter, which I usually > use for developing. > But I'd also like to take my netbook around the house and to develop >

Re: Available for use: Tabs management software

2010-02-07 Thread James Harris
On 7 Feb, 21:25, James Harris wrote: > In case someone else finds it useful here is a program I wrote a year > or so ago to help manage tab characters. It will convert tabs to runs > of spaces, convert runs of spaces to tabs, or count or check for tab > characters as required. It

Available for use: Tabs management software

2010-02-07 Thread James Harris
In case someone else finds it useful here is a program I wrote a year or so ago to help manage tab characters. It will convert tabs to runs of spaces, convert runs of spaces to tabs, or count or check for tab characters as required. It supports tab stops at regular and irregular positions. http:

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-12-03 Thread James Harris
On 3 Dec, 20:56, Michael Torrie wrote: > Steve Ferg wrote: > > Is there any particular reason why this might be a *bad* language- > > design idea? > > Syntactically, using braces, begin/end blocks, python white space, and > your if/elif/then/endif structures, amounts to the same thing; they are >

Re: Easy way to play single musical notes in Python

2009-11-17 Thread James Harris
On 15 Nov, 05:41, r wrote: > On Nov 14, 6:21 pm, James Harris > wrote: > > > Is there a simple way to play musical notes in Python? Something like > >   voice.play("c4") > > Uhh, tksnack is pretty easy to use IMO, see this link... > http://www.daniweb.c

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-16 Thread James Harris
On 16 Nov, 16:54, Steve Ferg wrote: > This is a question for the language mavens that I know hang out here. > It is not Python related, except that recent comparisons of Python to > Google's new Go language brought it to mind. > > NOTE that this is *not* a suggestion to change Python.  I like Pyth

Re: Easy way to play single musical notes in Python

2009-11-14 Thread James Harris
On 15 Nov, 00:12, James Harris wrote: > Is there a simple way to play musical notes in Python? Something like > >   voice.play("c4") > > to play C in octave 4 would be ideal. I included a voice parameter as > I'd like to play proper notes, not just beeps. This i

Easy way to play single musical notes in Python

2009-11-14 Thread James Harris
Is there a simple way to play musical notes in Python? Something like voice.play("c4") to play C in octave 4 would be ideal. I included a voice parameter as I'd like to play proper notes, not just beeps. This is for recognition of pitch. For example, the program plays a note and the user tries

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread James Harris
On 28 Oct, 08:58, "Alf P. Steinbach" wrote: > * tm: > > > On 28 Okt., 07:52, "Alf P. Steinbach" wrote: > >> [Cross-posted comp.programming and comp.lang.python] > > > Looking at your topic '(Python in Windows)', without taking a > > glimpse at your actual introduction, I have the following to say

Re: Annoying octal notation

2009-09-03 Thread James Harris
On 3 Sep, 15:54, Albert van der Horst wrote: > In article , > Derek Martin   wrote: > > > > > > >--W1uEbMXJ1Mj4g6TI > >Content-Type: text/plain; charset=iso-8859-1 > >Content-Disposition: inline > > >On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: > >> On Mon, 24 Aug 2009 11:21:46

Re: Annoying octal notation

2009-09-03 Thread James Harris
On 3 Sep, 15:35, Grant Edwards wrote: ... > >>> Obviously I can't speak for Ken Thompson's motivation in creating this > >>> feature, but I'm pretty sure it wasn't to save typing or space on > >>> punchcards. Even in 1969, hex was more common than octal, and yet hex > >>> values are written with

Re: Annoying octal notation

2009-09-03 Thread James Harris
On 3 Sep, 14:26, Albert van der Horst wrote: > In article <6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com>, > James Harris   wrote: > > > > > >So you are saying that Smalltalk has r where > >r is presumably for radix? That's maybe b

Re: Annoying octal notation

2009-08-27 Thread James Harris
On 27 Aug, 18:31, Ethan Furman wrote: > Steven D'Aprano wrote: > > A mistake is still a mistake even if it shared with others. > > > Treating its with a lead zero as octal was a design error when it was > > first thought up > > [snippage] > > I have to disagree with you on this one.  The computi

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread James Harris
On 24 Aug, 03:49, Dennis Lee Bieber wrote: ... > > Here's another suggested number literal format. First, keep the > > familar 0x and 0b of C and others and to add 0t for octal. (T is the > >thirdletter of octal as X is thethirdletter of hex.) The numbers > > above would be > >         The thing

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread James Harris
On 25 Aug, 01:25, Steven D'Aprano wrote: > On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: > > Sure but while I wouldn't normally want to type something as obscure as > > 32"rst" into a file of data I might want to type 0xff00 or similar. That > >

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 14:05, Mel wrote: > James Harris wrote: > > On 24 Aug, 02:19, Max Erickson wrote: > [ ... ] > >> >>> int('100', 3) > >> 9 > >> >>> int('100', 36) > >> 1296 > > > This is fine typed into the

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 09:30, Erik Max Francis wrote: > James Harris wrote: > > On 24 Aug, 09:05, Erik Max Francis wrote: > >>>> Here's another suggested number literal format. First, keep the > >>>> familar 0x and 0b of C and others and to add 0t for octal. (T

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 09:05, Erik Max Francis wrote: ... > >> Here's another suggested number literal format. First, keep the > >> familar 0x and 0b of C and others and to add 0t for octal. (T is the > >> third letter of octal as X is the third letter of hex.) The numbers > >> above would be > > >>   0b101

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 02:19, Max Erickson wrote: ... > > It can be assumed however that .9. isn't in binary? > > > That's a neat idea. But an even simpler scheme might be: > > > .octal.100 > > .decimal.100 > > .hex.100 > > .binary.100 > > .trinary.100 > > > until it gets to this anyway: > > > .thiryseximal

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 21:55, James Harris wrote: ... > >  However for floating point you > > need at least three letters because a floating point number has > > three parts: the fixed point point, the exponent base, and the > > exponent.  Now we can represent the radices of the i

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 00:16, Mel wrote: > James Harris wrote: > > I have no idea why Ada which uses the # also apparently uses it to end > > a number > > >   2#1011#, 8#7621#, 16#c26b# > > Interesting.  They do it because of this example from > <http://archive.adaic.com/

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 04:38, c...@tiac.net (Richard Harter) wrote: > On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris > > > > > > wrote: > >On 22 Aug, 10:27, David <71da...@libero.it> wrote: > > >... (snipped a discussion on languages and other systems inte

Re: Annoying octal notation

2009-08-23 Thread James Harris
On 21 Aug, 00:59, James Harris wrote: ... > > Is there some magic to make the 2.x CPython interpreter to ignore the > > annoying octal notation? > > I'd really like 012 to be "12" and not "10". > > This is (IMHO) a sad hangover from C (which to

Numeric literals in other than base 10 - was Annoying octal notation

2009-08-22 Thread James Harris
On 22 Aug, 10:27, David <71da...@libero.it> wrote: ... (snipped a discussion on languages and other systems interpreting numbers with a leading zero as octal) > > Either hexadecimal should have been 0h or octal should > > have been 0t :=) > > > I have seen the use of Q/q instead in order to make

Re: Annoying octal notation

2009-08-21 Thread James Harris
On 21 Aug, 22:18, MRAB wrote: > Piet van Oostrum wrote: > >> Derek Martin (DM) wrote: > > >> DM> I fail to see how 0O012, or even 0o012 is more intelligible than 012. > >> DM> The latter reads like a typo, and the former is virtually > >> DM> indistinguishable from 00012, O0012, or many other

Re: Annoying octal notation

2009-08-21 Thread James Harris
On 21 Aug, 20:48, Derek Martin wrote: ... > James Harris wrote: > > It maybe made sense once but this relic of the past should have been > > consigned to the waste bin of history long ago. > > Sigh.  Nonsense.  I use octal notation *every day*, for two extremely >

Re: Annoying octal notation

2009-08-20 Thread James Harris
On 20 Aug, 20:06, David <71da...@libero.it> wrote: > Hi all, > > Is there some magic to make the 2.x CPython interpreter to ignore the > annoying octal notation? > I'd really like 012 to be "12" and not "10". This is (IMHO) a sad hangover from C (which took it from B but not from BCPL which used

Re: Identifying a class type - bad practice?

2009-08-19 Thread James Harris
On 18 Aug, 21:50, Chris Rebert wrote: > On Tue, Aug 18, 2009 at 10:09 AM, James > > Harris wrote: > > I am writing some code to form a tree of nodes of different types. The > > idea is to define one class per node type such as > > > class node_type_1(node): &g

Identifying a class type - bad practice?

2009-08-18 Thread James Harris
I am writing some code to form a tree of nodes of different types. The idea is to define one class per node type such as class node_type_1(node): class node_type_2(node): etc (Class "node" would hold any common properties). When walking the tree I need to know what type of node I'm dealing

Re: Exhaustive Unit Testing

2008-11-30 Thread James Harris
On 27 Nov, 16:32, "Emanuele D'Arrigo" <[EMAIL PROTECTED]> wrote: > On Nov 27, 5:00 am, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > Refactor until your code is simple enough to unit-test effectively, then > > unit-test effectively. > > Ok, I've taken this wise suggestion on board and of cours

Re: Getting fractional part from a float without using string operations

2008-11-20 Thread James Harris
On 20 Nov, 06:01, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Yes it works for most of the cases. But it doesn't for the following case: > > >>> str(abs(int(1234567.89)-1234567.89)) > > '0.88999898' Well, that is 0.89 or about as near to it as the calculation can represent. Like other nu

Re: external program crashes when run through subprocess.popen on XP

2008-11-17 Thread James Harris
On 17 Nov, 19:15, ckkart <[EMAIL PROTECTED]> wrote: > Hi, > > on XP when starting a certain external program (plain C calculation > program which communicates via stdout/fs) from python 2.5 using > subprocess.Popen the external program crashes. It does not if started > directly from the XP command

Re: best python unit testing framwork

2008-11-15 Thread James Harris
On 15 Nov, 01:02, "Brendan Miller" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 13, 2008 at 3:54 AM, James Harris > > > > <[EMAIL PROTECTED]> wrote: > > On 11 Nov, 22:59, Brendan Miller <[EMAIL PROTECTED]> wrote: > >> What would heavy python

Re: What is the best Python GUI API?

2008-11-13 Thread James Harris
On 13 Nov, 18:59, Stef Mientki <[EMAIL PROTECTED]> wrote: > Abah Joseph wrote: > > What is the best Python GUI API? I am planning to start my first GUI > > application and I need something easy and cross platform. Qt > > applications look beautiful but I hate the license. What do you advice? > > I

Re: best python unit testing framwork

2008-11-13 Thread James Harris
On 11 Nov, 22:59, Brendan Miller <[EMAIL PROTECTED]> wrote: > What would heavy python unit testers say is the best framework? > > I've seen a few mentions that maybe the built in unittest framework > isn't that great. I've heard a couple of good things about py.test and > nose. Are there other opti

Re: etymology of "list comprehension"?

2008-11-06 Thread James Harris
On 6 Nov, 22:13, [EMAIL PROTECTED] wrote: > Chris Rebert <[EMAIL PROTECTED]> wrote: > > the term > > "comprehension" for the concept was first used in the NPL programming > > language (Wikipedia again). > > Ah, thanks... and does "comprehension" have any special computer > science meaning? Good qu

Re: Parsing a file with iterators

2008-10-17 Thread James Harris
On 17 Oct, 16:42, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > I need to parse a file, text file. The format is something like that: > > TYPE1 metadata > data line 1 > data line 2 > ... > data line N > TYPE2 metadata > data line 1 > ... > TYPE3 metadata > ... > > And so on. The type and metadata d

Re: Python program as daemon?

2008-07-28 Thread James Harris
On 25 Jul, 20:05, sturlamolden <[EMAIL PROTECTED]> wrote: > On Jul 25, 8:37 pm, Johny <[EMAIL PROTECTED]> wrote: > > > Is it possible to run a Python program as daemon? > > Thanks > > Here is an example on how to run a Python script as a Unix daemon: > > http://svn.plone.org/svn/collective/bda.daem

Re: Running commands on cisco routers using python

2008-05-21 Thread James Harris
On 19 May, 16:18, SPJ <[EMAIL PROTECTED]> wrote: > Is it possible to run specific commands on cisco router using Python? > I have to run command "show access-list" on few hundred cisco routers and get > the dump into a file. Please let me know if it is feasible and the best way > to achieve this.

Re: Portable general timestamp format, not 2038-limited

2007-07-05 Thread James Harris
On 5 Jul, 08:46, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 04 Jul 2007 22:12:46 -0400, Roy Smith <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > Astronomers use Julian Date (http://en.wikipedia.org/wiki/Julian_date) for > > calculations like this. It's a widel

Re: Portable general timestamp format, not 2038-limited

2007-07-05 Thread James Harris
On 5 Jul, 02:53, greg <[EMAIL PROTECTED]> wrote: > James Harris wrote: > > With that the time would range to +/- 9000 > > quintillion years (18 digits) > > Use the Big Bang as the epoch, and you won't have > to worry about negative timestamps. Good idea if

Re: Portable general timestamp format, not 2038-limited

2007-07-04 Thread James Harris
On 4 Jul, 22:18, "Peter J. Holzer" <[EMAIL PROTECTED]> wrote: ... > But it really doesn't matter much. If you ignore leap seconds, using > days instead of seconds is just a constant factor (in fact, the unix > timestamp ignores leap seconds, too, so it's always a constant factor). > You can't repre

Re: Portable general timestamp format, not 2038-limited

2007-07-04 Thread James Harris
On 3 Jul, 06:12, Scott David Daniels <[EMAIL PROTECTED]> wrote: ... > Inspired format: > Days since a some standard date (the TAI date may be a good such > date) expressed as fixed point 64-bit (32-bit day part, 32-bit > day-fraction part) or floating point (using Intel's double-precision, > f

Re: Portable general timestamp format, not 2038-limited

2007-07-04 Thread James Harris
On 1 Jul, 15:11, "Peter J. Holzer" <[EMAIL PROTECTED]> wrote: ... > Stick to unix timestamps but store them as a double precision floating > point number. The 53 bit mantissa gives you currently a resolution of > about 200 ns, slowly deteriorating (you will hit ms resolution in about > 280,000 year

Re: Portable general timestamp format, not 2038-limited

2007-06-25 Thread James Harris
On 25 Jun, 02:14, [EMAIL PROTECTED] (Robert Maas, see http://tinyurl.com/uh3t) wrote: > > From: James Harris <[EMAIL PROTECTED]> > > I have a requirement to store timestamps in a database. ... > > 1) subsecond resolution - milliseconds or, preferably, more detailed >

Re: Portable general timestamp format, not 2038-limited

2007-06-23 Thread James Harris
On 22 Jun, 23:49, Roger Miller <[EMAIL PROTECTED]> wrote: ... > My rule of thumb in situations like this is "When in doubt store it as > text". The one format I am pretty sure we will still be able to deal > with in 2039. Interesting. I hadn't thought about using text. It would add to the storage

Portable general timestamp format, not 2038-limited

2007-06-22 Thread James Harris
I have a requirement to store timestamps in a database. Simple enough you might think but finding a suitably general format is not easy. The specifics are 1) subsecond resolution - milliseconds or, preferably, more detailed 2) not bounded by Unix timestamp 2038 limit 3) readable in Java 4) writabl

Python music interfaces

2005-11-10 Thread James Harris
Hi, I am wanting to develop some software that a) Reads existing files of music of a few well known types b) Displays the music in traditional notation - i.e. on a stave c) Displays the same music in my own notation that I am playing with d) Allows both to be printed I guess I ca