Re: value of pi and 22/7

2016-06-17 Thread Tim Harig
On 2016-06-18, Steven D'Aprano wrote: > On Sat, 18 Jun 2016 09:49 am, Ian Kelly wrote: > >> If I tell you that the speed of light is 300,000,000 m/s, do you think >> that measurement has 9 significant digits? If you do, then you would be >> wrong. > What if the figure to nine significant digits *a

Re: Message passing syntax for objects

2013-03-18 Thread Tim Harig
On 2013-03-18, Mark Janssen wrote: > Alan Kay's idea of message-passing in Smalltalk are interesting, and > like the questioner says, never took off. My answer was that Alan > Kay's abstraction of "Everything is an object" fails because you can't > have message-passing, an I/O task, working in th

Re: Which is the best book to learn python

2011-01-25 Thread Tim Harig
On 2011-01-25, Mark Summerfield wrote: > On Jan 24, 5:09 pm, santosh hs wrote: >> Hi All, >> i am beginner to python please tell me which is the best available >> reference for beginner to start from novice > > If you want to learn Python 3 and have some prior programming > experience (in any mod

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Antoine Pitrou wrote: > On Wed, 19 Jan 2011 18:02:22 + (UTC) > Tim Harig wrote: >> Converting to a fixed byte >> representation (UTF-32/UCS-4) or separating all of the bytes for each >> UTF-8 into 6 byte containers both make it possible to simply i

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Antoine Pitrou wrote: > On Wed, 19 Jan 2011 16:03:11 + (UTC) > Tim Harig wrote: >> >> For many operations, it is just much faster and simpler to use a single >> character based container opposed to having to process an entire byte >> stream t

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Antoine Pitrou wrote: > On Wed, 19 Jan 2011 14:00:13 + (UTC) > Tim Harig wrote: >> UTF-8 has no apparent endianess if you only store it as a byte stream. >> It does however have a byte order. If you store it using multibytes >> (six bytes for all UTF

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Adam Skutt wrote: > On Jan 19, 9:00 am, Tim Harig wrote: >> That is why I say that byte streams are essentially big endian. It is >> all a matter of how you look at it. > > It is nothing of the sort. Some byte streams are in fact, little > endian: whe

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
Considering you post contained no information or evidence for your negations, I shouldn't even bother responding. I will bite once. Hopefully next time your arguments will contain some pith. On 2011-01-19, Antoine Pitrou wrote: > On Wed, 19 Jan 2011 11:34:53 + (UTC) > Tim H

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Tim Roberts wrote: > Tim Harig wrote: >>On 2011-01-17, carlo wrote: >> >>> 2- If that were true, can you point me to some documentation about the >>> math that, as Mark says, demonstrates this? >> >>It is true because UTF-8 is essent

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Tim Harig
On 2011-01-18, geremy condra wrote: > On Tue, Jan 18, 2011 at 11:05 AM, Tim Harig wrote: >> Even assuming that PyPy does actually manage to reach within a magnitude >> of C with the extra effort required to leverage two languages, why >> would I bother when I can do i

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Tim Harig
On 2011-01-18, Terry Reedy wrote: > On 1/18/2011 10:30 AM, Tim Harig wrote: > >> Whether or not you actually agree with that economic reality is >> irrelevant. Those who fund commerical projects do; and, any developement >> tool which violates the security of the source

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Tim Harig
On 2011-01-18, geremy condra wrote: > On Mon, Jan 17, 2011 at 4:02 PM, Tim Harig wrote: >> I really question that you get Java anywhere even close to C performance. >> Google reports they get within the same order of magnitude as C for >> their long-lived server processes

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Tim Harig
On 2011-01-18, Rui Maciel wrote: > Tim Harig wrote: > >> You still don't see many >> companies doing large scale internal development using Python and you >> definately don't see any doing external developement using a language >> that gives the customers

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Tim Harig
On 2011-01-18, Stefan Behnel wrote: > Tim Harig, 17.01.2011 20:41: >> One of the arguments for Python has always made is that you can optimize >> it by writing the most important parts in C. Perhaps that is a crutch >> that has held the communty back from seeking higher

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-18 Thread Tim Harig
On 2011-01-18, Steven D'Aprano wrote: > On Mon, 17 Jan 2011 19:41:54 +0000, Tim Harig wrote: > >> One of the arguments for Python has always made is that you can optimize >> it by writing the most important parts in C. Perhaps that is a crutch >> that has held t

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-17 Thread Tim Harig
On 2011-01-17, geremy condra wrote: > On Mon, Jan 17, 2011 at 1:07 PM, Tim Harig wrote: >> On 2011-01-17, geremy condra wrote: >>> On Mon, Jan 17, 2011 at 1:12 AM, Tim Harig wrote: >>>> On 2011-01-16, geremy condra wrote: >> Go is every bit of a general

Re: UTF-8 question from Dive into Python 3

2011-01-17 Thread Tim Harig
On 2011-01-17, carlo wrote: > Is it true UTF-8 does not have any "big-endian/little-endian" issue > because of its encoding method? And if it is true, why Mark (and > everyone does) writes about UTF-8 with and without BOM some chapters > later? What would be the BOM purpose then? Yes, it is true.

Re: [OT] Python like lanugages

2011-01-17 Thread Tim Harig
On 2011-01-17, John Nagle wrote: > That's been done once or twice. There's what are called "single > assignment languages". Each variable can only be assigned once. > The result looks like an imperative language but works like a functional > language. Look up "SISAL" for an example. This

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-17 Thread Tim Harig
On 2011-01-17, geremy condra wrote: > On Mon, Jan 17, 2011 at 1:12 AM, Tim Harig wrote: >> On 2011-01-16, geremy condra wrote: >> I wouldn't say Go is narrowly targeted.  It's a systems language that can >> compete in the same domain with scripting languages.  It

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-17 Thread Tim Harig
In comp.lang.python, you wrote: > Tim Harig, 17.01.2011 13:25: >> If I didn't think Python was a good language, I wouldn't be here. >> Nevertheless, it isn't a good fit for many pieces of software where a >> systems language is better suited. Reasons includ

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-17 Thread Tim Harig
On 2011-01-17, Chris Rebert wrote: > On Mon, Jan 17, 2011 at 1:12 AM, Tim Harig wrote: >> On 2011-01-16, geremy condra wrote: >>> On Sun, Jan 16, 2011 at 3:03 AM, Tim Harig wrote: > >>>> Personally, I think the time is ripe for a language that bridges the >

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-17 Thread Tim Harig
On 2011-01-17, Steven D'Aprano wrote: > On Mon, 17 Jan 2011 09:12:04 +0000, Tim Harig wrote: > >> Python has been widely used by people like us that happen to like the >> language and found ways to use it in our workplaces; but, most of the >> time it is an unoffici

Re: [OT] Python like lanugages

2011-01-17 Thread Tim Harig
On 2011-01-17, Paul Rubin wrote: > geremy condra writes: >> I agree. That does not make Go that language, and many of the choices >> made during Go's development indicate that they don't think it's that >> language either. I'm speaking specifically of its non-object model, >> lack of exceptions,

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-17 Thread Tim Harig
On 2011-01-16, geremy condra wrote: > On Sun, Jan 16, 2011 at 3:03 AM, Tim Harig wrote: >> On 2011-01-16, Steven D'Aprano wrote: >>> If the author thinks that Go is a "tried and true" (his words, not mine) >>> language "where programmers can

Re: [OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-16 Thread Tim Harig
On 2011-01-16, Steven D'Aprano wrote: > On Sun, 16 Jan 2011 09:47:35 +0000, Tim Harig wrote: > >> One of the things that gives me hope >> for Go is that it is backed by Google so I expect that it may gain some >> rather rapid adoption. It has made enough of a wake

[OT] Python like lanugages [was Re: After C++, what with Python?]

2011-01-16 Thread Tim Harig
On 2011-01-16, Paul Rubin wrote: > Tim Harig writes: >> Those who are concerned about performance should check out Go. >> Garbage collection, duck typing, and compiles to a native binary. >> It creates a great middle ground between C++ and Python. Any C and/or >>

Re: After C++, what with Python?

2011-01-16 Thread Tim Harig
On 2011-01-16, John Nagle wrote: > On 1/15/2011 10:48 PM, Aman wrote: >> @nagle Means you are suggesting me not to proceed with Python because I've >> had experience with C++? > >No, Python is quite useful, but on the slow side. If you're I/O > bound, not time critical, or otherwise not perf

Re: Developing a program to make a family tree.

2011-01-14 Thread Tim Harig
On 2011-01-14, Ata Jafari wrote: > I'm trying to develop a program like family tree maker. I have all > information, so there is no need to search on the net. This must be > something like trees. Can someone help me? I'm at the beginning. I don't know anything specific about family tree software

Re: Nested structures question

2011-01-12 Thread Tim Harig
In case you still need help: - # Set the initial values - the_number= random.randrange(100) + 1 - tries = 0 - guess = None - - # Guessing loop - while guess != the_number and tries < 7: - guess = int(raw_input("Take a guess: ")) - if guess > the_number: - print "Lower..." -

Re: Nested structures question

2011-01-12 Thread Tim Harig
On 2011-01-12, Jason Staudenmayer wrote: > Return False instead of break should work > > else: > print "You guessed it! The number was", the_number > print "And it only took you", tries, "tries!\n" > return False Since he isn't in a function, that isn't any good. He wo

Re: Nested structures question

2011-01-12 Thread Tim Harig
[wrapped lines to <80 characters per RFC 1855] On 2011-01-12, Physics Python wrote: > Is this an indentation problem then? That depends how you look at it. I was not clear from your code exactly where you wanted to handle things. > How do I update the sentinel within the secondary while loop. I

Re: Nested structures question

2011-01-12 Thread Tim Harig
On 2011-01-12, Physics Python wrote: > while guess != the_number: = > while tries > 7: > if guess > the_number: > print "Lower..." > else: > print "Higher..." > guess = int(raw_input("Take a guess:

Re: PEP: possibility of inline using of a symbol instead of "import"

2011-01-06 Thread Tim Harig
On 2011-01-06, dmitrey wrote: [re-ordered] > On Jan 6, 5:57 pm, Tim Harig wrote: >> Python doesn't require imports to be at the top of a file.  They can be >> imported at any time. >> >> > import MyModule >> > (...lots of code...) >>

Re: PEP: possibility of inline using of a symbol instead of "import"

2011-01-06 Thread Tim Harig
On 2011-01-06, dmitrey wrote: > and after several pages of code they are using somewhere, maybe only > one time, e.g. [SNIP] > It makes programs less clear, you have to scroll several pages of code > in IDE to understand what it refers to. Python doesn't require imports to be at the top of a file

Re: Google Chart API, HTTP POST request format.

2011-01-06 Thread Tim Harig
On 2011-01-06, Chris Rebert wrote: > On Wed, Jan 5, 2011 at 11:21 PM, Garland Fulton wrote: >> On Wed, Jan 5, 2011 at 7:26 PM, Tim Harig wrote: >>>    Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06) >>>    [GCC 4.4.4] on linux2 >>>    Type "help"

Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Tim Harig
On 2011-01-06, Slie wrote: [reformated to <80 columns per RFC 1855 guidelines] > I have read several examples on python post requests but I'm not sure > mine needs to be that complicated. >From the HTML example on the page you posted:

Re: Graphing API,

2011-01-05 Thread Tim Harig
On 2011-01-05, Slie wrote: > Is there a graphing API, someone suggests? You should check the archives, variations of this question get asked a lot. I use GNUplot to do my graphing. I simply pipe it commands and data through the subprocess module; but, there are libraries available for interacti

Re: User input masks - Access Style

2010-12-31 Thread Tim Harig
On 2010-12-31, flebber wrote: > On Dec 28 2010, 12:21 am, Adam Tauno Williams > wrote: >> On Sun, 2010-12-26 at 20:37 -0800, flebber wrote: >> > Is there anyay to use input masks in python? Similar to the function >> > found in access where a users input is limited to a type, length and >> > form

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Tim Harig
On 2010-12-27, Alan Meyer wrote: > On 12/26/2010 3:15 PM, Tim Harig wrote: > ... >> The problem is that XML has become such a defacto standard that it >> used automatically, without thought, even when there are much better >> alternatives available. > > I agree wi

Re: User input masks - Access Style

2010-12-26 Thread Tim Harig
On 2010-12-27, Tim Harig wrote: > ... if re.match(r'''^[0-9]{2}:[0-9]{2}:[0-9]{2}$''', timeInput) == None: [SNIP] > Currency works the same way using validating it against: > r'''[0-9]+\.[0-9]{2}''' Sorry, you need to check

Re: User input masks - Access Style

2010-12-26 Thread Tim Harig
On 2010-12-27, flebber wrote: > Is there anyay to use input masks in python? Similar to the function > found in access where a users input is limited to a type, length and > format. > > So in my case I want to ensure that numbers are saved in a basic > format. > 1) Currency so input limited to 000

Re: Trying to parse a HUGE(1gb) xml file

2010-12-26 Thread Tim Harig
On 2010-12-26, Stefan Behnel wrote: > Tim Harig, 26.12.2010 10:22: >> On 2010-12-26, Stefan Behnel wrote: >>> Tim Harig, 26.12.2010 02:05: >>>> On 2010-12-25, Nobody wrote: >>>>> On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote: >>>&g

Re: Trying to parse a HUGE(1gb) xml file

2010-12-26 Thread Tim Harig
On 2010-12-26, Stefan Behnel wrote: > Tim Harig, 26.12.2010 02:05: >> On 2010-12-25, Nobody wrote: >>> On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote: >>>> Of course, one advantage of XML is that with so much redundant text, it >>>> compresses well.

Re: Trying to parse a HUGE(1gb) xml file

2010-12-26 Thread Tim Harig
On 2010-12-26, Nobody wrote: > On Sun, 26 Dec 2010 01:05:53 +0000, Tim Harig wrote: > >>> XML is typically processed sequentially, so you don't need to create a >>> decompressed copy of the file before you start processing it. >> >> Sometimes XML is

Re: Design Ideals Goals Python 3 - Forest for the trees

2010-12-25 Thread Tim Harig
On 2010-12-26, flebber wrote: > I was hoping someone could shed some (articles, links) in regards > python 3 design ideals. I was searching guido's blog which has his > overarching view of Python from an early development perspective > http://python-history.blogspot.com/2009/01/pythons-design-phil

Re: Trying to parse a HUGE(1gb) xml file

2010-12-25 Thread Tim Harig
On 2010-12-25, Adam Tauno Williams wrote: > On Sat, 2010-12-25 at 22:34 +, Nobody wrote: >> On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote: >> XML is typically processed sequentially, so you don't need to create a >> decompressed copy of the file before you start processing it. > > Yep.

Re: Trying to parse a HUGE(1gb) xml file

2010-12-25 Thread Tim Harig
On 2010-12-25, Nobody wrote: > On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote: >>> XML works extremely well for large datasets. > One advantage it has over many legacy formats is that there are no > inherent 2^31/2^32 limitations. Many binary formats inherently cannot > support files larger t

Re: Trying to parse a HUGE(1gb) xml file

2010-12-25 Thread Tim Harig
On 2010-12-25, Steve Holden wrote: > On 12/23/2010 4:34 PM, Stefan Sonnenberg-Carstens wrote: >> For large datasets I always have huge question marks if one says "xml". >> But I don't want to start a flame war. I would agree; but, you don't always have the choice over the data format that you hav

Re: Python Web App

2010-12-23 Thread Tim Harig
On 2010-12-23, Daniel Fetchinson wrote: >> I don't personally think the web makes a good framework for highly >> interactive applications as they must work within the constraints of the >> browser and IDEs are highly interactive applications by their very nature. >> Perhaps HTML5/CSS3 will change

Re: Python Web App

2010-12-22 Thread Tim Harig
On 2010-12-23, Hidura wrote: > Ok, but you are comparing a web-based framework with a native-based > framework that use the components of the system to make all the things > that need, a web-based framewok use the resourses of the browser to Right. That is exactly what I am comparing. > make it

Re: Python Web App

2010-12-22 Thread Tim Harig
[Reordered to preserve context in bottom posting] On 2010-12-23, Hidura wrote: > 2010/12/22, Tim Harig : >> On 2010-12-22, Sean wrote: >>> Anybody know where I can find a Python Development Environment in the >>> form of a web app for use with Chrome OS. I have been

Re: Python Web App

2010-12-22 Thread Tim Harig
On 2010-12-22, Sean wrote: > Anybody know where I can find a Python Development Environment in the > form of a web app for use with Chrome OS. I have been looking for a > few days and all i have been able to find is some old discussions with > python developers talking about they will want one for

Re: Trying to parse a HUGE(1gb) xml file

2010-12-20 Thread Tim Harig
On 2010-12-20, spaceman-spiff wrote: > 0. Goal :I am looking for a specific element..there are several 10s/100s > occurrences of that element in the 1gb xml file. The contents of the xml, > is just a dump of config parameters from a packet switch( although imho, > the contents of the xml dont mat

Re: Trying to parse a HUGE(1gb) xml file

2010-12-20 Thread Tim Harig
[Wrapped to meet RFC1855 Netiquette Guidelines] On 2010-12-20, spaceman-spiff wrote: > This is a rather long post, but i wanted to include all the details & > everything i have tried so far myself, so please bear with me & read > the entire boringly long post. > > I am trying to parse a ginormous

Re: PyUNO [Was: Read / Write OpenOffice SpreadSheet ?]

2010-12-17 Thread Tim Harig
On 2010-12-17, Adam Tauno Williams wrote: > I would strongly recommend against floundering about in OOo's very > complex XML files - it is trivially easy to render a document unusable. I do it all the time and have never had a problem. I don't generate the documents from scratch; I generate a te

Re: Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread Tim Harig
On 2010-12-17, Torsten Mohr wrote: > i search for a possibility to access OpenOffoce SpreadSheets from Python > with a reasonably new version of Python. > > Can anybody point me to a package that can do this? There is no package needed to read or write the new open document files. The files are

Re: If/then style question

2010-12-16 Thread Tim Harig
On 2010-12-16, John Gordon wrote: > I like this style more, mostly because it eliminates a lot of indentation. > > However I recall one of my college CS courses stating that "one entry, > one exit" was a good way to write code, and this style has lots of exits. So, take the good intentation from

Re: Catching user switching and getting current active user from root on linux

2010-12-13 Thread Tim Harig
On 2010-12-13, mpnordland wrote: > I think I do understand multiuser systems, although I'm sorry I did > not make my self clear. Yes, I understand that there can be multiple > people logged in, and yes if you really wanted to, you could login as Apparantly you do not. There is nothing that preve

Re: Reading by positions plain text files

2010-12-12 Thread Tim Harig
On 2010-12-12, Tim Harig wrote: >> I used .seek() in this manner, but is not working. > > It is working the way it is supposed to. > If you want the absolute position in a column: > > f = open('somefile.txt', 'r').read().splitlines() >

Re: Reading by positions plain text files

2010-12-12 Thread Tim Harig
On 2010-12-12, javivd wrote: > On Dec 1, 7:15 am, Tim Harig wrote: >> On 2010-12-01, javivd wrote: >> > On Nov 30, 11:43 pm, Tim Harig wrote: >> >> encodings and how you mark line endings.  Frankly, the use of the >> >> world columns in the heade

Re: Catching user switching and getting current active user from root on linux

2010-12-11 Thread Tim Harig
Mr. Chase, I really wouldn't even bother wasting my time on this one. He asked an incomplete question to start with; so, the replies that he received were insufficient to solve his problem. He still has not provided enough information to know how to answer his question propery. He doesn't understa

Re: PEP8 compliance and exception messages ?

2010-12-05 Thread Tim Harig
On 2010-12-06, Andreas Waldenburger wrote: > On Sun, 5 Dec 2010 19:52:54 -0800 Chris Rebert wrote: > >> On Sun, Dec 5, 2010 at 7:40 PM, shearichard >> wrote: >> > Hi - PEP8 says lines should not exceed 79 characters in length >> > ( http://www.python.org/dev/peps/pep-0008/ ). >> > >> > So if you

Re: Comparison with False - something I don't understand

2010-12-05 Thread Tim Harig
On 2010-12-05, Tim Harig wrote: > On 2010-12-05, Paul Rubin wrote: >> Tim Harig writes: >>> The fact that I bothered to create classes for the dice and roles, rather >>> then simply iterating over a list of numbers, should tell you that I >>> produc

Re: Comparison with False - something I don't understand

2010-12-05 Thread Tim Harig
On 2010-12-05, Paul Rubin wrote: > Tim Harig writes: >> The fact that I bothered to create classes for the dice and roles, rather >> then simply iterating over a list of numbers, should tell you that I >> produced was of a far more flexible nature; including the support f

Re: Comparison with False - something I don't understand

2010-12-04 Thread Tim Harig
On 2010-12-05, Paul Rubin wrote: > Tim Harig writes: >> A friend was trying to derive a mathematical formula for determining >> the possibly distribution of results from rolling arbitrariy numbers >> of m n-sided dice > > http://en.wikipedia.org/wiki/Multinom

Re: Comparison with False - something I don't understand

2010-12-04 Thread Tim Harig
On 2010-12-05, Tim Harig wrote: > Another, questionable but useful use, is to ignore the complex accounting > of your position inside of a complex data structure. You can continue > moving through the structure until an exception is raised indicating > that you have reached a bou

Re: Comparison with False - something I don't understand

2010-12-04 Thread Tim Harig
On 2010-12-05, Harishankar wrote: >> Or consider this code: >> >> if y != 0: >> result = x/y >> else: >> handle_division_by_zero() >> >> >> This is also unsafe unless you know the type of y. Suppose y is an >> interval quantity that straddles zero, then division by y may fail even >> th

Re: Comparison with False - something I don't understand

2010-12-03 Thread Tim Harig
On 2010-12-03, Harishankar wrote: > On Fri, 03 Dec 2010 14:31:43 +, Mark Wooding wrote: >> In general, recovering from an exceptional condition requires three >> activities: >> >> * doing something about the condition so that the program can continue >> running; >> >> * identifying s

Re: Comparison with False - something I don't understand

2010-12-03 Thread Tim Harig
On 2010-12-04, alex23 wrote: > On Dec 3, 2:12 am, Tim Harig wrote: >> Actually, I thought that debate was resolved years ago.  I cannot think of >> a single recently developed programming language that does not provide >> exception handling mechanisms because they have been

Re: Comparison with False - something I don't understand

2010-12-03 Thread Tim Harig
On 2010-12-03, Paul Rubin wrote: > Steven D'Aprano writes: >>> There are better ways to handle errors than Python's exception system. >> I'm curious -- what ways would they be? >> I'm aware of three general exception handling techniques: ... >> What else is there? > > The Erlang approach is to ch

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-03, Harishankar wrote: > On Thu, 02 Dec 2010 16:52:57 +0000, Tim Harig wrote: > >> If you are having that issue, then you are likely placing the try blocks >> at too low of a level in your code. In general you will find that most >> systems have a gateway funct

Re: three column dataset - additions and deletions

2010-12-02 Thread Tim Harig
On 2010-12-03, MRAB wrote: > On 03/12/2010 01:42, Tim Harig wrote: >> On 2010-12-03, draeath wrote: >>> On Thu, 02 Dec 2010 22:55:53 +, Tim Harig wrote: >>> >>> Thanks for taking the time to check in on this, Tim! >>> >>>> So, basicall

Re: three column dataset - additions and deletions

2010-12-02 Thread Tim Harig
On 2010-12-03, draeath wrote: > On Thu, 02 Dec 2010 22:55:53 +0000, Tim Harig wrote: > > Thanks for taking the time to check in on this, Tim! > >> So, basically, you want to store a local copy of the data and sync it to >> the original. > In a way. I only need to stor

Re: three column dataset - additions and deletions

2010-12-02 Thread Tim Harig
On 2010-12-02, draeath wrote: > The idea is that this script will run periodically, pulling the table, > and comparing the data gathered at that run to that stored by the > previous, acting on changes made, and storing the current data back (to > be referenced against in the next invocation) S

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin wrote: > Tim Harig writes: >> I am not talking about what setjmp() has to do, I am talking about what >> *you* have to do after setjmp() returns. If you have allocated memory in >> intermediate functions and you don't have a reference

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, MRAB wrote: > On 02/12/2010 19:15, Tim Harig wrote: >> On 2010-12-02, Paul Rubin wrote: >>> Tim Harig writes: >>>>> longjmp. Alternatively you can have an auxiliary stack of cleanup >>>>> records that the longjmp handler walks thr

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin wrote: > Tim Harig writes: >>> longjmp. Alternatively you can have an auxiliary stack of cleanup >>> records that the longjmp handler walks through. Of course if you do >> >> Only if you already have pointers to *all* of the data str

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin wrote: > Tim Harig writes: >>> That's called longjmp. >> >> The problem is that you might have partially allocated data structures >> that you need to free before you can go anywhere. > > Alloca can help with that since the s

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin wrote: > MRAB writes: >> When writing the C code for the new regex module I thought that it >> would've been easier if I could've used exceptions to propagate errors >> and unwind the stack, instead of having to return an error code which >> had to be checked by the call

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar wrote: >> Actually, finer grained error handling commonly covers up bugs. If you >> want to find bugs, you want to make the program prone to crashing if a >> bug is present. It is all too easy to accidently mistake the return >> value of a function as error condition a

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar wrote: > I understand that the error vs exception debate is quite a big one in the > programming community as a whole and I don't consider myself very Actually, I thought that debate was resolved years ago. I cannot think of a single recently developed programming la

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar wrote: > I am also wary of using larger catch-all try blocks or try blocks with > multiple exception exits (which seem to make tracking subtle bugs > harder). I prefer the philosophy of dealing with errors immediately as If you are using exceptions to try to catch bu

Re: Comparison with False - something I don't understand

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar wrote: > There are some reasons why I hate exceptions but that is a different > topic. However, in short I can say that personally: > > 1. I hate try blocks which add complexity to the code when none is > needed. Try blocks make code much more unreadable in my view and

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Tim Harig
> On Wed, Dec 1, 2010 at 9:08 AM, m b wrote: >>> > if __name__ == "__main__": >>> > main() >> >> What does this mean? It is a Python idiom and a good practice. Strictly speaking it is unnecessary. Python doesn't recognize any functional initialization vector other then the start of the file. W

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Tim Harig
On 2010-12-01, goldtech wrote: > Start > Main > Global Var > Subprogram1 > Subprogram2 > Subprogram3 > End of Main > End module_wide_var = value def Subprogram1: # code def Subprogram2: # code def Subprogram3: # code def main: Subprogram1()

Re: Reading by positions plain text files

2010-11-30 Thread Tim Harig
On 2010-12-01, javivd wrote: > On Nov 30, 11:43 pm, Tim Harig wrote: >> On 2010-11-30, javivd wrote: >> >> > I have a case now in wich another file has been provided (besides the >> > database) that tells me in wich column of the file is every variable, >>

Re: Catching user switching and getting current active user from root on linux

2010-11-30 Thread Tim Harig
On 2010-11-30, mpnordland wrote: > I have situation where I need to be able to get the current active > user, and catch user switching eg user1 locks screen, leaves computer, > user2 comes, and logs on. > basically, when there is any type of user switch my script needs to > know. Well you could u

Re: Reading by positions plain text files

2010-11-30 Thread Tim Harig
On 2010-11-30, javivd wrote: > I have a case now in wich another file has been provided (besides the > database) that tells me in wich column of the file is every variable, > because there isn't any blank or tab character that separates the > variables, they are stick together. This second file sp

Re: regular expression help

2010-11-29 Thread Tim Harig
Python 3.1.2 (r312:79147, Oct 9 2010, 00:16:06) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> m="cccvlvlvlvnnnflfllffccclfnnnooo" >>> pattern = re.compile(r'ccc[^n]*nnn') >>> pattern.sub("||", m) '||flfllff||ooo' >>> # or, as

Re: regular expression help

2010-11-29 Thread Tim Harig
On 2010-11-30, goldtech wrote: > Hi, > > say: import re > m="cccvlvlvlvnnnflfllffccclfnnnooo" re.compile(r'ccc.*nnn') rtt=.sub("||",m) rtt > '||ooo' > > The regex is eating up too much. What I want is every non-overlapping > occurrence I think. > > so rtt would

Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, D'Arcy J.M. Cain wrote: > On Mon, 29 Nov 2010 19:11:18 + (UTC) > Tim Harig wrote: >> > INSERT INTO foo (name) VALUES ('xxx') >> > >> > That's the standard SQL way. >> >> Yes, it works; but, the OP asked speci

Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, D'Arcy J.M. Cain wrote: > On Mon, 29 Nov 2010 13:19:19 -0500 > Mel wrote: >> tinauser wrote: >> '''INSERT INTO foo VALUES (NULL, ?)''' > > Does this work in SQLite: > > INSERT INTO foo (name) VALUES ('xxx') > > That's the standard SQL way. Yes, it works; but, the OP asked specif

Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, tinauser wrote: > ''' > INSERT INTO 'foo' VALUES (?,?) > ''' > ,('NULL','yyy')) s/'NULL'/None/ > I get a datatype mismatch error. The sqlite module is smart enough to convert between Python types and Sqlite types. If you pass it 'NULL' it thinks you are passing it a string. Pyth

Re: How do I get the URL of the active tab in Firefox/IE/Chrome?

2010-11-28 Thread Tim Harig
On 2010-11-29, Michel Claveau - MVP wrote: > Hello! > >> The "InternetExplorer.Application" automation object doesn't contain >> any way to manipulate tabs directly > > False. Try this example: > import win32com.client > for instance in > win32com.client.Dispatch('{9BA05972-F6A8-11CF-A442-0

Re: How do I get the URL of the active tab in Firefox/IE/Chrome?

2010-11-28 Thread Tim Harig
On 2010-11-28, He Jibo wrote: > I did a lot of Googling, and get the following code. The following > code can get the url of the first tab in internet explorer. My > question is, how can I get the url of the current active tab? Thanks. It would be beneficial to know what your ultimate goal is. T

Re: remote control firefox with python

2010-11-28 Thread Tim Harig
On 2010-11-28, News123 wrote: > Thanks in advance for any pointers ideas. google XPCOM -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie subprocess question

2010-11-25 Thread Tim Harig
On 2010-11-25, Hugo Léveillé wrote: > I'm starting various application using subprocess.Popen without any > problem. The problem is with application inside "Program Files". It > looks like subprocess is stopping the application string after > "Program". I tried puting the programe name inside doub

Re: How to run an EXE, with argument, capture output value

2010-11-19 Thread Tim Harig
C:\Documents and Settings\Tim Harig\My Documents\autoCalc>dir Volume in drive C has no label. Volume Serial Number is 30D9-35E0 Directory of C:\Documents and Settings\Tim Harig\My Documents\autoCalc 11/19/2010 12:20 PM . 11/19/2010 12:20 PM .. 11/19/2010 12:19

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread Tim Harig
On 2010-11-18, noydb wrote: > On Nov 18, 5:22 pm, Tim Harig wrote: >> On 2010-11-18, noydb wrote: > Okay, I see now. I did run it to start with 0 -- still same result no > matter if 0 or -1. > So, what is result (stdout, using [0]) in this case? (yes, i know I > sound

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread Tim Harig
On 2010-11-18, Jean-Michel Pichavant wrote: > Tim Harig wrote: >> If you are not already, I would highly suggest using Python3 with the >> subprocess module: > Suggesting subprocess is a good idea, *highly* sug

  1   2   3   >