Re: split up a list by condition?

2005-06-06 Thread Raymond Hettinger
>> while writing my solution for "The python way?", I came across this fragment: >> vees = [c for c in wlist[::-1] if c in vocals] >> cons = [c for c in wlist[::-1] if c not in vocals] >> >> So I think: Have I overlooked a function which splits up a sequence >> into two, based on a condition Tryi

poker card game revisited (code included)

2005-06-06 Thread flupke
Hi, i've included the code so interested people can take a look. I've tried to expand on the thread of 26/05/2005 on "Checking for a full house". Code is suboptimal as I coded it rather quickly. I've added the "normal" classes one would expect from a cardgame: card, deck, hand etc. 1. I can detec

Re: random module question

2005-06-06 Thread Roose
Raymond Hettinger wrote: > The answer is a qualified Yes. While the core generator (currently Thanks! That is the answer I'm looking for. And to Paul Rubin, it is a good point that Jython might not support it, but at this point it doesn't interest me. The program is only for myself anyway.

Re: split up a list by condition?

2005-06-06 Thread gene tani
Sounds like itertools.groupby() is what you're looking for, just sort your sequence on the grouping func that you will pass as 2nd arg to groupby(), before you pass the sequence to groupby() http://www.python.org/doc/2.4/whatsnew/node13.html http://www.python.org/dev/doc/devel/lib/itertools-functi

Re: separate IE instances?

2005-06-06 Thread J Correia
"Chris Curvey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I need to create a set of IE instances that have different sets of > session cookies. I thought that using the win32com.DispatchEx function > would do this, but it doesn't seem to. In other words > > ie1 = win32com.Dispa

reloading my own modules

2005-06-06 Thread Lowell Kirsh
I have a driver module as well as several other modules. I am running the driver interactively from emacs - that is, I don't restart python on each run. I want to work it such that every time a modify the source for one of the non-driver modules and re-run the driver, the other modules will be

MySQL newsgroup proposal.

2005-06-06 Thread William Drew
ANNOUNCEMENT: A RFD (REQUEST FOR DISCUSSION) has been posted for the creation of a new Usenet newsgroup: comp.databases.mysql The proposal and related discussion can be read in the Usenet group news.groups ... feel free to weigh in and make any suggestions you may have. Message-ID: <[EMAI

Re: PSP / mod_python ... how to get POST vars on .psp ?

2005-06-06 Thread grahamd
The documentation states: Additionally, the PSP code will be given global variables req, psp, session and form. In other words, in your PSP page you can access the "form" variable and it will give you access to the FieldStorage object that PSP creates for you. The members of the FieldStorage c

Re: Pythonic Gotchas

2005-06-06 Thread gene tani
or Norvig's IAQ: http://www.norvig.com/python-iaq.html -- http://mail.python.org/mailman/listinfo/python-list

Re: what can happen if Python wents commercial ;-) ...

2005-06-06 Thread Roger Upole
So that's how the PSF is raising funds now ! Roger "Claudio Grondi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > don't click the following link if you are not > at least 18 years old (or don't like sexual > related content): >http://www.python.com/ > > Clau

Re: Using PAMIE to upload and download files...is it possible?

2005-06-06 Thread Roger Upole
As I understand it, newer versions of IE have uploading and downloading via script disabled as a security measure. You might be able to do some low-level API calls to deal with the download window. Roger "scrimp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ive been usin

Re: Question about Object Oriented + functions/global vars?

2005-06-06 Thread gene tani
#include canonical design pattern advice longjmp(Borders or other_big_chain_bookstore) opt1=fopen("Oreilly's Head first design pattern","r") opt2=fopen("design patterns book by Shalloway and trott (i think that's their names)","r") another=poll("any other intro to DP books that people like?")

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Steve Holden
max wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>On Mon, 06 Jun 2005 16:12:18 +, max wrote: >> >> >>>This is one thing that bothers me about the gpl. It essentially >>>tries to create 'code as a legal entity'. That is, it gives >>>rights not to the cr

Re: PSP / mod_python ... how to get POST vars on .psp ?

2005-06-06 Thread Steve Holden
poisondart wrote [without quoting the question]: > Would something like cgi.FieldStorage() be what you're looking for? > > form = cgi.FieldStorage() > > form[ ] = > > http://www.python.org/doc/2.3.5/lib/node406.html > The problem with that would be that cgi.FieldStorage [checks manual ...]

Re: easiest way to split a list into evenly divisble smaller lists, and assign them to variables?

2005-06-06 Thread gene tani
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303279 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347689 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303060 OR: collections.deque: http://python.org/doc/2.4/lib/deque-recipes.html flamesrock wrote: > hmmm..that m

Re: PSP / mod_python ... how to get POST vars on .psp ?

2005-06-06 Thread poisondart
Would something like cgi.FieldStorage() be what you're looking for? form = cgi.FieldStorage() form[ ] = http://www.python.org/doc/2.3.5/lib/node406.html -- http://mail.python.org/mailman/listinfo/python-list

PSP / mod_python ... how to get POST vars on .psp ?

2005-06-06 Thread Rod Castellanos
Ive been looking everywhere, I need to get a var in my .psp file from another one, I managed to send it with a form and I can read it with "req.read" but it reads all of the variables together separated by a "&" like all POST/GET vars. How do I store each one in a python var, Im looking for someth

PSP / mod_python ... how to get POST vars on .psp ?

2005-06-06 Thread Rod Castellanos
Ive been looking everywhere, I need to get a var in my .psp file from another one, I managed to send it with a form and I can read it with "req.read" but it reads all of the variables together separated by a "&" like all POST/GET vars. How do I store each one in a python var, Im looking for someth

SMTP help please

2005-06-06 Thread Ivan Shevanski
I really can't figure out anything about the SMTP module. . .I think I'm in over my head( Im pretty new to python). Can someone show me a really(and I mean REALLY) basic tutorial for smtp or explain it? program: I want to make my program have a feedback form attached to it at the end which se

Re : how to show simulation at web

2005-06-06 Thread Titi Anggono
Here is my code in cgi. = #!/usr/bin/python print "Content-Type:text/plain\n\n" # python code here (create a simulation or graphics) The python code is ok when I run it in executable file .py. Friend told me to change the def

separate IE instances?

2005-06-06 Thread Chris Curvey
I need to create a set of IE instances that have different sets of session cookies. I thought that using the win32com.DispatchEx function would do this, but it doesn't seem to. In other words ie1 = win32com.DispatchEx("InternetExplorer.Application") ie2 = win32com.DispatchEx("InternetExplorer.Ap

Re: help with sending mail in Program

2005-06-06 Thread Ivan Shevanski
Could someone send me a good tutorial for sending mail then? The one I found is not what I'm looking for. Also please dont send me the stmp definition cause i've looked at that enough. thanks, -Ivan _ Express yourself instantly wi

Re: Creating file of size x

2005-06-06 Thread Grant Edwards
On 2005-06-06, Jan Danielsson <[EMAIL PROTECTED]> wrote: >>>The problem is that the design I'm working on won't guarantee >>>what order the blocks will be returned in -- so I need to be >>>able to seek to block n's location and write the ckeck block. >> >> Exactly. And precisely how did that fai

Re: help with sending mail in Program

2005-06-06 Thread Ivan Shevanski
Ugh. . .I'm really confused. In the example I saw the message was taken from a file on the computer. . .Like it opened it and then sent it. I guess I just need to check out the whole thing a bit more before I get specific. I'll ask again if I need specific help. thanks, -Ivan __

Re: help with sending mail in Program

2005-06-06 Thread Chris Curvey
Maybe you could give us a little more info about where you're getting messed up. The message body is just a string, so if you can build a string out of variables, you should be able to do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating file of size x

2005-06-06 Thread Andrew Dalke
Jan Danielsson wrote: >Is there any way to create a file with a specified size? Besides the simple def make_empty_file(filename, size): f = open(filename, "wb") f.write("\0" * size) f.close() ? If the file is large, try (after testing and fixing any bugs): def make_empty_file(filenam

Re: Creating file of size x

2005-06-06 Thread Jan Danielsson
Grant Edwards wrote: Is there any way to create a file with a specified size? >>> >>>What do you want to put in the file? Once you've answered that >>>question, the solution should present itself. >> >>Check blocks from an FEC-encoder (Freenet, more specifically). >> >> The problem is tha

Re: Creating file of size x

2005-06-06 Thread Grant Edwards
On 2005-06-06, Jan Danielsson <[EMAIL PROTECTED]> wrote: > Erik Max Francis wrote: >>>Is there any way to create a file with a specified size? >> >> What do you want to put in the file? Once you've answered that >> question, the solution should present itself. > > Check blocks from an FEC-enc

Re: Creating file of size x

2005-06-06 Thread Grant Edwards
On 2005-06-06, Jan Danielsson <[EMAIL PROTECTED]> wrote: >Is there any way to create a file with a specified size? Sure: 1) Open a new file for writing. 2) Seek to "specified size"-1. 3) Write one byte. -- Grant Edwards grante Yow! I just put lots of

Re: split up a list by condition?

2005-06-06 Thread Grooooops
Reinhold, Thanks for your response in the previous thread. Yours is an interesting question. I haven't come up with a solution, but I did realize that in the previous problem, the source 'word' doesn't really need to stay intact... So perhaps a solution along these lines? >>> for a in enumerate(

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
http://python.org/doc/2.4.1/modindex.html this is the global module index. I'd keep it handy to search through since it has some of the most useful stuff every intented! =D Try looking through here to help. . .That's the best I can think of. -Ivan _

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
What version of python do you use? I'll send you the module library. . .(sorry for double message) -Ivan _ FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Re: How to change deafult tab traversing (radiobuttons & panel)

2005-06-06 Thread Mudcat
I just figured this out myself, but probably not the way you're asking. There are supposed to be ways to change the tab order using tk_focusNext() and tk_focusPrevious(), but I've never used it. What I've done is simply point one widget to the next one, basically creating a linked list of tabs. I

poker card game revisited (code included)

2005-06-06 Thread flupke
Hi, i've included the code so interested people can take a look. I've tried to expand on the thread of 26/05/2005 on "Checking for a full house". Code is suboptimal as I coded it rather quickly. I've added the "normal" classes one would expect from a cardgame: card, deck, hand etc. 1. I can det

Re: Creating file of size x

2005-06-06 Thread Jan Danielsson
Erik Max Francis wrote: >>Is there any way to create a file with a specified size? > > What do you want to put in the file? Once you've answered that > question, the solution should present itself. Check blocks from an FEC-encoder (Freenet, more specifically). The problem is that the des

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
> > Can you elaborate more? Just any file? > >Yes -- a binary file. > >The file will contain check blocks for another file. The problem is >that the order of the received check blocks is not specified, so I need >to be able seek to the block's position in the file, and then just write >the blo

RE: EnumKey vs EnumValue

2005-06-06 Thread Hughes, Chad O
EnumKey enumerates subkeys which are equivalent to the folders in regedit. EnumValue enumerates values only. The reason your script is not printing anything must be due to the fact that you are passing in a registry path that contains only subkeys and no values. As I mentioned before, the folders

Re: Creating file of size x

2005-06-06 Thread Erik Max Francis
Jan Danielsson wrote: >Is there any way to create a file with a specified size? What do you want to put in the file? Once you've answered that question, the solution should present itself. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N

Creating file of size x

2005-06-06 Thread Jan Danielsson
Hello all, Is there any way to create a file with a specified size? -- http://mail.python.org/mailman/listinfo/python-list

file permissions on windows XP (home)

2005-06-06 Thread barney
I'm trying to write to an existing file under windows XP (home). The files are in 'My Music' which I think may be treated in some special way under XP. The relevant python code is as follows: os.chdir(dir) os.chmod(filename, 0744) print "Okay to write = "+str(os.access(filename, os.W_OK)) afile =

PyRun_String does not appear to handle EInvalidOp exceptions

2005-06-06 Thread Heather Korns
Here's a snippet of code that demonstrates my problem: result = PyRun_String ("import math", Py_file_input, pdict,pdict); result = PyRun_String ("math.sqrt(-1)", Py_file_input, pdict,pdict); result = PyRun_String ("math.pow(2,1024)", Py_file_input, pdict,pdict); Other types of exceptions s

[wxPython] How to change deafult tab traversing (radiobuttons & panel)

2005-06-06 Thread w.p.
Hello! I want change default tab traversing in my app. But i don't know how to do it :( Belowe i include simple example - i want change default tab order: radiobutton "mode11" -> radiobutton "mode31" -> button OK I can't find any option, flag, or another way. I try use wx.EVT_KEY_DOWN macro, o

Re: Destructive Windows Script

2005-06-06 Thread Mike Meyer
rbt <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> "Terry Reedy" <[EMAIL PROTECTED]> writes: >> >>> On *nix, one could open '/dev/rawdisk' (actual name depends on the >>> *nix build) and write a tracks worth of garbage for as many tracks >>> as there are. I don't how to programmaticly get the

help with sending mail in Program

2005-06-06 Thread Ivan Shevanski
Hey i'm new here and relatively new to python. I've made a few small programs and now I'm making a program for my friends that at the end has a feedback form. I want to send the feedback back to my email adress. I know I should use the SMTP module and I have figured out how to send with it,

Re: Controlling source IP address within urllib2

2005-06-06 Thread Dan
John, Thanks for your input. I can kind of see the light in this, but I'm having difficulty knowing where the "do_open" method comes from. Also, I'll need to follow redirects, so I assume then I would add a HTTPRedirectHandler instance to the urllib2.build_opener. (?) Thanks again for your help.

Re: anygui,anydb, any opinions?

2005-06-06 Thread James Tanis
Previously, on Jun 6, Thomas Bartkus said: # "James Tanis" <[EMAIL PROTECTED]> wrote in message # news:[EMAIL PROTECTED] # > Previously, on Jun 6, Thomas Bartkus said: # > # > # "bruno modulix" <[EMAIL PROTECTED]> wrote in message # > # news:[EMAIL PROTECTED] # > # > You mean the "wimp gui builde

RE: About size of Unicode string

2005-06-06 Thread Frank Abel Cancio Bello
Thanks to all. Andrew's answer was an excellent explanation. Thanks Leif for you suggestion. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Leif K-Brooks > Sent: Monday, June 06, 2005 4:29 PM > To: python-list@python.org > Subject: Re: About siz

wxPython: GridBagSizer, EXPAND, and HtmlListBox

2005-06-06 Thread Adam Endicott
I'm having some trouble using an HtmlListBox with a GridBagSizer. I'm not sure how best to explain what's happening, but it seems that every time my frame gets resized, the HtmlListBox grows taller, even when the resize is only horizontal, or makes the frame smaller. I'm pretty new to GUI layout a

Re: Destructive Windows Script

2005-06-06 Thread Grant Edwards
On 2005-06-06, rbt <[EMAIL PROTECTED]> wrote: >> Just open the raw disk device (assuming your Unix has such), >> and start writing data to it. Keep going until the write fails >> at the end of the media. > > Wouldn't /dev/urandom or /dev/random on Linux systems work > better? Maybe. Last time I

Re: anygui,anydb, any opinions?

2005-06-06 Thread Thomas Bartkus
"James Tanis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Previously, on Jun 6, Thomas Bartkus said: > > # "bruno modulix" <[EMAIL PROTECTED]> wrote in message > # news:[EMAIL PROTECTED] > # > You mean the "wimp gui builder + db -> ui pipeline" model ? If yes, C > # > doesn't have

Re: Destructive Windows Script

2005-06-06 Thread rbt
Mike Meyer wrote: > "Terry Reedy" <[EMAIL PROTECTED]> writes: > >>On *nix, one could open '/dev/rawdisk' (actual name depends on the *nix >>build) and write a tracks worth of garbage for as many tracks as there are. >>I don't how to programmaticly get the track size and number (if there is a >>

Re: Destructive Windows Script

2005-06-06 Thread Mike Meyer
"Terry Reedy" <[EMAIL PROTECTED]> writes: > On *nix, one could open '/dev/rawdisk' (actual name depends on the *nix > build) and write a tracks worth of garbage for as many tracks as there are. > I don't how to programmaticly get the track size and number (if there is a > standard way at all).

Re: the python way?

2005-06-06 Thread Andrew Dalke
Reinhold Birkenfeld wrote: > To make it short, my version is: > > import random > def reinterpolate2(word, vocals='aeiouy'): > wlist = list(word) > random.shuffle(wlist) > vees = [c for c in wlist[::-1] if c in vocals] > cons = [c for c in wlist[::-1] if c not in vocals] Why the [

Re: Destructive Windows Script

2005-06-06 Thread rbt
Terry Reedy wrote: > "Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>My previous facility didn't even accept mil-spec wipes -- all >>disk drives leaving the facility had to go through a demagnitizer, > > > OT but I am curious: does a metallic case act as a

Re: About size of Unicode string

2005-06-06 Thread Leif K-Brooks
Frank Abel Cancio Bello wrote: > request.add_header('content-encoding', 'UTF-8') The Content-Encoding header is for things like "gzip", not for specifying the text encoding. Use the charset parameter to the Content-Type header for that, as in "Content-Type: text/plain; charset=utf-8". -- ht

split up a list by condition?

2005-06-06 Thread Reinhold Birkenfeld
Hi, while writing my solution for "The python way?", I came across this fragment: vees = [c for c in wlist[::-1] if c in vocals] cons = [c for c in wlist[::-1] if c not in vocals] So I think: Have I overlooked a function which splits up a sequence into two, based on a condition? Such as

Re: Looking for Image, Audio and Internet/Web HOTWO's or tutorials

2005-06-06 Thread CPUFreak91
thanks. It's a huuuge list -- http://mail.python.org/mailman/listinfo/python-list

EnumKey vs EnumValue

2005-06-06 Thread Pykid
I'm having trouble getting any responses back from the following snippet, where I am just trying to read some data from the Windows Registry. I intend to do a little bit more with this but will work on that later, but I think I can get more data back from EnumValue, I'd like to see the differences

RE: About size of Unicode string

2005-06-06 Thread Andrew Dalke
Frank Abel Cancio Bello wrote: > Can I get how many bytes have a string object independently of its encoding? > Is the "len" function the right way of get it? No. len(unicode_string) returns the number of characters in the unicode_string. Number of bytes depends on how the unicode character are

Re: Destructive Windows Script

2005-06-06 Thread Grant Edwards
On 2005-06-06, Terry Reedy <[EMAIL PROTECTED]> wrote: > OT but I am curious: does a metallic case act as a metallic shield, It depends on the metal and the case thickness. Thin sheet-aluminum provides virtually no magnetic shielding. Some good thick iron plate will provide shielding. > so that

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Robert Kern
max wrote: > Perhaps 'attempts' is too strong a word. Maybe 'ends up giving' would > help my argument more. The best example I can come up with at the > moment is programmer A releases a project under the gpl. Programmer B > makes a substantial contribution to the project, which pA reads > thr

Re: the python way?

2005-06-06 Thread Grooooops
Wow... Thanks for all the tips guys... I will study the above examples. ...down to 8 lines of exquisitely readable code... Wow... Python rocks... (still aspiring to greatness myself,) cheers, -John x=["ohndes","j","wu","x[1][0]+x[0][:3]+chr(((len(x))*16))+x[2]+x[0][2:]+`rou

Re: Destructive Windows Script

2005-06-06 Thread Terry Reedy
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My previous facility didn't even accept mil-spec wipes -- all > disk drives leaving the facility had to go through a demagnitizer, OT but I am curious: does a metallic case act as a metallic shield, so that the ca

Re: random module question

2005-06-06 Thread Paul Rubin
"Raymond Hettinger" <[EMAIL PROTECTED]> writes: > >> Can I rely on the random.py module to produce the same series of > >> numbers for future/past versions of Python, given the same seed? > > The answer is a qualified Yes. While the core generator (currently the > Mersenne Twister algorithm) is s

OT: Survey facing design patterns and communication

2005-06-06 Thread Nico
Hello everybody! We are a group of students at "Freie Universitaet Berlin". As part of our computer science studies we are going to do a survey facing the use of design patterns in communication. Examples of design patterns are "Abstract Factory", "Singleton", "Composite", "Iterator" and "Listen

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Andreas Kostyrka
On Mon, Jun 06, 2005 at 06:08:36PM -, max wrote: > I guess my argument is that with multiple contributors, the gpl, in > comparison to say, a BSD style license, grants power to the code. If 3 > people work on a gpl project, they must agree to any changes. If 3 > people work on a BSD style pr

Re: the python way?

2005-06-06 Thread Reinhold Birkenfeld
Grops wrote: > Hi All, > > I've been lurking the list for a month and this is my first post. I am > hoping this post is appropriate here, otherwise, my apologies. > > I'm somewhat new to Python, (I'm reading all the tutorials I can find, > and have read through Andre Lessa's Developers Handb

Re: the python way?

2005-06-06 Thread Steven Bethard
Grops wrote: > Hi All, > > I've been lurking the list for a month and this is my first post. I am > hoping this post is appropriate here, otherwise, my apologies. > > I'm somewhat new to Python, (I'm reading all the tutorials I can find, > and have read through Andre Lessa's Developers Handb

Re: the python way?

2005-06-06 Thread Kent Johnson
Grops wrote: > The code just seems kind of bulky to me. I am wondering, is this an > efficient way to do things, or am I making things harder than > necessary? Harder than necessary. contains() is not needed at all, you can test for 'b in alist' directly. List comprehensions simplify reinter

Re: how to get name of function from within function?

2005-06-06 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: > The problem is: c.func_b.__name__ > 'wrapper' > > That messes up SOAPpy's RegisterFunction() method which apparently depends > on the __name__ of the function to publish it as an available SOAP > function. > > Any suggestions on how to change the name of c.

Requirements for Software Coding Standards?

2005-06-06 Thread Tim Couper
Does anyone have any knowledge of where to find details of docs like "Requirements for Software Coding Standards", etc applicable for work within the US govt (preferably non-military). Thanks in advance Dr Tim Couper UK -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Ve

RE: About size of Unicode string

2005-06-06 Thread Frank Abel Cancio Bello
Well I will repeat the question: Can I get how many bytes have a string object independently of its encoding? Is the "len" function the right way of get it? Laci look the following code: import urllib2 request = urllib2.Request(url= 'http://localhost:6000') data = 'data t

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Andrew Dalke
max: >> For me, the fact >> that corporations are considered people by the law is ridiculous. Steven D'Aprano wrote: > Ridiculous? I don't think so. Take, for example, Acme Inc. Acme purchases > a new factory. Who owns the factory? The CEO? The Chairperson of the Board > of Directors? Split in e

Re: idiom for constructor?

2005-06-06 Thread tracyshaun
And you probably should add: ... def __init__(self, *args): assert len(args) == len(self.__slots__) ... --T -- http://mail.python.org/mailman/listinfo/python-list

Re: idiom for constructor?

2005-06-06 Thread tracyshaun
How about just doing this: class Foo(object): __slots__ = ('a','b','c','d') def __init__(self, *args): for (name, arg) in zip(self.__slots__, args): setattr(self, name, arg) --T -- http://mail.python.org/mailman/listinfo/python-list

the python way?

2005-06-06 Thread Grooooops
Hi All, I've been lurking the list for a month and this is my first post. I am hoping this post is appropriate here, otherwise, my apologies. I'm somewhat new to Python, (I'm reading all the tutorials I can find, and have read through Andre Lessa's Developers Handbook.) I am trying to learn the

Re: maybe a bug in python

2005-06-06 Thread Steven Bethard
venkata subramanian wrote: > If you have any doubts, > try to remeber this when creating tuples, > > if a tuple is to have 0 elements, > then it must be given as a=() > in other words, the ( and the ) are essential > > if it has one element, > then a comma after that element is essential > a=1,

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread max
Steven D'Aprano <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > On Mon, 06 Jun 2005 16:12:18 +, max wrote: > >> This is one thing that bothers me about the gpl. It essentially >> tries to create 'code as a legal entity'. That is, it gives >> rights not to the creator of some code, but

Re: how to get name of function from within function?

2005-06-06 Thread Steven Bethard
Christopher J. Bottaro wrote: > Steven Bethard wrote: >>... def _impl_wrapper(self, func): >>... def wrapper(*args, **kwargs): >>... try: >>... return func(*args, **kwargs) >>... except: >>... print "entered except" >>...

Re: About size of Unicode string

2005-06-06 Thread Laszlo Zsolt Nagy
Frank Abel Cancio Bello wrote: >Hi all! > >I need know the size of string object independently of its encoding. For >example: > > len('123') == len('123'.encode('utf_8')) > >while the size of '123' object is different of the size of >'123'.encode('utf_8') > >More: >I need send in HTTP reques

Re: Reading a CSV file into a list of dictionaries

2005-06-06 Thread Peter Otten
RFQ wrote: > I have a comma delimited file where each line in the file is something > like: > > PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,... > > So each line is intended to be: key1,value1,key2,value2,key3,value3... > and each line is to be variable in length (although it

Re: random module question

2005-06-06 Thread Raymond Hettinger
>> Can I rely on the random.py module to produce the same series of >> numbers for future/past versions of Python, given the same seed? The answer is a qualified Yes. While the core generator (currently the Mersenne Twister algorithm) is subject to change across versions, whenever we've updated t

Re: Reading a CSV file into a list of dictionaries

2005-06-06 Thread Robert Kern
RFQ wrote: > Hi, I'm struggling here to do the following with any success: > > I have a comma delimited file where each line in the file is something > like: > > PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,... > > So each line is intended to be: key1,value1,key2,value2,key3,

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Andreas Kostyrka
On Sat, Jun 04, 2005 at 11:49:28PM -0700, Robert Kern wrote: > Well, the FSF at least thinks that internal use within an organization > does not constitute distribution. Well, the problem are contractors. It's very important (for example in Germany) for a number of legal reasons that contractors a

About size of Unicode string

2005-06-06 Thread Frank Abel Cancio Bello
Hi all! I need know the size of string object independently of its encoding. For example: len('123') == len('123'.encode('utf_8')) while the size of '123' object is different of the size of '123'.encode('utf_8') More: I need send in HTTP request a string. Then I need know the length of

Reading a CSV file into a list of dictionaries

2005-06-06 Thread RFQ
Hi, I'm struggling here to do the following with any success: I have a comma delimited file where each line in the file is something like: PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,... So each line is intended to be: key1,value1,key2,value2,key3,value3... and each line is

Using PAMIE to upload and download files...is it possible?

2005-06-06 Thread scrimp
Ive been using PAMIE 1.4 to try to automate web page processes. The one thing I cannot do with it is upload files and download files. With uploading files, the file input box does not allow PAMIE to enter in a path to a file. With downloading files, I can click on the link to download the file, b

Re: how to get name of function from within function?

2005-06-06 Thread Christopher J. Bottaro
Hey again Steven, I'm still having problems... Steven Bethard wrote: > Something like this might work: > > py> class C(object): > ... def func_a(self): > ... print "func_a" > ... def func_b_impl(self): > ... print "func_b" > ... raise Exception > ... def _

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Steven D'Aprano
On Mon, 06 Jun 2005 16:12:18 +, max wrote: > This is one thing that bothers me about the gpl. It essentially tries > to create 'code as a legal entity'. That is, it gives rights not to > the creator of some code, but to the code itself. Can you please show me where in the GPL it gives righ

Re: Lost in the inheritance tree... THANKS!

2005-06-06 Thread Jordan Rastrick
comp.lang.python is a great newsgroup in that respect - so long as you ask a semi-intelligent question, you nearly always end up with a quick and helpful response. Good luck with learning programming, and Python (IMO its one of the best possible languages to do it in) -- http://mail.python.org/m

Re: maybe a bug in python

2005-06-06 Thread venkata subramanian
If you have any doubts, try to remeber this when creating tuples, if a tuple is to have 0 elements, then it must be given as a=() in other words, the ( and the ) are essential if it has one element, then a comma after that element is essential a=1, or alternatively a=(1,) in other words, an end

Re: Question about Object Oriented + functions/global vars?

2005-06-06 Thread [EMAIL PROTECTED]
Well, if you want to apply object orientatation techniques to your work you would get something like this. Polymorphism is used to distinct between the ftp method. Another concept is data encapsulation, see the filedescription class . A third technique is inheritance - ftp is derived from an existi

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread max
Steven D'Aprano <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > By law, corporations (and possibly some other organisations) > *are* people. Not natural people like you or I, but nevertheless > people. For good or bad, this is the legal fact (or perhaps > "legal fiction") in most countries

Re: Adding a command to a Pmw.counter widget

2005-06-06 Thread Mark Light
Martin Franklin wrote: > Mark Light wrote: > > Hi, > >I have a Pmw.Counter widget and I would like to add a command > > that is called on pressing either the up or down arrows (the > > command will be the same for both). I have managed to do this for > > the entryfield with "entryfield_command

Re: Lost in the inheritance tree... THANKS!

2005-06-06 Thread Adam Munoz Lopez
Thanks a lot for your quick response. I actually just found the answer by myself before reading your reply. Just printed out the code and read it. The mistake was pretty obvious then. Yes, Ill try your suggestion. I was just trying to experiment a bit with inheritance to understand how it works bet

Re: Lost in the inheritance tree...

2005-06-06 Thread Jordan Rastrick
Although you get infinite recursion with this code, you still get enough information on the error from the interpreter to help you debug. Running IDLE, I get a traceback of: File "C:/Documents and Settings/Jordan/Desktop/more_blah.py", line 11, in __init__ self.createFrames() File "C:/Docum

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Steven D'Aprano
On Sun, 05 Jun 2005 03:57:29 -0400, Terry Reedy wrote: > "Robert Kern" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Mike Meyer wrote: >>> I've heard people argue otherwise on this case. In particular, if you >>> allow an employee to use your GPL'ed-but-not-distributed software

Re: anygui,anydb, any opinions?

2005-06-06 Thread James Tanis
Previously, on Jun 6, Thomas Bartkus said: # "bruno modulix" <[EMAIL PROTECTED]> wrote in message # news:[EMAIL PROTECTED] # > You mean the "wimp gui builder + db -> ui pipeline" model ? If yes, C # > doesn't have it, C++ doesn't have it (in fact most languages doesn't # > have it) - and #

Re: Lost in the inheritance tree...

2005-06-06 Thread Rocco Moretti
Adam Munoz Lopez wrote: > Can anyone help with this code... I have infinite > recursion but since I'm pretty new to Python (and > programming in general) I can't find where I did the > mistake. It really does help to start removing things trying to get the minimal code which causes the problem.

Re: If - Or statements

2005-06-06 Thread Steven D'Aprano
On Sun, 05 Jun 2005 13:52:09 -0400, Roy Smith wrote: > One sure sign of somebody trying to write C in Python is when they loop > over a list by doing > > for i in range (len (myList)): >doSomethingWith (myList[i]) I usually do that, and I've never coded a line of C in my life. I can't even

  1   2   >