Re: how to add a string to the beginning of a large binary file?

2005-03-27 Thread Patrick Useldinger
could ildg wrote: I want to add a string such as "I love you" to the beginning of a binary file, How to? and how to delete the string if I want to get the original file? You shouldn't use Python to write a virus :-) -pu -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Shell Editor Question

2005-03-27 Thread Harlin Seritt
The Python shell you get with IDLE is actually not a system shell like cmd.exe or sh, bsh, csh etc. It is a shell that allows the Python interpreter to evaluate each line of Python code as you type. This is why when you type 'hello.py' it tells you 'hello.py' is not defined. On a higher level it s

Re: save configuration information in a global class

2005-03-27 Thread Steven Bethard
Su Wei <[EMAIL PROTECTED]> wrote: > if i have a xml file like this: > > > > > > i want to save this information,and used by other moduls later. > > how should i do it? ths First you need an xml library. There's one built into Python, but ElementTree is a simpler one: http://effbot.o

Re: How to get TabError?

2005-03-27 Thread Fredrik Lundh
"Mr. Magoo" wrote: >> $ python -t test.py >> test.py: inconsistent use of tabs and spaces in indentation >> hello >> goodbye > > On more question. When using py_compile from with a script, is there any > way to force the -t flag? if you want to check for tab problems from inside a script, use the

Re: save configuration information in a global class

2005-03-27 Thread Steven Bethard
Su Wei <[EMAIL PROTECTED]> wrote: > if i want to make a global class to save configuration information of > app that is read from a xml file,what can i do? Just put it in a module. Say, 'progconfig.py'. Your configuration code can then look like: import progconfig # parse configuration informat

Re: newbie question: how to get the class instance given a module object?

2005-03-27 Thread Steven Bethard
Tian wrote: import ModuleA classname = "Dog" module = globals()["ModuleA"] classobj = ??? <---using classname instanct = classobj() classobj = getattr(module, classname) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Newbie Shell Editor Question

2005-03-27 Thread Kash
Hi Everyone, I am new to python. I have just installed it. I am went to the python website and used it to download python and a beginners tutorial. I set the environment variables as explained in the faq. However when I start idle and run a program from it; I get the following types of errors; ho

newbie question: how to get the class instance given a module object?

2005-03-27 Thread Tian
I have a module called ModuleA.py, in which there is a class called Dog, what should I put in the "" part to get the instance of class Dog??? import ModuleA classname = "Dog" module = globals()["ModuleA"] classobj = ??? <---using classname instanct = classobj() -- http://mai

Re: How to organize source code and "import"s???

2005-03-27 Thread Steven Bethard
Tian wrote: I also have some problem about the "import". How should I design my packages? Say, I have all code locates at c:\projects\sami, "c:\project" is in my PYTHONPATH environment variable. Suppose my folder structure is like this: c: projects\ <-this directory is in PYTHONPATH

Re: File Uploads

2005-03-27 Thread and-google
Doug Helm wrote: > form = cgi.FieldStorage() > if lobjUp.Save('filename', 'SomeFile.jpg'): > class BLOB(staticobject.StaticObject): > def Save(self, pstrFormFieldName, pstrFilePathAndName): > form = cgi.FieldStorage() You are instantiating cgi.FieldStorage twice. This won't work for POST

Re: how to add a string to the beginning of a large binary file?

2005-03-27 Thread James Stroud
On Sunday 27 March 2005 07:56 pm, could ildg wrote: > I want to add a string such as "I love you" to the beginning of a binary > file, How to? and how to delete the string if I want to get the original > file? There are many ways. Define large. -- James Stroud, Ph.D. UCLA-DOE Institute for Geno

Re: Overriding methods in classes you don't control

2005-03-27 Thread John Roth
Look up "Aspect Oriented Programming" and Python. You should find several packages that can do this, together with discussions of how to make cuts and all that fun stuff. The feeling of power is very heady - until you have to maintain the resulting mess. John Roth "Alex VanderWoude" <[EMAIL PROTEC

Re: How to organize source code and "import"s???

2005-03-27 Thread John Roth
"Tian" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I am writing a python program which needs to support some plug-ins. I have an XML file storing some dynamic structures. XML file records some class names whose instance needs to be created in the run time while parsing the XML file

Re: Overriding methods in classes you don't control

2005-03-27 Thread Steven Bethard
Alex VanderWoude wrote: Basically I want to change wxFrame.__init__ so that it looks sort of like this: def __init__(self, *args, **kwargs): # Some enhancements here. # The original code of this method, including the call to its ancestor. # Some more enhancements here. A

Re: Overriding methods in classes you don't control

2005-03-27 Thread Jp Calderone
On Mon, 28 Mar 2005 03:57:16 GMT, Alex VanderWoude <[EMAIL PROTECTED]> wrote: >Is there a way to override a method on a class whose source you cannot > change in such a way that you can hook into that method's code? After doing > some research, it appears that one way to do such a thing is to crea

Re: Python List Issue

2005-03-27 Thread Nick L
Thanks, thats a really handy function "Ron_Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]> > wrote: > > >I've hit a brick wall on something that I'm guessing is pretty simple but > >it's driving me nuts. > > Yes, I

Re: sorting matrixes

2005-03-27 Thread Xah Lee
Here's the solution to previous post. --- perl code: sub sort_matrix($$) { my $ref_matrix = $_[0]; my @indexMatrix = @{$_[1]}; my @indexes = map {$_->[0]} @indexMatrix; my @operators = map {$_->[1] ? ' cmp ' : ' <=> '} @indexMatrix; my @directions

Re: String Splitter Brain Teaser

2005-03-27 Thread Mike Rovner
Jp Calderone wrote: On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud <[EMAIL PROTECTED]> wrote: "ATT/GATA/G" gets split to [['A'], ['T'], ['T', 'G'], ['A'], ['T'], ['A', 'G']] I have written a very ugly function to do this (listed below for the curious), but intuitively I think this should only ta

How to organize source code and "import"s???

2005-03-27 Thread Tian
I am writing a python program which needs to support some plug-ins. I have an XML file storing some dynamic structures. XML file records some class names whose instance needs to be created in the run time while parsing the XML file. I wonder what is the best solution for this problem? I also have

Overriding methods in classes you don't control

2005-03-27 Thread Alex VanderWoude
Is there a way to override a method on a class whose source you cannot change in such a way that you can hook into that method's code? After doing some research, it appears that one way to do such a thing is to create a new (non-class) method, and then assign the new method to the class in questio

how to add a string to the beginning of a large binary file?

2005-03-27 Thread could ildg
I want to add a string such as "I love you" to the beginning of a binary file, How to? and how to delete the string if I want to get the original file? thanks. -- http://mail.python.org/mailman/listinfo/python-list

File Uploads -- Windows Server

2005-03-27 Thread Doug Helm
I should have been more clear in my subject line. I was also the poster in the "File Uploads" topic. I'm not having any luck getting file uploads to work (multi-part HTML form) on a Windows server. I'm using a very close approximation of public domain code that I found. I've tried a couple of d

Newbie Printing Question

2005-03-27 Thread Richard Lyons
I'm just starting to work with Python. Have had a little experience with basic. I am using Python on a Windows XP system. How to I print a line of output generated in a python script to a printer attached to the windows computer? -- http://mail.python.org/mailman/listinfo/python-list

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Steven Bethard
Ron Garret wrote: In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: Why don't you just write a function to create class objects? def f(*params): class C(...): ... # based on params return C I suppose I could. When I originally started writing this code I w

Use informative subject lines! (was Re: Dumb*ss newbie Q)

2005-03-27 Thread beliavsky
A subject line should say what the message is about, for example "Create HTML tag using objects (newbie Q)" and enable people who are not interested in or knowledgable about a topic to skip it, while grabbing the attention of people who are knowledgable/interested. -- http://mail.python.org/mai

Re: String Splitter Brain Teaser

2005-03-27 Thread Ron_Adam
On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud <[EMAIL PROTECTED]> wrote: >Hello, > >I have strings represented as a combination of an alphabet (AGCT) and a an >operator "/", that signifies degeneracy. I want to split these strings into >lists of lists, where the degeneracies are members of th

Re: String Splitter Brain Teaser

2005-03-27 Thread Michael Spencer
Brian van den Broek wrote: Much nicer than mine. =| :-) ^ | (hats off) Cool ascii art (but thanks for the translation)! Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I need to dynamically generate new types at run time. I can do this in > > two ways. I can use the "type" constructor, or I can generate a "class" > > statement as a string and feed that to the e

passing input to running loop

2005-03-27 Thread stealthwang
I'm still very new to Python, after decideding to learn a true programming language (rather then a scripting language, i like to think i'm a intermediate PHP user). I decided for my first project I would try to make a IRCbot. It would run on the commandline with a frontend for commands such as "rec

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I need to dynamically generate new types at run time. I can do this in > > two ways. I can use the "type" constructor, or I can generate a "class" > > statement as a string and feed that to the ex

Re: String Splitter Brain Teaser

2005-03-27 Thread James Stroud
On Sunday 27 March 2005 05:04 pm, Michael Spencer wrote: >   >>> def group(src): >   ...     stack = [] >   ...     srciter = iter(src) >   ...     for i in srciter: >   ...         if i == "/": >   ...             stack[-1].append(srciter.next()) >   ...         else: >   ...             stack.app

Re: Dumb*ss newbie Q

2005-03-27 Thread Captain Dondo
On Mon, 28 Mar 2005 01:15:34 +, Jp Calderone wrote: > > Notice that you have a method named "url" as well as an attribute > named "url". You have the same problem for "thumb". These methods > and attributes are in collision with each other. When you try to > look up the

133+ Tutorials and counting...

2005-03-27 Thread rdsteph
..and there are more seemingly every day... Table of Contents Beginners (12) Database (6) Extending and Embedding (4) General and Advanced (15) Grimoire (1) GUI Programming: General and Miscellaneous (6) GUI Programming: Tkinter (4) GUI Programming: wxPython and PythonCard (7) GUI Programming: pyG

Python Cookbook, 2'nd. Edition is published

2005-03-27 Thread rdsteph
See http://www.oreilly.com/catalog/pythoncook2/index.html I don't see it on Amazon yet, but you can order it from O'Reilly. Ron Stephens www.awaretek.com -- http://mail.python.org/mailman/listinfo/python-list

Re: String Splitter Brain Teaser

2005-03-27 Thread Brian van den Broek
Michael Spencer said unto the world upon 2005-03-27 20:04: James Stroud wrote: Hello, I have strings represented as a combination of an alphabet (AGCT) and a an operator "/", that signifies degeneracy. I want to split these strings into lists of lists, where the degeneracies are members of the s

Re: Dumb*ss newbie Q

2005-03-27 Thread Jp Calderone
On Sun, 27 Mar 2005 17:06:05 -0800, Captain Dondo <[EMAIL PROTECTED]> wrote: > [snip] > > def url (self): > self.url = ... > > def thumb (self): > self.thumb = ... > > [snip] > > The problem is that m.html in the test section fails with > > TypeError: cannot concatenat

Dumb*ss newbie Q

2005-03-27 Thread Captain Dondo
OK, I know this is covered somewhere in Python 101, but for the life of me I cannot figure this out. I really need a basic intro to Python book I am trying to do something very simple - create an HTML tag using objects: class Movie: def __init__ (self, t="", a="", d=""): #

Re: String Splitter Brain Teaser

2005-03-27 Thread Michael Spencer
James Stroud wrote: Hello, I have strings represented as a combination of an alphabet (AGCT) and a an operator "/", that signifies degeneracy. I want to split these strings into lists of lists, where the degeneracies are members of the same list and non-degenerates are members of single item lis

Re: How to get rid of FutureWarning: hex/oct constants...

2005-03-27 Thread Bengt Richter
On Sun, 27 Mar 2005 12:48:46 +0200, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> >>> hex(-2*0x4000+0x40047a80) >> __main__:1: FutureWarning: hex()/oct() of negative int will return a signed >> string in Python 2.4 >> and up >> '0xc0047a8

Re: String Splitter Brain Teaser

2005-03-27 Thread Brian van den Broek
James Stroud said unto the world upon 2005-03-27 17:39: Hello, I have strings represented as a combination of an alphabet (AGCT) and a an operator "/", that signifies degeneracy. I want to split these strings into lists of lists, where the degeneracies are members of the same list and non-degene

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Leif K-Brooks
Ron Garret wrote: I need to dynamically generate new types at run time. I can do this in two ways. I can use the "type" constructor, or I can generate a "class" statement as a string and feed that to the exec function. The former technique is much cleaner all else being equal, but I want to b

Re: File Uploads

2005-03-27 Thread dimitri pater
No, I am on a Linux server. I am not sure how CGI is configured because I do not control the server, I only use it. bye, Dimitri On Sun, 27 Mar 2005 16:19:00 -0700, Doug Helm <[EMAIL PROTECTED]> wrote: > Thanks, Dimitri. Yes, I found that same code too and tried it with the > exact same result

Re: File Uploads

2005-03-27 Thread Doug Helm
Thanks, Dimitri. Yes, I found that same code too and tried it with the exact same result as the code I've uploaded (just hangs). But, OK. You have it working, so it must be a systems issue. Are you also on a Windows IIS web server? Do you have CGI configured the same way (i.e. .py = python.exe

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread François Pinard
[Ron Garret] > Is it really impossible to specify __slots__ using the "type" > constructor? It does not work? I vaguely remember having needed to do this once or twice, and it worked immediatly as expected. Unless I remember wrongly, you only have to preset `__slots__' in the dict you give to `

Re: String Splitter Brain Teaser

2005-03-27 Thread Doug Schwarz
In article <[EMAIL PROTECTED]>, James Stroud <[EMAIL PROTECTED]> wrote: > Hello, > > I have strings represented as a combination of an alphabet (AGCT) and a an > operator "/", that signifies degeneracy. I want to split these strings into > lists of lists, where the degeneracies are members of

Re: String Splitter Brain Teaser

2005-03-27 Thread Jp Calderone
On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud <[EMAIL PROTECTED]> wrote: >Hello, > > I have strings represented as a combination of an alphabet (AGCT) and a an > operator "/", that signifies degeneracy. I want to split these strings into > lists of lists, where the degeneracies are members of

Re: String Splitter Brain Teaser

2005-03-27 Thread Paul McGuire
Using a parser may sound like overkill, but why not when it's this easy? Get the latest pyparsing at http://pyparsing.sourceforge.net. -- Paul from pyparsing import oneOf, Group, OneOrMore, Literal testdata = "ATT/GATA/G" marker = oneOf( "A T G C") SLASH = Literal("/").suppress() genDegenList

String Splitter Brain Teaser

2005-03-27 Thread James Stroud
Hello, I have strings represented as a combination of an alphabet (AGCT) and a an operator "/", that signifies degeneracy. I want to split these strings into lists of lists, where the degeneracies are members of the same list and non-degenerates are members of single item lists. An example will

Re: putting the output of a print statement into a string

2005-03-27 Thread Jon Perez
Thanks, man! That was one fast reply... Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Jon Perez wrote: > > >>Question: >> >>Is there a way to somehow put the output of 'print exc_obj' into >>a string? > > > There are ways to do even that, but maybe ``str(exc_obj)`` is enough for > you

Re: putting the output of a print statement into a string

2005-03-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Jon Perez wrote: > Question: > > Is there a way to somehow put the output of 'print exc_obj' into > a string? There are ways to do even that, but maybe ``str(exc_obj)`` is enough for your needs!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/l

putting the output of a print statement into a string

2005-03-27 Thread Jon Perez
There are objects whose repr() is not the same as what gets printed out when you apply the print statement to them. Usually these are complex objects like exceptions. Example: >>> import smtplib >>> server=smtplib.SMTP("smtp.yourisp.com") >>> try: server.sendmail("[EMAIL PROTECTED]",

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Steven Bethard
Ron Garret wrote: I need to dynamically generate new types at run time. I can do this in two ways. I can use the "type" constructor, or I can generate a "class" statement as a string and feed that to the exec function. The former technique is much cleaner all else being equal, but I want to b

Re: File Uploads

2005-03-27 Thread dimitri pater
Maybe this helps: http://www.voidspace.org.uk/python/cgi.shtml#upload I use it, it works for fine me Maybe it will give you some clues on how to tweak your own script. Dimitri On Sun, 27 Mar 2005 10:32:20 -0700, Doug Helm <[EMAIL PROTECTED]> wrote: > Hey, Folks: > > I'm trying to write a very

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Diez B. Roggisch
Ron Garret wrote: > > I need to dynamically generate new types at run time. I can do this in > two ways. I can use the "type" constructor, or I can generate a "class" > statement as a string and feed that to the exec function. The former > technique is much cleaner all else being equal, but I

ANN: Brazil organises its first PyConDayBrasil

2005-03-27 Thread Rodrigo Dias Arruda Senra
Inspired by the PyCon tradition, the Brazilian Python Community is organising a PyCon-like event called: PyConDayBrasil. We have gathered 14 people to give speeches exclusively about Python in an event that will take place in April 28th/29th. The event's URL is below (only in Brazilian Por

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Scott David Daniels
Reinhold Birkenfeld wrote: Jacob Lee wrote: About slices: I agree that Python's slice boundaries (some_list[a:b] being all elements with a <= index < b) are counterintuitive at first. But this method does satisfy some handy properties, the first of which being: l[:n] + l[n:] = l And best of all,

Re: Python for a 10-14 years old?

2005-03-27 Thread Lee Harr
On 2005-03-27, Joal Heagney <[EMAIL PROTECTED]> wrote: > Couldn't help myself. I had to write the Dragon Fractal in python.turtle >:) > That's nice. I ported it to use the pygsear Turtle class. http://www.nongnu.org/pygsear/ --- Dragon.py 2005-03-27 08:48:13.0 -0500 +++ pDragon.py 200

Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Ron Garret
I need to dynamically generate new types at run time. I can do this in two ways. I can use the "type" constructor, or I can generate a "class" statement as a string and feed that to the exec function. The former technique is much cleaner all else being equal, but I want to be able to specif

Re: Pre-PEP: Dictionary accumulator methods

2005-03-27 Thread Steven Bethard
Michele Simionato wrote: FWIW, here is my take on the defaultdict approach: def defaultdict(defaultfactory, dictclass=dict): class defdict(dictclass): def __getitem__(self, key): try: return super(defdict, self).__getitem__(key) except KeyError:

Re: Pre-PEP: Dictionary accumulator methods

2005-03-27 Thread Steven Bethard
Michele Simionato wrote: I am surprised nobody suggested we put those two methods into a separate module (say dictutils or even UserDict) as functions: from dictutils import tally, listappend tally(mydict, key) listappend(mydict, key, value) Sorry to join the discussion so late (I've been away from

Re: Cross platform distribution of standalone executable

2005-03-27 Thread '@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])])
don't count out py2exe, especially if your using pywin32's -- http://mail.python.org/mailman/listinfo/python-list

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
I very much take your point. And thanks: that answers my syntax question (I think!) -- *and* tells me that I don't care. Charles Hartman On Mar 27, 2005, at 2:16 PM, [EMAIL PROTECTED] wrote: ... >>> simpler == complexities True >>> I've not the glimmer of a clue which would be faster, and don't c

Re: Python List Issue

2005-03-27 Thread Ron_Adam
On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]> wrote: >I've hit a brick wall on something that I'm guessing is pretty simple but >it's driving me nuts. Yes, I've ran across that too a few times. >How on earth can I make a complete seperate copy of a list with out it >being a

help with getting selection from wxChoice with out after it has changed

2005-03-27 Thread '@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])])
I want to get the selection of several wxChoice boxes. But i do not want to have to catch the events for all the boxes I should be able to access the current selection outside of an event,but i am not seeing how to do this. This is a hack of the wxpython choice demo to demonstrate my question #-

Re: mysteriously nonfunctioning script - very simple

2005-03-27 Thread Sean McIlroy
Heiko Wundram <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Why not try the following: I did try it, and it didn't work either. It appears there must be something wrong with my computer, hopefully something benign. Thanks anyway. Peace, STM -- http://mail.python.org/mailm

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-03-27 14:12: Charles Hartman said unto the world upon 2005-03-27 13:35: On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote: >>> def some_arbitrary_function(y): ... return ( (y * 42) - 19 ) % 12 ... >>> [some_arbitrary_function(len(x)) for x

Re: What's the best GUI toolkit in Python,Tkinter,wxPython,QT,GTK?

2005-03-27 Thread Do Re Mi chel La Si Do
+1 Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: list.count() with no arguments

2005-03-27 Thread "Martin v. Löwis"
Johan Hahn wrote: Wouldn't it be nice if list.count, called without any arguments, returned a dict with the list's unique items as keys and their frequency of occurance as values? No. It would require all sequences to support this protocol, which would be tedious to implement. Some day, we may have

Re: Python List Issue

2005-03-27 Thread Nick L
> See copy.deepcopy(). It will make sure that everything gets copied and > nothing just referenced (more or less). So far copy.deepcopy() seems to be working perfectly. Thanks for the input Nick -- http://mail.python.org/mailman/listinfo/python-list

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
Charles Hartman said unto the world upon 2005-03-27 13:35: On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote: >>> def some_arbitrary_function(y): ... return ( (y * 42) - 19 ) % 12 ... >>> [some_arbitrary_function(len(x)) for x in lines.split()] [5, 5, 11, 11, 5, 11, 5, 11] >>> I could be m

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Patrik Andreasen
Giovanni Bajo wrote: Terry Reedy wrote: 3) Sometimes the structure of the algorithm is not the structure of the code as written, people who prefer that the indentation reflects the structure of the algorithm instead of the structure of the code, are forced to indent wrongly. Do you have any sim

Re: Cross platform distribution of standalone executable

2005-03-27 Thread Serge Orlov
Mahesh wrote: > Hi, > > One of my clients does not want the Python VM installed on his > production machine (because it is not a supported IT language) so the > only way I can program in Python and release the application to him is > to make a standalone executable and deploy it. The last time I lo

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote: >>> def some_arbitrary_function(y): ... return ( (y * 42) - 19 ) % 12 ... >>> [some_arbitrary_function(len(x)) for x in lines.split()] [5, 5, 11, 11, 5, 11, 5, 11] >>> I could be missing some edge cases, but it seems to me that if you hav

Re: What's the best GUI toolkit in Python,Tkinter,wxPython,QT,GTK?

2005-03-27 Thread Andrew Dalke
Maurice LING wrote: > That's almost like asking which way of cooking chicken is the best? > steam, fried, stew, roast? BBQ'ed of course. I believe that fits your point. :) Andrew [EMAIL PROTECTED] -- http://mail.python.org/mailma

Re: Python for a 10-14 years old?

2005-03-27 Thread Arthur
On Fri, 25 Mar 2005 00:50:36 -0700, Jules Dubois <[EMAIL PROTECTED]> wrote: >On Wednesday 23 March 2005 22:03, [EMAIL PROTECTED] <[EMAIL PROTECTED]> >(<[EMAIL PROTECTED]>) wrote: > >> Is there something out there like "Python for kids" which would explain >> *basic* programming concepts in a way w

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
Charles Hartman said unto the world upon 2005-03-27 09:51: I understand this toy example: lines = "this is a group\nof lines of\nwords" def getlength(w): return len(w) s = map(getlength, [word for ln in lines.split() for word in ln.splitlines()]) (now s is [4, 2, 1, 5, 2, 5, 2, 5]) My question i

Re: Convert the contents of a string into name of variable

2005-03-27 Thread Bruno Desthuilliers
Erwan VITIERE a écrit : Hello, I want to convert the contents of a string into name of variable. For example: var1="toto" ... toto=5 print toto exec "toto = 5" print toto But I would use another solution if possible. -- http://mail.python.org/mailman/listinfo/python-list

File Uploads

2005-03-27 Thread Doug Helm
Hey, Folks: I'm trying to write a very simple file upload CGI. I'm on a Windows server. I *am* using the -u switch to start Python for CGIs, as follows: c:\python\python.exe -u %s %s I *do* have write permissions on the directory I'm trying to write to. But, when I click submit, it just hangs.

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Javier Bezos
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] >>s t r i n g >> ^ ^ ^ ^ ^ ^ ^ >> 0 1 2 3 4 5 6 >> >> so that [1:2] is "t". > > Incidentally, the Python Tutorial tells us exactly the same... Ah! I've just forgotten t

Cross platform distribution of standalone executable

2005-03-27 Thread Mahesh
Hi, One of my clients does not want the Python VM installed on his production machine (because it is not a supported IT language) so the only way I can program in Python and release the application to him is to make a standalone executable and deploy it. The last time I looked at something like th

Re: [Tkinter] LONG POST ALERT: Setting application icon on Linux

2005-03-27 Thread Jeff Epler
Here is a short program that sets Tk's window icon on Linux. My window manager is icewm, and it uses a scaled version of the "flagup" image both at the upper-left corner of the window and on the task bar entry for the window. import Tkinter app = Tkinter.Tk() app.iconbitmap("@/usr/X11

Panel problems

2005-03-27 Thread ebbyfish
Howdy, I am having some problems woth sizers adding panels to a scrolledwindow. I have 3 classes (wx.Panels) which I want to add to a ScrolledWindow (The Parent). I can get it to work except the ScrollWindow never scrolls. Also as I am new to (wx)Python, so I am sure it is a simple mistake. But

Re: Python List Issue

2005-03-27 Thread Terry Reedy
"Nick L" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've hit a brick wall on something that I'm guessing is pretty simple but > it's driving me nuts. I noticed that with python lists, generally when > you > make a copy of a list (ie, List1 = List2) Python is not C, etc. Assi

Re: How to get TabError?

2005-03-27 Thread Mr. Magoo
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > $ python -t test.py > test.py: inconsistent use of tabs and spaces in indentation > hello > goodbye On more question. When using py_compile from with a script, is there any way to force the -t flag? M -- http://mail.

Re: How to get TabError?

2005-03-27 Thread Mr. Magoo
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > "Mr. Magoo" wrote: > > > Can someone provide a snippet which, when run, generates a TabError? > > > > I can only seem to get SyntaxError and IndentationError. > > $ python -c "print repr(open('test.py').read())" > 'if

Re: list-comprehension and map question (simple)

2005-03-27 Thread Reinhold Birkenfeld
Charles Hartman wrote: > On Mar 27, 2005, at 11:50 AM, Nicolas Évrard wrote: > >>> >>> I hope the question is clear enough. I have a feeling I'm ignoring a >>> simple technique . . . >> >> lambda ! >> >> map(lambda x: timestwo(getlength(x)), ...) > > Ah, lambda! I've heard so much bad-mouthing

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Reinhold Birkenfeld
Javier Bezos wrote: > MetaFont explains this by saying that the index > doesn't refer to a character but to a position > between characters, which when traslated to Python > would mean: > >s t r i n g > ^ ^ ^ ^ ^ ^ ^ > 0 1 2 3 4 5 6 > > so that [1:2] is "t

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Reinhold Birkenfeld
Jacob Lee wrote: > About slices: > > I agree that Python's slice boundaries (some_list[a:b] being all elements > with a <= index < b) are counterintuitive at first. But this method does > satisfy some handy properties, the first of which being: > l[:n] + l[n:] = l And best of all, this is true

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Terry Reedy
"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: > >>> 3) Sometimes the structure of the algorithm is not the structure >>> of the code as written, people who prefer that the indentation >>> reflects the structure of the algorithm instead of the

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
On Mar 27, 2005, at 11:50 AM, Nicolas Évrard wrote: I hope the question is clear enough. I have a feeling I'm ignoring a simple technique . . . lambda ! map(lambda x: timestwo(getlength(x)), ...) Ah, lambda! I've heard so much bad-mouthing of lambda that I forgot to learn it . . . This is quite

Re: Python slogan, was Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Reinhold Birkenfeld
Kent Johnson wrote: >> Wikiquote is nice. I missed it because I googled for Mark Twain and parts of >> the Churchill quote -- for that I'm now convinced it is as wikiquote gives >> a slightly longer excerpt and the date and location of the speech (November >> 11, 1947, in the House of Commons). >

Re: [Tkinter] LONG POST ALERT: Setting application icon on Linux

2005-03-27 Thread Tim Jarman
Jeff Epler wrote: > Here is a short program that sets Tk's window icon on Linux. My window > manager is icewm, and it uses a scaled version of the "flagup" image > both at the upper-left corner of the window and on the task bar entry > for the window. > > import Tkinter > app = Tkinter.T

Re: Turn of globals in a function?

2005-03-27 Thread Ron_Adam
On 26 Mar 2005 22:51:14 -0800, [EMAIL PROTECTED] (Oren Tirosh) wrote: >Ron_Adam <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... >> Is there a way to hide global names from a function or class? >> >> I want to be sure that a function doesn't use any global variables by >> mistake.

Re: How to get TabError?

2005-03-27 Thread Fredrik Lundh
"Mr. Magoo" wrote: > Can someone provide a snippet which, when run, generates a TabError? > > I can only seem to get SyntaxError and IndentationError. $ python -c "print repr(open('test.py').read())" 'if 1:\n\tprint "hello"\nprint "goodbye"\n' $ python test.py hello goodbye $ python -t

Re: How to get TabError?

2005-03-27 Thread Jeff Epler
When running with "-tt", you can get this error. [EMAIL PROTECTED] src]$ python -tt Python 2.3.3 (#1, May 7 2004, 10:31:40) [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exec "def f():\n\ta\nb" Traceback

hospedagem de sites - planos de hospedagem - hospedagem 41677

2005-03-27 Thread hospedagem de site hospedagem de sites
Tudo sobre hospedagem de sites , planos profissionais , economicos e muitos outros , sua empresa na internet por apenas 2,99 ao mês! http://www.hosting4u.com.br hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem

How to get TabError?

2005-03-27 Thread Mr. Magoo
Can someone provide a snippet which, when run, generates a TabError? I can only seem to get SyntaxError and IndentationError. Thanks, M -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-27 Thread Javier Bezos
"Jacob Lee" <[EMAIL PROTECTED]> escribió en el mensaje >> things which compesate that (another annoying point >> of Python are slices -- mine are always off by 1). >About slices: Thank you, but I knew the motivations for this odd behaviour, which can be found as well in, for example, MetaFont.

list.count() with no arguments

2005-03-27 Thread Johan Hahn
Wouldn't it be nice if list.count, called without any arguments, returned a dict with the list's unique items as keys and their frequency of occurance as values? >>> [1,2,1,'a'].count() {'a': 1, 1: 2, 2: 1} >>> 'hello world'.count() {' ': 1, 'e': 1, 'd': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1}

Re: list-comprehension and map question (simple)

2005-03-27 Thread Nicolas Évrard
* Charles Hartman [16:51 27/03/05 CEST]: I understand this toy example: lines = "this is a group\nof lines of\nwords" def getlength(w): return len(w) s = map(getlength, [word for ln in lines.split() for word in ln.splitlines()]) (now s is [4, 2, 1, 5, 2, 5, 2, 5]) My question is whether there'

  1   2   >