Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Nis Jørgensen
Neil Cerutti skrev: > Mostly you can use the default 'excel' dialect and be quite > happy, since Excel is the main reason anybody still cares about > this unecessarily hard to parse (it requires more than one > character of lookahead for no reason except bad design) data > format. I knew there ha

Re: Proposal: s1.intersects(s2)

2007-07-05 Thread Christoph Zwerschke
Steven D'Aprano wrote: > I'm not a professional set theorist, but in 15-odd years of studying and > teaching maths I've never come across mathematicians using intersect as a > verb except as informal short-hand. I often say "North Street and South > Street don't intersect", but "the intersection of

Re: Callback scoping

2007-07-05 Thread Marc 'BlackJack' Rintsch
On Thu, 05 Jul 2007 19:14:07 +, Dan wrote: > So, I think I understand what python's scoping is doing in the > following situation: x = [ lambda: ind for ind in range(10) ] > > […] > > But, I'm wondering what is the easiest (and/or most pythonic) way to > get the behavior I want? (If you

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 only they didn't keep shifting the femtos

Re: Re-raising exceptions with modified message

2007-07-05 Thread Neil Cerutti
On 2007-07-05, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> You may need the traceback module to get at the error message, if >> trying to read e.message can fail. >> >> Something like this mess here: ;) >> >>... >>except Exception, e: >> etype, evalue, etb

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: Reversing a string

2007-07-05 Thread Martin Durkin
[EMAIL PROTECTED] (Alex Martelli) wrote in news:[EMAIL PROTECTED]: > Aahz <[EMAIL PROTECTED]> wrote: >> I would agree with people who claim >> that you should memorize most of the built-in functions (which is >> precisely why there is a high barrier to adding more built-in >> functions). > > I

Re: IDEs for COM scripting: C# v. Python v. Iron Python v. JPython

2007-07-05 Thread MC
Hi! > No. The IDIspatch-interface explicitely lists what methods with what > arguments it has. So code completion is possible there as well. Sorry, I think different. In VS, assists use TLB for find methods & arguments. Dynamic-server can't have TLB. Other way for verify : try a Makepy on a COM

Re: Callback scoping

2007-07-05 Thread Nick Craig-Wood
Dan <[EMAIL PROTECTED]> wrote: > So, I think I understand what python's scoping is doing in the > following situation: > >>> x = [ lambda: ind for ind in range(10) ] > > But, I'm wondering what is the easiest (and/or most pythonic) way to > get the behavior I want? (If you haven't guessed, I w

XQuery module for Python

2007-07-05 Thread bsneddon
Does anyone know of a module for Python XML that includes XQuery? http://www.w3.org/XML/Query/ It seem like it would be very useful. Is there a down side to XQuery that has prevented it from being incorporated into some of the Python XML offerings? I have googled this some and have not seen answer

Re: Re-raising exceptions with modified message

2007-07-05 Thread Kay Schluehr
On Jul 5, 3:53 pm, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > What is the best way to re-raise any exception with a message > supplemented with additional information (e.g. line number in a > template)? Let's say for simplicity I just want to add "sorry" to every > exception message. My naive

Re: Portable general timestamp format, not 2038-limited

2007-07-05 Thread Ilya Zakharevich
[A complimentary Cc of this posting was sent to James Harris <[EMAIL PROTECTED]>], who wrote in article <[EMAIL PROTECTED]>: > 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 t

Re: Portable general timestamp format, not 2038-limited

2007-07-05 Thread Wojtek
James Harris wrote : > 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 > > 2) not bounded by Unix timestamp 2038 limit I use the Java Calendar class for storing dates, which as I understa

Re: Python's "only one way to do it" philosophy isn't good?

2007-07-05 Thread John Nagle
Falcolas wrote: > On Jul 5, 10:30 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > >>I don't think anyone has suggested that. Let me be clear about *my* >>position: When you need to ensure that a file has been closed by a >>certain time, you need to be explicit about it. When you don't care, >>just

Re: Python's "only one way to do it" philosophy isn't good?

2007-07-05 Thread Douglas Alan
"Chris Mellon" <[EMAIL PROTECTED]> writes: >> Some people here have been arguing that all code should use "with" to >> ensure that the files are closed. But this still wouldn't solve the >> problem of the large data structures being left around for an >> arbitrary amount of time. > I don't think

Re: Re-raising exceptions with modified message

2007-07-05 Thread Christoph Zwerschke
Kay Schluehr wrote: > If you are sure that the exception isn't caught on another level just > use the following showtraceback() function, manipulate it's output > slightly and terminate your program with sys.exit() That's what I want to avoid. In my case the error is displayed and evaluated in a

Re: Extracting arbitrary amounts of data from a dictionary.

2007-07-05 Thread Jyotirmoy Bhattacharya
On Jul 6, 12:31 am, [EMAIL PROTECTED] wrote: > I had nothing better to do, so I thought I would make a database that > contained the songs played on the internet radio station I listen to > (hardradio.com) so I could see how many differents songs/artists they > played. > So I end up with a the num

Re: The best platform and editor for Python

2007-07-05 Thread Kay Schluehr
On Jul 5, 7:18 pm, kimiraikkonen <[EMAIL PROTECTED]> wrote: > I just wanted a simple answer to my simple question, however topic has > messed up. Think questioner as a beginner and use more understandable > terms to help :) > > Thanks. The problem is simply that the Python community has failed in

Re: Extracting arbitrary amounts of data from a dictionary.

2007-07-05 Thread Jyotirmoy Bhattacharya
On Jul 6, 2:21 am, Jyotirmoy Bhattacharya <[EMAIL PROTECTED]> wrote: > On Jul 6, 12:31 am, [EMAIL PROTECTED] wrote: > > > > > I had nothing better to do, so I thought I would make a database that > > contained the songs played on the internet radio station I listen to > > (hardradio.com) so I could

Re: list.append not working?

2007-07-05 Thread Wildemar Wildenburger
7stud wrote: > Hardy wrote: > >> I experience a problem with append(). This is a part of my code: >> >> for entity in temp: >> md['module']= entity.addr.get('module') >> md['id']=entity.addr.get('id') >> md['type']=entity.addr.get('type') >>

Re: Re-raising exceptions with modified message

2007-07-05 Thread Christoph Zwerschke
Seems that no simple solution exists, so for now, I will be using something like this: class PoliteException(Exception): def __init__(self, e): self._e = e def __getattr__(self, name): return getattr(self._e, name) def __str__(self): if isinstance(self._e,

Re: need help with converting c function to python function

2007-07-05 Thread John Machin
On Jul 6, 3:32 am, nephish <[EMAIL PROTECTED]> wrote: > hello all, > > i have a c function from some modbus documentation that i need to > translate into python. > > it looks like this: > > unsigned short CRC16(puchMsg, usDataLen) > unsigned char *puchMsg ; > unsigned short usDataLen ; > { >uns

Re: list.append not working?

2007-07-05 Thread Wildemar Wildenburger
Abhishek Jain wrote: > with every iteration your previous values are overwritten ('md' is a > dictionary) so thats why your are observing this ouput.. > > check if the following patch solves your problem > > for entity in temp: > md['module']= entity.addr.get('module') > m

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Wildemar Wildenburger
Nis Jørgensen wrote: > Neil Cerutti skrev: > > >> Mostly you can use the default 'excel' dialect and be quite >> happy, since Excel is the main reason anybody still cares about >> this unecessarily hard to parse (it requires more than one >> character of lookahead for no reason except bad design

Embedded For Loop With No Data

2007-07-05 Thread rshepard
Haven't found an answer to my question in the books and other docs I have available, so I am asking here. I have three lists of data retrieved from database tables. I want to cycle through all three lists using nested FOR loops. What is the behavior if there are no data in the list used in the

Re: Re-raising exceptions with modified message

2007-07-05 Thread Alex Popescu
On Jul 6, 12:21 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: > > If you are sure that the exception isn't caught on another level just > > use the following showtraceback() function, manipulate it's output > > slightly and terminate your program with sys.exit() > > That'

Re: The best platform and editor for Python

2007-07-05 Thread Alex Popescu
On Jul 5, 5:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: > > On Jul 3, 8:12 pm, [EMAIL PROTECTED] (Cameron Laird) wrote: > > > > Python is simply easier than C++; you might > > > well find that a debugger, for example, doesn't feel as essential > > > as it is for you

Re: MethodType/FunctionType and decorators

2007-07-05 Thread Alex Popescu
On Jul 5, 5:01 pm, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Jul 5, 3:17 pm, Alex Popescu <[EMAIL PROTECTED]> > wrote: > > > The true story is that > > while working on Groovy (I am a committer on this dynlang meant to run > > on the Java VM:http://groovy.codehaus.org) and reading some Pyth

Re: Re-raising exceptions with modified message

2007-07-05 Thread Christoph Zwerschke
Sorry for the soliloquy, but what I am really using is the following so that the re-raised excpetion has the same type: def PoliteException(e): class PoliteException(e.__class__): def __init__(self, e): self._e = e def __getattr__(self, name): retu

Re: The best platform and editor for Python

2007-07-05 Thread Jason
On Jul 1, 1:10 pm, kimiraikkonen <[EMAIL PROTECTED]> wrote: > Hi, > For experienced with Pyhton users, which developing software and > enviroment would you suggest for Pyhton programming? Compiler+Editor > +Debugger. That would depend on what platform(s) you would be developing on, what developmen

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread John Machin
On Jul 6, 5:31 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Mostly you can use the default 'excel' dialect and be quite > happy, since Excel is the main reason anybody still cares about > this unecessarily hard to parse (it requires more than one > character of lookahead for no reason except bad

Re: deliberate versus os socket timeout

2007-07-05 Thread John J. Lee
Robin Becker <[EMAIL PROTECTED]> writes: > While messing about with some deliberate socket timeout code I got an > unexpected timeout after 20 seconds when my code was doing > socket.setdefaulttimeout(120). > > Closer inspection revealed that this error in fact seemed to come from > the os (in thi

Re: Embedded For Loop With No Data

2007-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2007 22:03:59 +, rshepard wrote: > Haven't found an answer to my question in the books and other docs I have > available, so I am asking here. > > I have three lists of data retrieved from database tables. I want to cycle > through all three lists using nested FOR loops. Wh

None returned?

2007-07-05 Thread robinsiebler
I can't figure out -what- is going wrong here. When the code reaches the 'return' line, there is data to be returned, but when it exits out to the calling function, 'None' is returned! import mx.DateTime def get_weeks(weeks, year, dates, date_list={}): if dates.has_key(year): date_li

Re: The best platform and editor for Python

2007-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2007 14:13:29 -0700, Kay Schluehr wrote: > On Jul 5, 7:18 pm, kimiraikkonen <[EMAIL PROTECTED]> wrote: >> I just wanted a simple answer to my simple question, however topic has >> messed up. Think questioner as a beginner and use more understandable >> terms to help :) >> >> Thanks.

Htmllib help

2007-07-05 Thread axjacob
I am using html and formater as shown below. They are used as part of a larger program. Even though I don't use any print statements, the htmllib seems to be throwing parts of the html page on to the standard out(my screen in this case). Is there a way to disable the output? import htmllib w

A different debugger

2007-07-05 Thread M Friedeman
Try a different type of debugger. This one does not need you to set breakpoints. Run the program once and after that everything is available to you. You then just scroll to any line you're interested in and click the variable. It requires Firefox and Python 2.5. http://codeinvestigator.googlepa

Re: None returned?

2007-07-05 Thread Kelvie Wong
On 7/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I can't figure out -what- is going wrong here. When the code reaches > the 'return' line, there is data to be returned, but when it exits out > to the calling function, 'None' is returned! > > import mx.DateTime > > def get_weeks(weeks, yea

Re: None returned?

2007-07-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I can't figure out -what- is going wrong here. When the code reaches > the 'return' line, there is data to be returned, but when it exits out > to the calling function, 'None' is returned! > > import mx.DateTime > > def get_weeks(weeks, year, dates, date_list={}): >

Re: (EMBEDDING) Can't get python error message

2007-07-05 Thread Gabriel Genellina
En Thu, 05 Jul 2007 08:47:57 -0300, <[EMAIL PROTECTED]> escribió: > I run this string to produce a error "x+1" > > PyRun_SimpleStringFlags() return -1, so that i know this is a script > with error inside... > > but now - how can i get error message? Simply, you can't. From http://docs.python.org/

Re: Python's "only one way to do it" philosophy isn't good?

2007-07-05 Thread Lenard Lindstrom
Falcolas wrote: >> f = some_file() #maybe it's the file store for a database implementation >> f.write('a bunch of stuff') >> del f >> #insert code that assumes f is closed. >> >> This is the sort of code that I warn against writing. >> >> f = some_file() >> with f: >> f.write("a bunch of stuff")

Debugger

2007-07-05 Thread James Matthews
Can anyone please tell me of a good debugger that can debug threads. My issue is that i have a program that is crashing only under certain threads but others are fine. And when i do it without threads it runs fine! -- http://www.goldwatches.com/watches.asp?Brand=14 http://www.jewelerslounge.com -

Re: Proposal: s1.intersects(s2)

2007-07-05 Thread David Abrahams
on Thu Jul 05 2007, Christoph Zwerschke wrote: > Steven D'Aprano wrote: >> I'm not a professional set theorist, but in 15-odd years of studying and >> teaching maths I've never come across mathematicians using intersect as a >> verb except as informal short-hand. I often say "North Street and So

Re: Re-raising exceptions with modified message

2007-07-05 Thread Christoph Zwerschke
Alex Popescu wrote: > Probably the simplest solution would be to create a new exception and > wrapping the old one and the additional info. Unfortunately, this > may have a huge impact on 3rd party code that was catching the > original exception. So, I think you should create an utility > factor

Re: Htmllib help

2007-07-05 Thread Gabriel Genellina
En Thu, 05 Jul 2007 20:23:08 -0300, <[EMAIL PROTECTED]> escribió: > I am using html and formater as shown below. They are used as part of a > larger program. > > Even though I don't use any print statements, the htmllib seems to be > throwing parts of the html page on to the standard out(my sc

Question about Making a Diskless Python Enviroment

2007-07-05 Thread [EMAIL PROTECTED]
Hi everyone We are making a disk less workstation environment which support python.We use PXE DHCP TFTP to boot up disk less system.There are three choices as i know to set up a python environment for diskless system. First Solution, Use a initrd image with everything inside as the root file sy

Interfacing python program to C++ program instance

2007-07-05 Thread Jim Langston
Windows. Situation: Using a Python program called OpenRPG. I have a program that displays form data (a character sheet) in C++. I am able in the C++ program to build a string and copy it into the clipboard, then paste it into the input in the running Python program. I would like to somehow au

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-05 Thread George Sakkis
On Jul 5, 3:24 pm, Donn Cave <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > However, it's interesting to consider the work that sometimes needs to > > go in to specify data structures in some languages - thinking of ML > > and friends, a

Re: MethodType/FunctionType and decorators

2007-07-05 Thread Alex Martelli
Alex Popescu <[EMAIL PROTECTED]> wrote: ... > frameworks (TestNG is not a unit testing framework, > but a full flavored testing framework that fits perfectly functional > testing, integration testing, and with some of the > very advanced features even performance and load testing). Nice! Does

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Alex Martelli
Neil Cerutti <[EMAIL PROTECTED]> wrote: > Besides, a string is an excellent epresentation for a zip code, > since arithmetic upon them is unthinkable. Absolutely! Excel, unless you remedied that later with a column operation, would turn some East Coast zipcodes into 3- and 4-digit numbers (dropp

Re: The best platform and editor for Python

2007-07-05 Thread Alex Martelli
Kay Schluehr <[EMAIL PROTECTED]> wrote: ... > half of the community is happy with Emacs and the other half wants to > program in a VS-like environment, neither consensus nor progress has Calling all vi/vim users (and we'll heartily appreciate the support of TextMate fans, BBEdit ones, etc, etc)

urllib to cache 301 redirections?

2007-07-05 Thread O.R.Senthil Kumaran
Hi, There is an Open Tracker item against urllib2 library python.org/sf/735515 which states that. urllib / urllib2 should cache the results of 301 (permanent) redirections. This shouldn't break anything, since it's just an internal optimisation from one point of view -- but it's also what the RFC (

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Nis Jørgensen
Wildemar Wildenburger skrev: > Nis Jørgensen wrote: >> Neil Cerutti skrev: >> >> >>> Mostly you can use the default 'excel' dialect and be quite >>> happy, since Excel is the main reason anybody still cares about >>> this unecessarily hard to parse (it requires more than one >>> character of look

Re: The best platform and editor for Python

2007-07-05 Thread Kay Schluehr
On Jul 6, 12:13 am, Alex Popescu <[EMAIL PROTECTED]> wrote: > On Jul 5, 5:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > Kay Schluehr wrote: > > > On Jul 3, 8:12 pm, [EMAIL PROTECTED] (Cameron Laird) wrote: > > > > > Python is simply easier than C++; you might > > > > well find tha

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Dan Bishop
On Jul 5, 10:19 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Besides, a string is an excellent epresentation for a zip code, > > since arithmetic upon them is unthinkable. > > Absolutely! Excel, unless you remedied that later with a column > operation,

Re: How to close a program I execute with subprocess.Popen?

2007-07-05 Thread jitudon
On Jun 29, 6:36 pm, [EMAIL PROTECTED] wrote: > I'm writing a program which has to execute a command, get its output > and show it on a treeview. > This command runs for a very long time. > I want to end the execution of the command when the user closes my > application. > > Right now I'm using an o

Re: Interfacing python program to C++ program instance

2007-07-05 Thread Josiah Carlson
Jim Langston wrote: > Windows. Situation: Using a Python program called OpenRPG. I have a program > that displays form data (a character sheet) in C++. I am able in the C++ > program to build a string and copy it into the clipboard, then paste it into > the input in the running Python program.

Re: what is wrong with that r"\"

2007-07-05 Thread Tim Roberts
Matthieu TC <[EMAIL PROTECTED]> wrote: >May I suggest giving the possibility to use any delimiter for a raw string? >just like in Vi or ruby. > >Vi: > %s_a_b_g is valid and so is %s/a/b/g > >Ruby: > %q{dj'\ks'a\'"} or %q-dj'\ks'a\'"- > >So as long as your regex does not use all the valid cha

Re: The best platform and editor for Python

2007-07-05 Thread Gregor Horvath
Kay Schluehr schrieb: > The problem is simply that the Python community has failed in this > respect. There are many platform dependent and ideology driven ways to > do deal with code editing / debugging but not actually a recommend or > "pythonic" way. Other than Smalltalk, Python has not created

VB frontend to Python COM backend

2007-07-05 Thread nik
I have a VB6 application that I would like to attach to a python communications application. I have come across several discussions on using VB with a Python COM back-end, but no starting point. I haven't had anymore luck with google at finding out what this method is called and where to find more

Writing a read only attribute

2007-07-05 Thread Fabrizio Pollastri
Hello, it is possible to force in some way a write to a read-only attribute of a python object? In which case? Thanks for any answer. F. Pollastri -- http://mail.python.org/mailman/listinfo/python-list

Re: The best platform and editor for Python

2007-07-05 Thread Ben Finney
[EMAIL PROTECTED] (Alex Martelli) writes: > Kay Schluehr <[EMAIL PROTECTED]> wrote: > > half of the community is happy with Emacs and the other half wants > > to program in a VS-like environment, neither consensus nor > > progress has > > Calling all vi/vim users (and we'll heartily appreciate the

Re: Htmllib help

2007-07-05 Thread axjacob
Thank you. Thats right I don't need the output any where so I don't need to use the writer. I can remove it wowever will the formater work since it needs writer? Maybe I can use the Null writer? -- Original message -- From: "Gabriel Genellina" <[EMAIL PROTECT

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Hendrik van Rooyen
"John Machin" wrote: > > I don't know what you mean by "requires more than one > character of lookahead" -- any non-Mickey-Mouse implementation of a > csv reader will use a finite state machine with about half-a-dozen > states, and data structures no more complicated than (1) completed > rows r

import

2007-07-05 Thread jolly
Hey guys, I'm rather new to python and i'm have trouble(as usual) I want to know if it is possible to change where 'import' looks this will save me clogging up my python directory Thanks -- http://mail.python.org/mailman/listinfo/python-list

<    1   2