Re: python scalability

2008-07-11 Thread Paul Hankin
On Jul 10, 5:32 am, Tim Mitchell <[EMAIL PROTECTED]> wrote: > I work on a desktop application that has been developed using python and > GTK (seewww.leapfrog3d.com).  We have around 150k lines of python code > (and 200k+ lines of C).  We also have a new project manager with a C# > background who ha

Re: MySQLdb will only import for root

2008-07-11 Thread Peter Otten
martinnorth wrote: > Diez B. Roggisch wrote: >> martinnorth schrieb: >>> Hi, >>> >>> I am running Python and MySQL on Ubuntu and have installed MySQLdb. If >>> I try to import MySQLdb I get the following error: >>> >>> ActivePython 2.5.2.2 (ActiveState Software Inc.) based on >>> Python 2.5.2 (r25

Re: palindrome function

2008-07-11 Thread Peter Otten
Denis Kasak wrote: > Basically, it reverses the list in place, so it modifies the list which > called it. It does not return a /new/ list which is a reversed version > of the original, as you expected it to. Since it doesn't return anything > explicitly, Python makes it return None. Hence, the com

Re: Help with using findAll() in BeautifulSoup

2008-07-11 Thread Stefan Behnel
Alexnb wrote: > Okay, I am not sure if there is a better way of doing this than findAll() but > that is how I am doing it right now. Consider using lxml.html and lxml.cssselect. http://codespeak.net/lxml/ > I am making an app that screen scapes > dictionary.com for definitions. Do they have a

Re: python scalability

2008-07-11 Thread Dan Stromberg
On Thu, 10 Jul 2008 16:32:38 +1200, Tim Mitchell wrote: > Hi All, > > I work on a desktop application that has been developed using python and > GTK (see www.leapfrog3d.com). We have around 150k lines of python code > (and 200k+ lines of C). We also have a new project manager with a C# > backgr

Re: read file into list of lists

2008-07-11 Thread Paddy
On Jul 11, 9:32 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 11, 11:35 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > > > On Jul 11, 2:15 pm, antar2 <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I can not find out how to read a file into a list of lists. I know how > > > to split a text into

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Terry Reedy
Ben Finney wrote: So, in summary, despite the appearance of the "Python 3.0" page on the wiki, there's really no single clearing-house source of Python 3.0 information that is maintained. The interested party needs to know a half-dozen different resources to find out what's changing, and none

Re: Using the Random Module.

2008-07-11 Thread Dan Stromberg
On Fri, 11 Jul 2008 12:27:32 -0700, castironpi wrote: > On Jul 11, 1:29 pm, WDC <[EMAIL PROTECTED]> wrote: >> On Jul 11, 2:15 pm, Michiel Overtoom <[EMAIL PROTECTED]> wrote: >> >> > You wrote... >> > >Is there a better way to do that besides doing this: >> >> > random.randint(0

Help with BeautifulSoup

2008-07-11 Thread Alexnb
Okay, heres the general idea of the html I have to work with: noun verb Okay, I left off some stuff. But what I need to do is get what is inside each and then each . But the key is that I need everything in the EXACT order that it would be in the html. I can

Re: Converting from local -> UTC

2008-07-11 Thread Gabriel Genellina
En Fri, 11 Jul 2008 15:42:37 -0300, Keith Hughitt <[EMAIL PROTECTED]> escribi�: I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to MySQL (which treats all d

Re: variable question

2008-07-11 Thread Robert Lehmann
On Fri, 11 Jul 2008 20:13:04 -0700, happy wrote: > Can a variable be considered the simplest of the data structures. I am > tutoring some kids about basics of programming using python. Not an > expert in computer sciences, but am a python enthusiast. Why do you need this additional layer of indir

spam

2008-07-11 Thread rickman
spam -- http://mail.python.org/mailman/listinfo/python-list

Re: decorator to prevent adding attributes to class?

2008-07-11 Thread Michele Simionato
On Jul 11, 9:24 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > Robert Bossy wrote: > > class Foo(Freezeable): > > def __init__(self): > > self.bar = 42 > > self.freeze() # ok, we set all variables, no more from here > > > x = Foo() > > print x.bar > > x.bar = -42 > > print x.bar > > x.baz = "OMG! A t

Re: Pickle and wx.TextCtrl

2008-07-11 Thread Gabriel Genellina
En Fri, 11 Jul 2008 10:15:36 -0300, <[EMAIL PROTECTED]> escribió: Trying to read a pickled filed and list contents. The attached program works using pprint, but I want to write to my frame. WriteText only produces half of the records. What is happening? What do you mean by "only produces half

Help with using findAll() in BeautifulSoup

2008-07-11 Thread Alexnb
Okay, I am not sure if there is a better way of doing this than findAll() but that is how I am doing it right now. I am making an app that screen scapes dictionary.com for definitions. However, I would like to have the type of the word for each definition. For example if def1 and def2 are noun def

Re: paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-11 Thread Andrew Thompson
On Jul 12, 1:18 pm, Kevin McMurtrie <[EMAIL PROTECTED]> wrote: ... > I strongly recommend dropping all articles with "googlegroups.com" in > the Message-ID.   I strongly recommend setting follow-ups in inane, multi-posted, spam based threads. F-U set to cam.misc, since I do not read it, and do no

Re: paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-11 Thread Kevin McMurtrie
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > WDC <[EMAIL PROTECTED]> writes: > > > On Jul 10, 10:33 pm, 128 <[EMAIL PROTECTED]> wrote: > > […] > > > > > Is that spam i spy? > > It is, clearly. Please don't make the problem worse by repeating the > entire thing. I

variable question

2008-07-11 Thread happy
Can a variable be considered the simplest of the data structures. I am tutoring some kids about basics of programming using python. Not an expert in computer sciences, but am a python enthusiast. I wanted to know if it is correct to say a variable is a data structure, it has a name and a value. Pu

Re: palindrome function

2008-07-11 Thread Paul McGuire
On Jul 11, 6:20 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > Try this: > > > spam = ['a', 'n', 'n', 'a'] > > eggs = spam[:] > > if spam.reverse() == eggs: > >     print "Palindrome" > > You could also do > > >>> spam = ['a','n','n','a'] > >>> if spam == [i for i in reversed(spam)]: > >         pri

Re: MySQLdb will only import for root

2008-07-11 Thread martinnorth
Diez B. Roggisch wrote: martinnorth schrieb: Hi, I am running Python and MySQL on Ubuntu and have installed MySQLdb. If I try to import MySQLdb I get the following error: ActivePython 2.5.2.2 (ActiveState Software Inc.) based on Python 2.5.2 (r252:60911, Mar 27 2008, 16:42:08) [GCC 3.3.1 (Su

Re: palindrome function

2008-07-11 Thread Hugh M
> Basically, it reverses the list in place, so it modifies the list which > called it. It does not return a /new/ list which is a reversed version of > the original, as you expected it to. Since it doesn't return anything > explicitly, Python makes it return None. Hence, the comparison you are doin

Re: Loading just in time

2008-07-11 Thread Ben Finney
Ross Ridge <[EMAIL PROTECTED]> writes: > D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > >def calc_tax(*arg, **name): > >from calc_tax import calc_tax as _func_ > >calc_tax = _func_ > >return _func_(*arg, **name) > > This should do what you want: > > def calc_tax(*arg, **name): >

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Ben Finney
John Roth <[EMAIL PROTECTED]> writes: > library changes are all listed in PEP 3008. I assume you mean PEP 3108, "Standard Library Reorganization" http://www.python.org/dev/peps/pep-3108/>. -- \ “I have one rule to live by: Don't make it worse.” —Hazel | `\

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Ben Finney
John Roth <[EMAIL PROTECTED]> writes: > On Jul 11, 6:26 am, Benjamin <[EMAIL PROTECTED]> wrote: > > On Jul 11, 3:06 am, Ben Finney <[EMAIL PROTECTED]> > > wrote: > > > Is there a better information source, then, for the current > > > state of what's expected in Python 3.0? > > > > Look at the deve

Re: Perfect hashing for Py

2008-07-11 Thread Casey
On Jul 11, 8:01 am, [EMAIL PROTECTED] wrote: > Following links from this > thread:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > I have found this perfect hash (minimal too) > implementation:http://burtleburtle.net/bob/hash/perfect.html > > I have already translated

Re: How to serialize and deserialize the objects into memory?

2008-07-11 Thread Ben Finney
Gerhard Häring <[EMAIL PROTECTED]> writes: > You want to serialize the objects, but only keep them in memory? > That hardly makes any sense. Serialization is need if you want to > store your objects in a file or if you want to communicate (via > network) with other processes. If one needs to do f

Re: Using SWIG to build C++ extension

2008-07-11 Thread Bas Michielsen
mk wrote: > Hello, > > I'm having terrible problems building C++ extension to Python 2.4 using > SWIG. I'd appreciate if somebody knowledgeable at the subject took a > look at it. swig-1.3.29, g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52). > > I used following commands to build C++ extension: > >

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-11 Thread Nobody Here
rickman <[EMAIL PROTECTED]> wrote: > spam No fucking shit, Sherlock, why double the volume by pointing out the obvious? -- http://mail.python.org/mailman/listinfo/python-list

Re: palindrome function

2008-07-11 Thread Mensanator
On Jul 11, 5:34 pm, Denis Kasak <[EMAIL PROTECTED]> wrote: > On Sat, Jul 12, 2008 at 12:22 AM, kdt <[EMAIL PROTECTED]> wrote: > >  > Hi all, >  > >  > Can someone please explain to me why the following evaluates as false? >  > >  list=['a','n','n','a'] >  list==list.reverse() >  False >

Re: Moving to functional programming

2008-07-11 Thread George Sakkis
On Jul 11, 1:00 pm, James Fassett <[EMAIL PROTECTED]> wrote: > Hi all, > > Had a simple problem that turned into an interesting solution and I > thought I would share it here. > > I had a list of tuples that I needed to get the first value from and > generate a list. > > tuple_list = ( >     ('John

Re: palindrome function

2008-07-11 Thread bearophileHUGS
Denis Kasak: > spam = ['a', 'n', 'n', 'a'] > eggs = spam[:] > if spam.reverse() == eggs: > print "Palindrome" An alternative version: >>> txt = "anna" >>> txt == txt[::-1] True >>> txt = "annabella" >>> txt == txt[::-1] False Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-

PyQt QScrollView/QGridLayout question

2008-07-11 Thread Samir Grover
folks, I am trying put some user input fields into a scrollable (QScrollView) window. So, I placed a QLabel at 0,0 and QLineEdit at 0,1, next to QLabel. Somehow, results are not what I am expecting.It is placing QLineEdit below QLabel. I am not using designer for this. Please, notice that I con

Re: palindrome function

2008-07-11 Thread kdt
On Jul 11, 11:34 pm, Denis Kasak <[EMAIL PROTECTED]> wrote: > On Sat, Jul 12, 2008 at 12:22 AM, kdt <[EMAIL PROTECTED]> wrote: > >  > Hi all, >  > >  > Can someone please explain to me why the following evaluates as false? >  > >  list=['a','n','n','a'] >  list==list.reverse() >  False

Re: palindrome function

2008-07-11 Thread Denis Kasak
On Sat, Jul 12, 2008 at 12:22 AM, kdt <[EMAIL PROTECTED]> wrote: > Hi all, > > Can someone please explain to me why the following evaluates as false? > list=['a','n','n','a'] list==list.reverse() False > > I'm stumped :s Read the documentation on list.reverse(). Basically, it reverse

Re: Loading just in time

2008-07-11 Thread Ross Ridge
D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >def calc_tax(*arg, **name): >from calc_tax import calc_tax as _func_ >calc_tax = _func_ >return _func_(*arg, **name) This should do what you want: def calc_tax(*arg, **name): global calc_tax from calc

palindrome function

2008-07-11 Thread kdt
Hi all, Can someone please explain to me why the following evaluates as false? >>>list=['a','n','n','a'] >>>list==list.reverse() >>>False I'm stumped :s -- http://mail.python.org/mailman/listinfo/python-list

Re: Graphics

2008-07-11 Thread Glenn Hutchings
vanam <[EMAIL PROTECTED]> writes: > hi all > i am new to python programming a beginner. I Came to know from the > groups that "How to think like a computer scientist" is preferable for > begineers. i just looking through that i came to one section where a > sample program for generation of graphic

Re: ANN: P4D 1.1

2008-07-11 Thread Kay Schluehr
On 11 Jul., 15:25, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Jul 11, 10:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > P4D = E4X style embedded DSL for Python but without E and X. > > > For more information see: > > >http://pypi.python.org/pypi/P4D/1.1-py2.5 > > That looks a lot like YAML. Any

Re: error with configure (svn 64857)

2008-07-11 Thread Martin v. Löwis
> If didn't investigate everything but I solved the problem by adding > the "-static-libgcc" option: > > CFLAGS="-w -static-intel -static-libgcc" > > I think one should commit changes so configure can manage this. I don't think that change should be made. I'm almost certain that it is correct. M

Adding a Cairo object into a vbox using pygtk

2008-07-11 Thread Mr SZ
Hi , I am trying to attach a cairo object into a vbox.I can pack a textbox with the following code:     entry = gtk.Entry()     entry.set_max_length(50)     entry.connect("activate", self.enter_callback, entry)     entry.set_text("hello")     entry.insert_text(" world", len(entry.get_text()))   

Re: Determining when a file has finished copying

2008-07-11 Thread Sean DiZazzo
On Jul 9, 5:34 pm, keith <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > > Ethan Furman wrote: > > writeson wrote: > >> Guys, > > >> Thanks for your replies, they are helpful. I should have included in > >> my initial question that I don't have as much control ove

Re: read file into list of lists

2008-07-11 Thread John Machin
On Jul 11, 11:35 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Jul 11, 2:15 pm, antar2 <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I can not find out how to read a file into a list of lists. I know how > > to split a text into a list > > > sentences = line.split(\n) > > > following text for examp

Re: Using the Random Module.

2008-07-11 Thread castironpi
On Jul 11, 1:29 pm, WDC <[EMAIL PROTECTED]> wrote: > On Jul 11, 2:15 pm, Michiel Overtoom <[EMAIL PROTECTED]> wrote: > > > You wrote... > > >Is there a better way to do that besides doing this: > > > random.randint(0, 9) > > >09657398671238769 > > > Maybe this? >

Re: Simple question, how do you tell how many items in a list?

2008-07-11 Thread WDC
On Jul 11, 2:53 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Alex Bryan wrote: > > I am just wondering how you get an integer value for how many items > > there are in a list, preferably w/o a for loop. > > Read the library reference sections on built-in functions and classes. Quite simple. If I

Re: decorator to prevent adding attributes to class?

2008-07-11 Thread Neal Becker
Robert Bossy wrote: > class Foo(Freezeable): > def __init__(self): > self.bar = 42 > self.freeze() # ok, we set all variables, no more from here > > > x = Foo() > print x.bar > x.bar = -42 > print x.bar > x.baz = "OMG! A typo!" > Pretty nice, but unfortunately the subclass has to remember to c

Re: Filechooser issues

2008-07-11 Thread Jerry Hill
On Fri, Jul 11, 2008 at 3:09 PM, Mr SZ <[EMAIL PROTECTED]> wrote: > ff = gtk.FileFilter.add_pixbuf_formats() > The documentation doesn't say anything about an argument to be passed: > http://www.pygtk.org/docs/pygtk/class-gtkfilefilter.html#method-gtkfilefilter--add-pixbuf-formats I don't kno

Filechooser issues

2008-07-11 Thread Mr SZ
Hi, I am using a gtk.filechooser dialog to open and save files.How do I add a filter so that only images are filtered ?I did something like this:     def get_save_filename(self):         filename = None     chooser = gtk.FileChooserDialog("Save File...", self.window,

Re: Moving to functional programming

2008-07-11 Thread Terry Reedy
[EMAIL PROTECTED] wrote: James Fassett: # the first Pythonic attempt using comprehensions result_list = [x[0] for x in tuple_list] This has the virtue of working for tuples of any length and doing the minimal work required. # the final functional way [result_list, _] = zip(*tuple_list)

Re: Simple question, how do you tell how many items in a list?

2008-07-11 Thread Terry Reedy
Alex Bryan wrote: I am just wondering how you get an integer value for how many items there are in a list, preferably w/o a for loop. Read the library reference sections on built-in functions and classes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Terry Reedy
Ben Finney wrote: "Martin v. Löwis" <[EMAIL PROTECTED]> writes: This is rather disappointing. Is that entire page suspect? All documentation about Python 3 is suspect until Python 3 gets actually released (nobody can say for sure how the release will look like in all details). Is there a b

imaplib -- can't read body

2008-07-11 Thread Sells, Fred
I'm trying to read mail using the imaplib module. I can get the subject and date, but not the body, have not found any example on how to do that and I don't know much about imap. Here's what I have, working as noted... If anyone can show me what I'm missing in order to get the body of a mail

Converting from local -> UTC

2008-07-11 Thread Keith Hughitt
Hi, I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to MySQL (which treats all dates at local dates by default), it will already have incorporated the proper UT

Re: Python with Ecmascript

2008-07-11 Thread Daniel Fetchinson
>>>NJSModule? >>>http://en.wikipedia.org/wiki/NJS > >> This seems to be very good indeed. Just downloaded njs but the only >> njsmodule version I could find was for python 2.1. Does anyone have a >> recent copy? > > 1. You might ask here: > http://lists.njs-javascript.org/cgi-bin/mailman/listinfo/u

Re: Using the Random Module.

2008-07-11 Thread WDC
On Jul 11, 2:15 pm, Michiel Overtoom <[EMAIL PROTECTED]> wrote: > You wrote... > >Is there a better way to do that besides doing this: > > random.randint(0, 9) > >09657398671238769 > > Maybe this? > >         random.randint(0, 9e16) > > -- > "The ability of the O

Re: Moving to functional programming

2008-07-11 Thread sturlamolden
On Jul 11, 12:00 pm, James Fassett <[EMAIL PROTECTED]> wrote: > tuple_list = ( >     ('John', 'Doe'), >     ('Mark', 'Mason'), >     ('Jeff', 'Stevens'), >     ('Bat', 'Man') >   ) > > # what I'd do in C or other procedural languages > result_list = [] > for item in tuple_list: >     result_list.a

Re: Using the Random Module.

2008-07-11 Thread Michiel Overtoom
You wrote... >Is there a better way to do that besides doing this: > random.randint(0, 9) >09657398671238769 Maybe this? random.randint(0, 9e16) -- "The ability of the OSS process to collect and harness the collective IQ of thousands of individuals

Re: ActiveState Code: the new Python Cookbook site

2008-07-11 Thread Trent Mick
Peter Otten wrote: Thin Myrna wrote: The old cookbook offered choices by category. Did you drop that feature? Looks like categories have become tags: http://code.activestate.com/recipes/tags/ Yes, that is correct. I should document the tag names to category mapping that I've used (mostly

Re: Python with Ecmascript

2008-07-11 Thread Alan Isaac
NJSModule? http://en.wikipedia.org/wiki/NJS Daniel Fetchinson wrote: This seems to be very good indeed. Just downloaded njs but the only njsmodule version I could find was for python 2.1. Does anyone have a recent copy? 1. You might ask here: http://lists.njs-javascript.org/cgi-bin/mailman/

Re: strip() using strings instead of chars

2008-07-11 Thread Duncan Booth
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > In Python programs, you will quite frequently find code like the > following for removing a certain prefix from a string: > > if url.startswith('http://'): > url = url[7:] If I came across this code I'd want to know why they weren't using ur

spam

2008-07-11 Thread rickman
spam -- http://mail.python.org/mailman/listinfo/python-list

Re: Using SWIG to build C++ extension

2008-07-11 Thread mk
And what's infuriating is that the .o files do contain the necessary symbol: # grep _Z13edit_distanceRSsS_ * Binary file edit_distance.o matches Binary file _edit_distance.so matches Binary file edit_distance_wrap.o matches -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving to functional programming

2008-07-11 Thread craig75
On Jul 11, 3:36 am, [EMAIL PROTECTED] wrote: > James Fassett: > > > # the first Pythonic attempt using comprehensions > > result_list = [x[0] for x in tuple_list] > > > # the final functional way > > [result_list, _] = zip(*tuple_list) > > > I really like how Python allows me to do what I feel is t

Re: decorator to prevent adding attributes to class?

2008-07-11 Thread Michele Simionato
On Jul 11, 6:38 pm, Robert Bossy > I don't get it. Why use a metaclass? Wouldn't the following be the same, > but easier to grasp: > > class Frozen(object): >     def __setattr__(self, name, value): >        if not hasattr(self, name): >           raise AttributeError, "cannot add attributes to %s"

Using SWIG to build C++ extension

2008-07-11 Thread mk
Hello, I'm having terrible problems building C++ extension to Python 2.4 using SWIG. I'd appreciate if somebody knowledgeable at the subject took a look at it. swig-1.3.29, g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52). I used following commands to build C++ extension: # swig -c++ -python edit

Using the Random Module.

2008-07-11 Thread WDC
I am currently learning, and loving, Python and have a question about random(). Right now, what I have to do to get a whole number and not a decimal using random.random() is this: >>>random.random() 0.84765728501856734 >>>_ * 10**17 84765728501856734.0 Is there a better way to do that besides do

Re: decorator to prevent adding attributes to class?

2008-07-11 Thread Robert Bossy
Michele Simionato wrote: This article could give you same idea (it is doing the opposite, warning you if an attribute is overridden): http://stacktrace.it/articoli/2008/06/i-pericoli-della-programmazione-con-i-mixin1/ There is also a recipe that does exactly what you want by means of a metaclass

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-11 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, ssecorp <[EMAIL PROTECTED]> wrote: > >>> def mod(x,y): > return x.append(y) > > >>> mod([1,2],3) > >>> k=[1,2,3] > >>> k > [1, 2, 3] > >>> l = mod(k,4) > >>> l > >>> k > [1, 2, 3, 4] > >>> l > >>> k==l > False > >>> mod(k,5) > >>> k > [1, 2, 3, 4, 5] > >>>

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-11 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Terry Reedy <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > In article > > <[EMAIL PROTECTED]>, > > ssecorp <[EMAIL PROTECTED]> wrote: > > > >> I am never redefining the or reassigning the list when using validate > >> but since it spits the modified li

Re: decorator to prevent adding attributes to class?

2008-07-11 Thread Michele Simionato
On Jul 11, 5:29 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > After spending the morning debugging where I had misspelled the name of an > attribute (thus adding a new attr instead of updating an existing one), I > would like a way to decorate a class so that attributes cannot be (easily) > added. >

Re: Editra

2008-07-11 Thread Henry Read
It has been already in wxpython-doc-demos package. On Fri, Jul 11, 2008 at 11:38 PM, Henry Read <[EMAIL PROTECTED]> wrote: > Editra is a multi-platform text editor with an implementation that focuses > on creating an easy to use interface and features that aid in code > development. Currently it

Editra

2008-07-11 Thread Henry Read
Editra is a multi-platform text editor with an implementation that focuses on creating an easy to use interface and features that aid in code development. Currently it supports syntax highlighting and variety of other useful features for over 60 programming languages. Editra is freely available un

decorator to prevent adding attributes to class?

2008-07-11 Thread Neal Becker
After spending the morning debugging where I had misspelled the name of an attribute (thus adding a new attr instead of updating an existing one), I would like a way to decorate a class so that attributes cannot be (easily) added. I guess class decorators are not available yet (pep 3129), but prob

Re: read file into list of lists

2008-07-11 Thread Jeffrey Froman
Laurent Rahuel wrote that antar2 wrote: >> following text for example should be considered as a list of lists (3 >> columns and 3 rows), so that when I make the print statement list[0] >> [0], that the word pear appears >> >> >> pear noun singular >> books nouns plural >> table noun singular Fi

Re: strip() using strings instead of chars

2008-07-11 Thread Marc 'BlackJack' Rintsch
On Fri, 11 Jul 2008 16:45:20 +0200, Christoph Zwerschke wrote: > Bruno Desthuilliers schrieb: >> DRY/SPOT violation. Should be written as : >> >> prefix = 'http://' >> if url.startswith(prefix): >> url = url[len(prefix):] > > That was exactly my point. This formulation is a bit better, bu

Re: win32com.client (Howto edit Contacts in Outlook)

2008-07-11 Thread Tim Golden
Bill Davy wrote: Traceback (most recent call last): File "H:/Personal/OutlookIF1/t2.py", line 18, in outlook = win32com.client.gencache.EnsureDispatch ("Outlook.Application") File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 536, in EnsureDispatch mod = EnsureM

Re: strip() using strings instead of chars

2008-07-11 Thread Christoph Zwerschke
Bruno Desthuilliers schrieb: DRY/SPOT violation. Should be written as : prefix = 'http://' if url.startswith(prefix): url = url[len(prefix):] That was exactly my point. This formulation is a bit better, but it still violates DRY, because you need to type "prefix" two times. It is exac

Re: Unit Testing Techniques

2008-07-11 Thread Matthew Fitzgibbons
I'm by no means a testing expert, but I'll take a crack at it. Casey McGinty wrote: I'm familiar with the unittest module in Python, however I'm hoping someone can point me to some examples of more advanced usages of the framework. For example: 1. Using the framework to test a package with ne

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread John Roth
On Jul 11, 6:26 am, Benjamin <[EMAIL PROTECTED]> wrote: > On Jul 11, 3:06 am, Ben Finney <[EMAIL PROTECTED]> > wrote: > > > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > > > > This is rather disappointing. Is that entire page suspect? > > > > All documentation about Python 3 is suspect until Py

Re: read file into list of lists

2008-07-11 Thread Gerard flanagan
antar2 wrote: Hello, I can not find out how to read a file into a list of lists. I know how to split a text into a list sentences = line.split(\n) following text for example should be considered as a list of lists (3 columns and 3 rows), so that when I make the print statement list[0] [0], tha

Re: win32com.client (Howto edit Contacts in Outlook)

2008-07-11 Thread Bill Davy
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Bill Davy wrote: >> and since then have been busy with work, and my other job, and the >> garden. > > Aha! So you're English, are you? Looks like you're in the West Country. > Weather map suggests you're not short of rain

Re: read file into list of lists

2008-07-11 Thread Paddy
On Jul 11, 2:15 pm, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I can not find out how to read a file into a list of lists. I know how > to split a text into a list > > sentences = line.split(\n) > > following text for example should be considered as a list of lists (3 > columns and 3 rows), so

Pickle and wx.TextCtrl

2008-07-11 Thread DWebre
Trying to read a pickled filed and list contents. The attached program works using pprint, but I want to write to my frame. WriteText only produces half of the records. What is happening? (See attached file: ReadDB_b.py) D. J. Webre, Jr. PE & PLS Director of Engineering & Technical Support

Re: MySQLdb will only import for root

2008-07-11 Thread Jeffrey Froman
Diez B. Roggisch wrote: >> Is it possible the module was installed with priviledges set too >> strict?  Perhaps the interpreter cannot see the module when it is run >> from a normal user account. > > Possible - certainly. Yet unrealistic, because usually root access is > required to system-wide i

Re: read file into list of lists

2008-07-11 Thread bockman
On 11 Lug, 15:15, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I can not find out how to read a file into a list of lists. I know how > to split a text into a list > > sentences = line.split(\n) > > following text for example should be considered as a list of lists (3 > columns and 3 rows), so th

Re: read file into list of lists

2008-07-11 Thread Laurent Rahuel
Hello, A way to do it === from __future__ import with_statement res = [] with open("sentences.txt","r") as f: sentences = [elem for elem in f.read().split('\n') if elem] for sentence in sentences: res.append(sentence.split()) p

Re: ANN: P4D 1.1

2008-07-11 Thread Fuzzyman
On Jul 11, 10:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > P4D = E4X style embedded DSL for Python but without E and X. > > For more information see: > > http://pypi.python.org/pypi/P4D/1.1-py2.5 That looks a lot like YAML. Any reason to use it over YAML? Michael Foord http://www.ironpythonin

read file into list of lists

2008-07-11 Thread antar2
Hello, I can not find out how to read a file into a list of lists. I know how to split a text into a list sentences = line.split(\n) following text for example should be considered as a list of lists (3 columns and 3 rows), so that when I make the print statement list[0] [0], that the word pear

Re: win32com.client (Howto edit Contacts in Outlook)

2008-07-11 Thread Tim Golden
Bill Davy wrote: and since then have been busy with work, and my other job, and the garden. Aha! So you're English, are you? Looks like you're in the West Country. Weather map suggests you're not short of rain over there :) Now I am back looking at this (and using WInUSB to talk to a Maxim 342

Re: How to serialize and deserialize the objects into memory?

2008-07-11 Thread Inyeol . Lee
On Jul 11, 12:58 pm, hardemr <[EMAIL PROTECTED]> wrote: > Hello Everyone, > > I want to serialize and deserialize the objects into Memory not into > file. How can i do that? pickle.dumps and pickle.loads. --Inyeol -- http://mail.python.org/mailman/listinfo/python-list

Re: python scalability

2008-07-11 Thread Gerhard Häring
Tim Mitchell wrote: Thanks for all the replies - they have all been helpful. On reflection I think our problems are probably design and people related. I strongly agree. "Scalability" is becoming a buzzword lately, which is meaningless unless qualified what exactly is meant. It's overused w

Re: How to serialize and deserialize the objects into memory?

2008-07-11 Thread Gerhard Häring
hardemr wrote: Hello Everyone, I want to serialize and deserialize the objects into Memory not into file. How can i do that? You want to serialize the objects, but only keep them in memory? That hardly makes any sense. Serialization is need if you want to store your objects in a file or if y

Re: using Python's AST generator for other languages

2008-07-11 Thread Benjamin
On Jul 11, 12:27 am, eliben <[EMAIL PROTECTED]> wrote: > > > 2) What is the meaning of the comment in astgen.py ? Are the Python > > > maintainers unhappy with the design of the AST ?3 > > > Node, I think, is talking about a node in the parse tree. (AST is > > generated from another parse tree.) Se

Re: strip() using strings instead of chars

2008-07-11 Thread Bruno Desthuilliers
Christoph Zwerschke a écrit : In Python programs, you will quite frequently find code like the following for removing a certain prefix from a string: if url.startswith('http://'): url = url[7:] DRY/SPOT violation. Should be written as : prefix = 'http://' if url.startswith(prefix):

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Benjamin
On Jul 11, 3:06 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > > > This is rather disappointing. Is that entire page suspect? > > > All documentation about Python 3 is suspect until Python 3 gets > > actually released (nobody can say for sure how the r

Perfect hashing for Py

2008-07-11 Thread bearophileHUGS
Following links from this thread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/179e1a45485ab36a# I have found this perfect hash (minimal too) implementation: http://burtleburtle.net/bob/hash/perfect.html I have already translated part of it to D, and it seems to work well

Re: MySQLdb will only import for root

2008-07-11 Thread Diez B. Roggisch
Jeff schrieb: Is it possible the module was installed with priviledges set too strict? Perhaps the interpreter cannot see the module when it is run from a normal user account. Possible - certainly. Yet unrealistic, because usually root access is *required* to system-wide install a package - t

Re: MySQLdb will only import for root

2008-07-11 Thread Peter Otten
martinnorth wrote: > Hi, > > I am running Python and MySQL on Ubuntu and have installed MySQLdb. If I > try to import MySQLdb I get the following error: > > ActivePython 2.5.2.2 (ActiveState Software Inc.) based on > Python 2.5.2 (r252:60911, Mar 27 2008, 16:42:08) > [GCC 3.3.1 (SuSE Linux)] on

strip() using strings instead of chars

2008-07-11 Thread Christoph Zwerschke
In Python programs, you will quite frequently find code like the following for removing a certain prefix from a string: if url.startswith('http://'): url = url[7:] Similarly for stripping suffixes: if filename.endswith('.html'): filename = filename[:-5] My problem with this is that it'

Re: socket-module: different behaviour on windows / unix when a timeout is set

2008-07-11 Thread Mirko Vogt
Gabriel Genellina wrote: > En Wed, 09 Jul 2008 15:02:56 -0300, Mirko Vogt <[EMAIL PROTECTED]> escribi�: > >> it seems that the socket-module behaves differently on unix / windows >> when a timeout is set. > [...] >> Now I will change the code slightly - to be precise I set a timeout on >> the sock

Re: PIL: Transparent PNGs and im.paste: ValueError: bad transparency mask

2008-07-11 Thread Ken Starks
Durand wrote: I posted this too soon. Converting the images to png with image magick's convert did the trick...However, I'm still not sure why I need to convert the images in the first place. Are there different types of PNGs? http://en.wikipedia.org/wiki/Portable_Network_Graphics#Transparency

  1   2   >