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

Re: Message passing syntax for objects

2013-03-18 Thread Tim Harig
On 2013-03-18, Mark Janssen dreamingforw...@gmail.com 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

Re: Which is the best book to learn python

2011-01-25 Thread Tim Harig
On 2011-01-25, Mark Summerfield l...@qtrac.plus.com wrote: On Jan 24, 5:09 pm, santosh hs santosh.tron...@gmail.com 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

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Tim Roberts t...@probo.com wrote: Tim Harig user...@ilthio.net wrote: On 2011-01-17, carlo syseng...@gmail.com 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 essentially an 8

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 solip...@pitrou.net wrote: On Wed, 19 Jan 2011 11:34:53 + (UTC) Tim

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Adam Skutt ask...@gmail.com wrote: On Jan 19, 9:00 am, Tim Harig user...@ilthio.net 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: when

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Antoine Pitrou solip...@pitrou.net wrote: On Wed, 19 Jan 2011 14:00:13 + (UTC) Tim Harig user...@ilthio.net 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

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Antoine Pitrou solip...@pitrou.net wrote: On Wed, 19 Jan 2011 16:03:11 + (UTC) Tim Harig user...@ilthio.net 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

Re: UTF-8 question from Dive into Python 3

2011-01-19 Thread Tim Harig
On 2011-01-19, Antoine Pitrou solip...@pitrou.net wrote: On Wed, 19 Jan 2011 18:02:22 + (UTC) Tim Harig user...@ilthio.net 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

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 steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 17 Jan 2011 19:41:54 +, 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

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

2011-01-18 Thread Tim Harig
On 2011-01-18, Stefan Behnel stefan...@behnel.de 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 performance

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

2011-01-18 Thread Tim Harig
On 2011-01-18, Rui Maciel rui.mac...@gmail.com 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 full access to the source code

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

2011-01-18 Thread Tim Harig
On 2011-01-18, geremy condra debat...@gmail.com wrote: On Mon, Jan 17, 2011 at 4:02 PM, Tim Harig user...@ilthio.net 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

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

2011-01-18 Thread Tim Harig
On 2011-01-18, Terry Reedy tjre...@udel.edu 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 is going to find

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

2011-01-18 Thread Tim Harig
On 2011-01-18, geremy condra debat...@gmail.com wrote: On Tue, Jan 18, 2011 at 11:05 AM, Tim Harig user...@ilthio.net 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

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

2011-01-17 Thread Tim Harig
On 2011-01-16, geremy condra debat...@gmail.com wrote: On Sun, Jan 16, 2011 at 3:03 AM, Tim Harig user...@ilthio.net wrote: On 2011-01-16, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If the author thinks that Go is a tried and true (his words, not mine) language where

Re: [OT] Python like lanugages

2011-01-17 Thread Tim Harig
On 2011-01-17, Paul Rubin no.email@nospam.invalid wrote: geremy condra debat...@gmail.com 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

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 steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 17 Jan 2011 09:12:04 +, 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 unofficial

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

2011-01-17 Thread Tim Harig
On 2011-01-17, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 17, 2011 at 1:12 AM, Tim Harig user...@ilthio.net wrote: On 2011-01-16, geremy condra debat...@gmail.com wrote: On Sun, Jan 16, 2011 at 3:03 AM, Tim Harig user...@ilthio.net wrote: snip Personally, I think the time is ripe

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 include ease of distribution without an interpeter

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

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

Re: [OT] Python like lanugages

2011-01-17 Thread Tim Harig
On 2011-01-17, John Nagle na...@animats.com 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

Re: UTF-8 question from Dive into Python 3

2011-01-17 Thread Tim Harig
On 2011-01-17, carlo syseng...@gmail.com 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?

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

2011-01-17 Thread Tim Harig
On 2011-01-17, geremy condra debat...@gmail.com wrote: On Mon, Jan 17, 2011 at 1:07 PM, Tim Harig user...@ilthio.net wrote: On 2011-01-17, geremy condra debat...@gmail.com wrote: On Mon, Jan 17, 2011 at 1:12 AM, Tim Harig user...@ilthio.net wrote: On 2011-01-16, geremy condra debat

Re: After C++, what with Python?

2011-01-16 Thread Tim Harig
On 2011-01-16, John Nagle na...@animats.com 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

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

2011-01-16 Thread Tim Harig
On 2011-01-16, Paul Rubin no.email@nospam.invalid wrote: Tim Harig user...@ilthio.net 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

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 steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 16 Jan 2011 09:47:35 +, 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

Re: Developing a program to make a family tree.

2011-01-14 Thread Tim Harig
On 2011-01-14, Ata Jafari a.j.romani...@gmail.com 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

Re: Nested structures question

2011-01-12 Thread Tim Harig
On 2011-01-12, Physics Python physicsandpyt...@gmail.com wrote: while guess != the_number: = while tries 7: if guess the_number: print Lower... else: print Higher... guess =

Re: Nested structures question

2011-01-12 Thread Tim Harig
[wrapped lines to 80 characters per RFC 1855] On 2011-01-12, Physics Python physicsandpyt...@gmail.com 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

Re: Nested structures question

2011-01-12 Thread Tim Harig
On 2011-01-12, Jason Staudenmayer jas...@adventureaquarium.com 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

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... - elif

Re: Google Chart API, HTTP POST request format.

2011-01-06 Thread Tim Harig
On 2011-01-06, Chris Rebert c...@rebertia.com wrote: On Wed, Jan 5, 2011 at 11:21 PM, Garland Fulton stacks...@gmail.com wrote: On Wed, Jan 5, 2011 at 7:26 PM, Tim Harig user...@ilthio.net wrote:    Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)    [GCC 4.4.4] on linux2    Type help

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

2011-01-06 Thread Tim Harig
On 2011-01-06, dmitrey dmitrey.kros...@scipy.org 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

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

2011-01-06 Thread Tim Harig
On 2011-01-06, dmitrey dmitrey.kros...@scipy.org wrote: [re-ordered] On Jan 6, 5:57 pm, Tim Harig user...@ilthio.net 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...) r = MyModule.myFunc

Re: Graphing API,

2011-01-05 Thread Tim Harig
On 2011-01-05, Slie stacks...@gmail.com 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

Re: Google Chart API, HTTP POST request format.

2011-01-05 Thread Tim Harig
On 2011-01-06, Slie stacks...@gmail.com 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: form

Re: User input masks - Access Style

2010-12-31 Thread Tim Harig
On 2010-12-31, flebber flebber.c...@gmail.com wrote: On Dec 28 2010, 12:21 am, Adam Tauno Williams awill...@whitemice.org 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

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

2010-12-27 Thread Tim Harig
On 2010-12-27, Alan Meyer amey...@yahoo.com 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 with you but, as you say

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

2010-12-26 Thread Tim Harig
On 2010-12-26, Nobody nob...@nowhere.com wrote: On Sun, 26 Dec 2010 01:05:53 +, 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 processed sequentially. When the markup

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

2010-12-26 Thread Tim Harig
On 2010-12-26, Stefan Behnel stefan...@behnel.de wrote: Tim Harig, 26.12.2010 02:05: On 2010-12-25, Nobodynob...@nowhere.com 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. We typically see

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

2010-12-26 Thread Tim Harig
On 2010-12-26, Stefan Behnel stefan...@behnel.de 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: Of course, one advantage of XML is that with so much

Re: User input masks - Access Style

2010-12-26 Thread Tim Harig
On 2010-12-27, flebber flebber.c...@gmail.com 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

Re: User input masks - Access Style

2010-12-26 Thread Tim Harig
On 2010-12-27, Tim Harig user...@ilthio.net 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 to make sure that there are no trailing characters

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

2010-12-25 Thread Tim Harig
On 2010-12-25, Steve Holden st...@holdenweb.com 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

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

2010-12-25 Thread Tim Harig
On 2010-12-25, Nobody nob...@nowhere.com 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

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

2010-12-25 Thread Tim Harig
On 2010-12-25, Adam Tauno Williams awill...@whitemice.org 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

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

2010-12-25 Thread Tim Harig
On 2010-12-26, flebber flebber.c...@gmail.com 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

Re: Python Web App

2010-12-23 Thread Tim Harig
On 2010-12-23, Daniel Fetchinson fetchin...@googlemail.com 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

Re: Python Web App

2010-12-22 Thread Tim Harig
On 2010-12-22, Sean secr...@gmail.com 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

Re: Python Web App

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

Re: Python Web App

2010-12-22 Thread Tim Harig
On 2010-12-23, Hidura hid...@gmail.com 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

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 ashish.mak...@gmail.com 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

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

2010-12-20 Thread Tim Harig
On 2010-12-20, spaceman-spiff ashish.mak...@gmail.com 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

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

2010-12-17 Thread Tim Harig
On 2010-12-17, Adam Tauno Williams awill...@whitemice.org 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

Re: If/then style question

2010-12-16 Thread Tim Harig
On 2010-12-16, John Gordon gor...@panix.com 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

Re: Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread Tim Harig
On 2010-12-17, Torsten Mohr tm...@s.netic.de 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.

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

2010-12-13 Thread Tim Harig
On 2010-12-13, mpnordland mpnordl...@gmail.com 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

Re: Reading by positions plain text files

2010-12-12 Thread Tim Harig
On 2010-12-12, javivd javiervan...@gmail.com wrote: On Dec 1, 7:15 am, Tim Harig user...@ilthio.net wrote: On 2010-12-01, javivd javiervan...@gmail.com wrote: On Nov 30, 11:43 pm, Tim Harig user...@ilthio.net wrote: encodings and how you mark line endings.  Frankly, the use of the world

Re: Reading by positions plain text files

2010-12-12 Thread Tim Harig
On 2010-12-12, Tim Harig user...@ilthio.net 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() for column in f

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

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

2010-12-05 Thread Tim Harig
On 2010-12-05, Paul Rubin no.em...@nospam.invalid wrote: Tim Harig user...@ilthio.net 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

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

2010-12-05 Thread Tim Harig
On 2010-12-05, Tim Harig user...@ilthio.net wrote: On 2010-12-05, Paul Rubin no.em...@nospam.invalid wrote: Tim Harig user...@ilthio.net 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

Re: PEP8 compliance and exception messages ?

2010-12-05 Thread Tim Harig
On 2010-12-06, Andreas Waldenburger use...@geekmail.invalid wrote: On Sun, 5 Dec 2010 19:52:54 -0800 Chris Rebert c...@rebertia.com wrote: On Sun, Dec 5, 2010 at 7:40 PM, shearichard shearich...@gmail.com wrote: Hi - PEP8 says lines should not exceed 79 characters in length (

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

2010-12-04 Thread Tim Harig
On 2010-12-05, Harishankar v.harishan...@gmail.com 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

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

2010-12-04 Thread Tim Harig
On 2010-12-05, Tim Harig user...@ilthio.net 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

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

2010-12-04 Thread Tim Harig
On 2010-12-05, Paul Rubin no.em...@nospam.invalid wrote: Tim Harig user...@ilthio.net 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

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

2010-12-03 Thread Tim Harig
On 2010-12-03, Paul Rubin no.em...@nospam.invalid wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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: ...

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

2010-12-03 Thread Tim Harig
On 2010-12-04, alex23 wuwe...@gmail.com wrote: On Dec 3, 2:12 am, Tim Harig user...@ilthio.net 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

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

2010-12-03 Thread Tim Harig
On 2010-12-03, Harishankar v.harishan...@gmail.com 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; *

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar v.harishan...@gmail.com 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

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar v.harishan...@gmail.com 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

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar v.harishan...@gmail.com 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

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Harishankar v.harishan...@gmail.com 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

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin no.em...@nospam.invalid wrote: MRAB pyt...@mrabarnett.plus.com 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

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin no.em...@nospam.invalid wrote: Tim Harig user...@ilthio.net 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 stack stuff gets

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin no.em...@nospam.invalid wrote: Tim Harig user...@ilthio.net 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

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

2010-12-02 Thread Tim Harig
On 2010-12-02, MRAB pyt...@mrabarnett.plus.com wrote: On 02/12/2010 19:15, Tim Harig wrote: On 2010-12-02, Paul Rubinno.em...@nospam.invalid wrote: Tim Hariguser...@ilthio.net writes: longjmp. Alternatively you can have an auxiliary stack of cleanup records that the longjmp handler walks

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

2010-12-02 Thread Tim Harig
On 2010-12-02, Paul Rubin no.em...@nospam.invalid wrote: Tim Harig user...@ilthio.net 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: three column dataset - additions and deletions

2010-12-02 Thread Tim Harig
On 2010-12-02, draeath draeath.spamt...@gmail.com 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

Re: three column dataset - additions and deletions

2010-12-02 Thread Tim Harig
On 2010-12-03, draeath draeath.spamt...@gmail.com wrote: On Thu, 02 Dec 2010 22:55:53 +, 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 store one copy

Re: three column dataset - additions and deletions

2010-12-02 Thread Tim Harig
On 2010-12-03, MRAB pyt...@mrabarnett.plus.com wrote: On 03/12/2010 01:42, Tim Harig wrote: On 2010-12-03, draeathdraeath.spamt...@gmail.com wrote: On Thu, 02 Dec 2010 22:55:53 +, Tim Harig wrote: Thanks for taking the time to check in on this, Tim! So, basically, you want to store

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

2010-12-02 Thread Tim Harig
On 2010-12-03, Harishankar v.harishan...@gmail.com wrote: On Thu, 02 Dec 2010 16:52:57 +, 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 function

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

2010-12-01 Thread Tim Harig
On 2010-12-01, goldtech goldt...@worldpost.com 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:

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 sn...@hotmail.se 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.

Re: Reading by positions plain text files

2010-11-30 Thread Tim Harig
On 2010-11-30, javivd javiervan...@gmail.com 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.

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

2010-11-30 Thread Tim Harig
On 2010-11-30, mpnordland mpnordl...@gmail.com 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.

Re: Reading by positions plain text files

2010-11-30 Thread Tim Harig
On 2010-12-01, javivd javiervan...@gmail.com wrote: On Nov 30, 11:43 pm, Tim Harig user...@ilthio.net wrote: On 2010-11-30, javivd javiervan...@gmail.com 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

Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, tinauser tinau...@libero.it 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

Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, D'Arcy J.M. Cain da...@druid.net wrote: On Mon, 29 Nov 2010 13:19:19 -0500 Mel mwil...@the-wire.com 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;

Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, D'Arcy J.M. Cain da...@druid.net wrote: On Mon, 29 Nov 2010 19:11:18 + (UTC) Tim Harig user...@ilthio.net wrote: INSERT INTO foo (name) VALUES ('xxx') That's the standard SQL way. Yes, it works; but, the OP asked specifically to be able to enter all of the field

Re: regular expression help

2010-11-29 Thread Tim Harig
On 2010-11-30, goldtech goldt...@worldpost.com 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 be:

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, assuming that the middle

Re: remote control firefox with python

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

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 hej...@gmail.com 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

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 enleverlesx_xx...@xmclavxeaux.com.invalid 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

Re: Newbie subprocess question

2010-11-25 Thread Tim Harig
On 2010-11-25, Hugo Léveillé hu...@fastmail.net 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

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\autoCalcdir 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 PMDIR . 11/19/2010 12:20 PMDIR .. 11/19/2010 12

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

2010-11-18 Thread Tim Harig
On 2010-11-18, noydb jenn.du...@gmail.com wrote: import subprocess pig = subprocess.Popen([C:\Halls\hallbig2.exe], stdin=subprocess.PIPE, stdout=subprocess.PIPE) result = pig.communicate(input='C:\Halls\Input\Ea39j.txt')[-1] #I need to capture the, what I think is the, last output From the

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

2010-11-18 Thread Tim Harig
On 2010-11-18, Jean-Michel Pichavant jeanmic...@sequans.com 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

  1   2   3   >