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

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

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

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

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

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

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

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

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

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

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

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

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

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/

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

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

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

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.

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

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

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

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

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

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: 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: 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: 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, 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: 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: 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: SMTP server w/o using Twisted framework

2007-07-05 Thread _spitFIRE
On Jul 5, 2:37 pm, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: > You could try pyDNS (http://pydns.sourceforge.net). You should simply > be able to call the 'DNS.mxlookup' function. The other option would > be twisted.names... > Thanks for the pointers. > What about simply running an SMTP server o

Re: SMTP server w/o using Twisted framework

2007-07-05 Thread _spitFIRE
On Jul 5, 2:21 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > You need to do a DNS MX lookup. There's nothing in the Python stdlib > which provides this functionality. There are several libraries available > which do this, though (Twisted among them ;). You can probably find them > with a

Re: need help with converting c function to python function

2007-07-05 Thread Anton Vredegoor
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > 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 ; > { >unsigne

Re: Re-raising exceptions with modified message

2007-07-05 Thread Christoph Zwerschke
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 = sys.exc_info() > ex = traceback.format_exception_only(etype, eva

Re: SMTP server w/o using Twisted framework

2007-07-05 Thread Jeff McNeil
Inline... On 7/5/07, _spitFIRE <[EMAIL PROTECTED]> wrote: > On Jul 5, 1:34 pm, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: > > If you just want to send mail, you should be able to use the standard > > smtplib module (http://docs.python.org/lib/module-smtplib.html). If > > your recipients are on the I

Extracting arbitrary amounts of data from a dictionary.

2007-07-05 Thread robinsiebler
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. I stored the data like this: dates = {} #; year = {}; week = {}; date = {};

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

2007-07-05 Thread Neil Cerutti
On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote: > "Reader objects (DictReader instances and objects returned by > the reader() function) have the following public methods: Lucky for you and me, Peter Otten corrected my mistaken advice. > next( ) > Return the next row of the

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: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-05 Thread Donn Cave
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, as opposed to Java and friends. The campaign for optional > static t

Re: SMTP server w/o using Twisted framework

2007-07-05 Thread Jean-Paul Calderone
On Thu, 05 Jul 2007 18:56:49 -, _spitFIRE <[EMAIL PROTECTED]> wrote: >On Jul 5, 1:34 pm, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: >> If you just want to send mail, you should be able to use the standard >> smtplib module (http://docs.python.org/lib/module-smtplib.html). If >> your recipients ar

Re: Proposal: s1.intersects(s2)

2007-07-05 Thread Christoph Zwerschke
Nis Jørgensen wrote: > The problem is, these functions can be read as "X is [consisting only > of] digit[s]", "X is lower [case]" etc, where the bits in brackets have > been removed for brewity. In the case of "s1 is intersect s2" there is > no way I can see of adding words to get a correct sentenc

Callback scoping

2007-07-05 Thread Dan
So, I think I understand what python's scoping is doing in the following situation: >>> x = [ lambda: ind for ind in range(10) ] >>> x [ at 0x00BEC070>, at 0x00BEC7F0>, at 0x00BECA70>, at 0x00C1EBF0>, at 0x00C1EE30>, at 0x00C228F0>, at 0x00C228B0>, at 0x00C28730>, at 0x00C286F0>, at 0x00C2

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: >> The documentation for BaseException contains something that might >> be relevant: >> >>[...] If more data needs to be attached to the exception, >>attach it through arbitrary attributes on the instance.

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-07-05 Thread Klaas
On Jun 29, 3:48 am, "Mark Dufour" <[EMAIL PROTECTED]> wrote: > I have just released version 0.0.22 of Shed Skin, an experimental > Python-to-C++ compiler. Among other things, it has the exciting new > feature of being able to generate (simple, for now) extension modules, > so it's much easier to c

Re: SMTP server w/o using Twisted framework

2007-07-05 Thread _spitFIRE
On Jul 5, 1:34 pm, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: > If you just want to send mail, you should be able to use the standard > smtplib module (http://docs.python.org/lib/module-smtplib.html). If > your recipients are on the Internet, you would need to handle MX > resolution yourself. > How

Re: SMTP server w/o using Twisted framework

2007-07-05 Thread Jeff McNeil
If you just want to send mail, you should be able to use the standard smtplib module (http://docs.python.org/lib/module-smtplib.html). If your recipients are on the Internet, you would need to handle MX resolution yourself. I know you said you want to avoid a relay server, but it's probably the be

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

2007-07-05 Thread Thomas Jollans
On Thursday 05 July 2007, Captain Poutine wrote: > Peter Otten wrote: > > Neil Cerutti wrote: > >> On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote: > >>> I'm simply trying to read a CSV into a dictionary. > >>> > >>> (if it matters, it's ZIP codes and time zones, i.e., > >>> 35983,CT > >>>

SMTP server w/o using Twisted framework

2007-07-05 Thread _spitFIRE
Is it possible to run a SMTP server that sends mail to recipients using standard libraries, without using twisted framework, and also without using any relay server? -- http://mail.python.org/mailman/listinfo/python-list

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

2007-07-05 Thread Captain Poutine
Peter Otten wrote: > Neil Cerutti wrote: > >> On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote: >>> I'm simply trying to read a CSV into a dictionary. >>> >>> (if it matters, it's ZIP codes and time zones, i.e., >>> 35983,CT >>> 39161,CT >>> 47240,EST >>> >>> >>> >>> Apparently the way to

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

2007-07-05 Thread Falcolas
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 that it will be cl

Re: Re-raising exceptions with modified message

2007-07-05 Thread Christoph Zwerschke
Neil Cerutti wrote: > The documentation for BaseException contains something that might > be relevant: > >[...] If more data needs to be attached to the exception, >attach it through arbitrary attributes on the instance. All > > Users could get at the extra info you attached, but it wouldn

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

2007-07-05 Thread Captain Poutine
Neil Cerutti wrote: > On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote: >> I'm simply trying to read a CSV into a dictionary. >> >> (if it matters, it's ZIP codes and time zones, i.e., >> 35983,CT >> 39161,CT >> 47240,EST >> >> >> >> Apparently the way to do this is: >> >> import csv >> >>

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

2007-07-05 Thread Peter Otten
Neil Cerutti wrote: > On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote: >> I'm simply trying to read a CSV into a dictionary. >> >> (if it matters, it's ZIP codes and time zones, i.e., >> 35983,CT >> 39161,CT >> 47240,EST >> >> >> >> Apparently the way to do this is: >> >> import csv >> >>

Re: WXPYTHON push button call a frame

2007-07-05 Thread Roel Schroeven
Marcpp schreef: > Hi I need to call a widget from a button in WXPYTHON. I've tried to > this from a function like this, but when push the button, the program > opens a window and do error. > Any idea? > > . > def DialogRRHH(self,event): > prog = wx.PySimpleApp(0) > wx.InitA

Re: Proposal: s1.intersects(s2)

2007-07-05 Thread OKB (not okblacke)
Steven D'Aprano wrote: > Just because I've never come across it doesn't mean it exists, so > I'd be grateful for any reference to a technical definition, or > even references to any mathematician using intersect as a verb in a > vigorous, non-hand-waving way. Here's a link to get you started:

need help with converting c function to python function

2007-07-05 Thread nephish
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 ; { unsigned char uchCRCHi = 0xFF ; unsigned char uchCRCLo = 0xFF ; unsigne

Re: The best platform and editor for Python

2007-07-05 Thread Mark Morss
On Jul 1, 3:30 pm, "Sönmez Kartal" <[EMAIL PROTECTED]> wrote: "Emacs is the best for anything for me." Me too. Also, as pointed out by some others, a debugger is not really all that necessary for an interpreted language like Python. > > Hi, > > For experienced with Pyhton users, which developing

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

2007-07-05 Thread Neil Cerutti
On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote: > I'm simply trying to read a CSV into a dictionary. > > (if it matters, it's ZIP codes and time zones, i.e., > 35983,CT > 39161,CT > 47240,EST > > > > Apparently the way to do this is: > > import csv > > dictZipZones = {} > > reader = csv.r

deliberate versus os socket timeout

2007-07-05 Thread Robin Becker
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 this case windows xp). By inspection of test cases t

Re: The best platform and editor for Python

2007-07-05 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Gregor Horvath <[EMAIL PROTECTED]> wrote: >kimiraikkonen schrieb: > >> My another aim is: Can i develop graphical applications (like in >> Windows) which contain menus, interactive dialog boxes etc. using >> Ptyhon? >> >> I got it quite but not sure. I don't know P

Re: The best platform and editor for Python

2007-07-05 Thread kimiraikkonen
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. -- http://mail.python.org/mailman/listinfo/python-list

Re: disappearing documentation of `coerce`

2007-07-05 Thread Alan Isaac
> On 2007-07-05, Alan Isaac <[EMAIL PROTECTED]> wrote: >>Once upon a time, `coerce` was documented >>with the other built-ins. Neil Cerutti wrote: > It's now documented in Library Reference 2.2 Non-essential > Built-in Functions. > Apparently it is no longer needed or useful, but only kept for >

Re: login http://cheeseshop.python.org/pypi broken ?

2007-07-05 Thread gert
On Jul 5, 8:30 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > gert schrieb: > > > tried reseting password but i can not login anymore to upload my new > > source code ? > > Please try again. It was a misconfiguration which should be fixed now. > > Regards, > Martin thank you, it works. -- ht

Re: Proposal: s1.intersects(s2)

2007-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2007 01:48:58 +, richyjsm wrote: > On Jul 4, 8:14 pm, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> However, there's a very subtle flaw in the idea. While "the intersection" >> of two sets is well-defined, "these two sets intersect" is (surprisingly!) >> _not_ well-defined. >

Re: Proposal: s1.intersects(s2)

2007-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2007 07:34:28 -0700, Aahz wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >>My main feeling is that any such function should be a set method rather >>than a built-in function like len(). The name change was comparatively >>unimportant. > >

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

2007-07-05 Thread Chris Mellon
On 7/5/07, Captain Poutine <[EMAIL PROTECTED]> wrote: > I'm simply trying to read a CSV into a dictionary. > > (if it matters, it's ZIP codes and time zones, i.e., > 35983,CT > 39161,CT > 47240,EST > > > > Apparently the way to do this is: > > import csv > > dictZipZones = {} > > reader = csv.reade

  1   2   >