adding a new line of text in Tk

2006-03-25 Thread nigel
Hello i have been working on an interactive programme,i wish to use a small amount of Tk.Which i have taken from a tutorial. from Tkinter import * root = Tk() w =Label(root, text="Congratulations you have made it this far,just a few more questions then i will be asking you some") w.pack() root.ma

Re: Accessing func_name from inside a function

2006-03-25 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: > "James Thiele" <[EMAIL PROTECTED]> writes: > > > I'd like to access the name of a function from inside the function. > > A function, like most other objects in Python, can have any number of > names bound to it without the object being informed. Any of tho

[ANN] InformixDB-2.2 released

2006-03-25 Thread Carsten Haese
I am pleased to announce a new release of InformixDB, the DB-API 2.0 module for connecting to IBM Informix database engines. Changes since version 2.1: - Support for BOOLEAN columns - DECIMAL and MONEY columns can be fetched as decimal.Decimal instances if the decimal module is available - auto

Re: MVC in Python for web app dev

2006-03-25 Thread m . wanstall
Thanks Rune. I've already checked out Django and TG and have found both the projects to be a little misguided. I think the one great thing they have over Rails is the use of SQLObject because the implicit mapping of data models via the "plural" approach of Rails is a bit of a quirk to me, I just do

Re: pondering about the essence of types in python

2006-03-25 Thread Steven Bethard
gangesmaster wrote: > but __mro__ is a readonly attribute, and deriving from instances is > impossible (conn.modules.wx.Frame is a PROXY to the class)... Maybe I'm misunderstanding, but why is an instance a proxy to a class? Why don't you make a class a proxy to the class? STeVe -- http://mail.

Re: image reduction script

2006-03-25 Thread Kamilche
To reduce the color depth of an image in PIL: im = im.convert(mode="P", palette=Image.ADAPTIVE) -- http://mail.python.org/mailman/listinfo/python-list

Re: object references

2006-03-25 Thread DrConti
Felipe Almeida Lessa schrieb: > Em Sáb, 2006-03-25 às 21:33 -0800, DrConti escreveu: > [snip] > > There was also a suggestion to write a real problem where referencing > > is really needed. > > I have one...: > [snap] > > There are loads of discussions about the code you wrote... but... isn't > ba

Re: object references

2006-03-25 Thread Felipe Almeida Lessa
Em Sáb, 2006-03-25 às 21:33 -0800, DrConti escreveu: [snip] > There was also a suggestion to write a real problem where referencing > is really needed. > I have one...: [snap] There are loads of discussions about the code you wrote... but... isn't bad practice to put the same data in two places? O

object references

2006-03-25 Thread DrConti
Dear Python developer community, I'm quite new to Python, so perhaps my question is well known and the answer too. I need a variable alias ( what in other languages you would call "a pointer" (c) or "a reference" (perl)) I read some older mail articles and I found that the offcial position about

Re: is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread John Salerno
Dennis Lee Bieber wrote: > WinXP? What error do you get from the wizard? (You are running in an > Admin privilege I presume). Yes, WinXP and admin. At first, when Norton was running, I got a 1045 error message saying to allow TCP port 3306. I tried creating a rule to do this, but it didn

Re: MVC in Python for web app dev

2006-03-25 Thread Rune Strand
[EMAIL PROTECTED] wrote: > Please let me state off the cuff that I'm not after a big "Python Vs > Ruby" war or anything here! I'm trying to make the switch to Python for > my web development work as I've been using it for quite some time for > other programming work (albeit mainly hobby and person

MVC in Python for web app dev

2006-03-25 Thread m . wanstall
Please let me state off the cuff that I'm not after a big "Python Vs Ruby" war or anything here! I'm trying to make the switch to Python for my web development work as I've been using it for quite some time for other programming work (albeit mainly hobby and personal interest projects) as I'm getti

Re: What's The Best Editor for python

2006-03-25 Thread Patrick Stinson
emacs google: python-mode - Original Message - From: [EMAIL PROTECTED] Date: Saturday, March 25, 2006 6:10 pm Subject: Re: What's The Best Editor for python To: python-list@python.org > > Can one of you say to me what's the best editor for > > editing the python programs( for linux or wi

Re: What's The Best Editor for python

2006-03-25 Thread Andrew Gwozdziewycz
If you want something that won't get in your way, you should really use /bin/ed. It's probably simpler to use then searching the archives. /bin/ed will also run in cygwin for windows. >> Can one of you say to me what's the best editor for >> editing the python programs( for linux or windows ) -

Re: is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread John Salerno
Dennis Lee Bieber wrote: > On Sat, 25 Mar 2006 16:07:56 -0500, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> My web server told me it isn't, which is why they are sticking with >> MySQL 4.0 for now, but I'm obsessed with using the latest versions, so I >> j

Re: is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread John Salerno
Ravi Teja wrote: > Ah! An overzealous firewall! My sympathies :-). I am using the free > Kerio personal firewall on Windows. > Actually, I'm a little confused now. I turned off Norton completely (as far as I can tell), restarted, and the configuration wizard of MySQL still fails at the "Start s

Re: What's The Best Editor for python

2006-03-25 Thread jussij
> Can one of you say to me what's the best editor for > editing the python programs( for linux or windows ) The Zeus for Windows IDE has support for Python: http://www.zeusedit.com/python.html It does Python code folding, smart indenting and syntax highlighting. It also has features like proj

Re: noobie mkdir problem/question

2006-03-25 Thread Larry Bates
Except for the fact that I don't have any idea where "given" variable comes from. This works perfectly for me. It writes data into /xrefs/given.log perfectly. In the future you should cut/paste your code so we can see enough to help better. Here is my code with a few changes. import os import s

Re: Accessing func_name from inside a function

2006-03-25 Thread Steven D'Aprano
On Sun, 26 Mar 2006 10:19:36 +1000, Ben Finney wrote: > "James Thiele" <[EMAIL PROTECTED]> writes: > >> I'd like to access the name of a function from inside the function. > > A function, like most other objects in Python, can have any number of > names bound to it without the object being infor

Re: noobie mkdir problem/question

2006-03-25 Thread [EMAIL PROTECTED]
First, what version of python are you using? 2.4.2 (and some previous versions) use file() instead of open(), although open may still work. also, if your code in the previous post is still using: outputFname = given + '.log' outputFile = open(os.path.join(xrefs,outputFname), 'w') I hope you have

Re: sending emails to a list of recipients [update]

2006-03-25 Thread Larry Bates
smtplib docs http://python.active-venture.com/lib/SMTP-example.html say that the to should be a list of addresses (your emails); s.sendmail(msg['From'], emails, msg.as_string()) -Larry Bates Kun wrote: > Kun wrote: >> i have the following code: >> >> -- >> import

Re: Why are so many built-in types inheritable?

2006-03-25 Thread Fabiano Sidler
25 Mar 2006 13:58:17 -0800, Ziga Seilnacht <[EMAIL PROTECTED]>: > No, you don't have to: Okay, but I'd prefer! ;) > [a lot of python code] That's what I wanted to avoid. Additionally, the possibility to do it this way doesn't make it reasonable that is inheritable. Are there any reasons for tha

Re: years later DeprecationWarning

2006-03-25 Thread Steven D'Aprano
On Wed, 22 Mar 2006 13:59:00 -0800, Chris Lasher wrote: > Two things: > 1) math.floor returns a float, not an int. Doing an int() conversion on > a float already floors the value, anyways. No it doesn't, or rather, int() is only equivalent to floor() if you limit the input to non-negative numbers

Re: Beginner's question: executing scripts under Win XP pro

2006-03-25 Thread J Correia
"Scott Souva" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Your script may be working properly, but XP simply removes the window > after the script runs. Here is a simple fix that will stop at the end > of the script and leave the Command window open: > > print "Hello World" > r

Re: noobie mkdir problem/question

2006-03-25 Thread ProvoWallis
I understand that but I'm still puzzled. Is this the reason why I can't write files to this directory? The xrefs directory is created the way I expect it would be using mkdir but I can't seem to write to it. I thought that my results would be written to the xrefs directory here but they're ending

Re: __slots__

2006-03-25 Thread Ben Caradoc-Davies
John J. Lee wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: >>you should be using pychecker or pylint > > I'm curious, as somebody who doesn't regularly use these tools: How do > they fit into your workflow? Do you run them every few hours, every > day, every time you run functional tests, eve

Re: Accessing func_name from inside a function

2006-03-25 Thread Ben Finney
"James Thiele" <[EMAIL PROTECTED]> writes: > I'd like to access the name of a function from inside the function. A function, like most other objects in Python, can have any number of names bound to it without the object being informed. Any of those names can then be used to reference the object,

Re: pondering about the essence of types in python

2006-03-25 Thread gangesmaster
i was taking about python... -- http://mail.python.org/mailman/listinfo/python-list

Re: sending emails to a list of recipients

2006-03-25 Thread Gerard Flanagan
Kun wrote: > i have the following code: > > -- > import smtplib > > from email.MIMEText import MIMEText > fp = open('confirmation.txt', 'rb') > msg = MIMEText(fp.read()) > > From = '[EMAIL PROTECTED]' > > msg['Subject'] = 'Purchase Confirmation' > msg ['From'] = Fr

Re: noobie mkdir problem/question

2006-03-25 Thread [EMAIL PROTECTED]
if (os.path.isdir(xrefs) == 0): os.mkdir(xrefs) os.path.isdir(stuff) returns True or False -- http://mail.python.org/mailman/listinfo/python-list

Re: __slots__

2006-03-25 Thread Alex Martelli
John J. Lee <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > [...] > > you should be using pychecker or pylint > [...] > > I'm curious, as somebody who doesn't regularly use these tools: How do > they fit into your workflow? Do you run them every few hours, every > day, e

Re: is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread Ravi Teja
Ah! An overzealous firewall! My sympathies :-). I am using the free Kerio personal firewall on Windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: __slots__

2006-03-25 Thread John J. Lee
[EMAIL PROTECTED] (Alex Martelli) writes: [...] > you should be using pychecker or pylint [...] I'm curious, as somebody who doesn't regularly use these tools: How do they fit into your workflow? Do you run them every few hours, every day, every time you run functional tests, every release, every

Re: (not really) randon ideas

2006-03-25 Thread [EMAIL PROTECTED]
regarding the constants, this is more for the "vm" (and type safety). actually enums, constants and symbols can prolly be implemented more or less the same. -- http://mail.python.org/mailman/listinfo/python-list

Re: sending emails to a list of recipients [update]

2006-03-25 Thread Kun
Kun wrote: > i have the following code: > > -- > import smtplib > > from email.MIMEText import MIMEText > fp = open('confirmation.txt', 'rb') > msg = MIMEText(fp.read()) > > From = '[EMAIL PROTECTED]' > > msg['Subject'] = 'Purchase Confirmation' > msg ['From'] =

sending emails to a list of recipients

2006-03-25 Thread Kun
i have the following code: -- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From = '[EMAIL PROTECTED]' msg['Subject'] = 'Purchase Confirmation' msg ['From'] = From msg['To'] = emails s = smtplib

Re: simple string search and replace

2006-03-25 Thread Steve Holden
Kun wrote: > hey guys, here's my code, > > senders = [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend > <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS > (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] > print senders > parsed_senders = [] > sender = "" > for i

Re: pondering about the essence of types in python

2006-03-25 Thread Steve Holden
gangesmaster wrote: > let's start with a question: > > == > class z(object): > > ... def __init__(self): > ... self.blah=5 > ... > class x(object): > > ... def __init__(self): > ... z.__init__(self) > ... > y=x() > > Traceback (most recent

Re: using regex to pull out email addresses

2006-03-25 Thread Arne Ludwig
>>> senderlist="na nu [EMAIL PROTECTED] hu [EMAIL PROTECTED] [EMAIL PROTECTED] >>> fa hu" >>> print [ s[0] for s in re.findall("(\w+@(\w+\.)+\w+)",senderlist) ] ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] -- http://mail.python.org/mailman/listinfo/python-list

Re: is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread John Salerno
Ravi Teja wrote: > Yes! It does. > > Assuming that you are not terribly bandwidth constrained, isn't it > easier for you to try it > yourself on your own machine than wait for other people to assure you, > given that both are free and pretty much run on any platform? > Yeah, actually I went ahea

Re: Why are so many built-in types inheritable?

2006-03-25 Thread Ziga Seilnacht
Fabiano Sidler wrote: [snipped] > The problem with this is that the func_code attribute would contain > the code of PrintingFunction instead of func. What I wanted to do, is > to keep the original behaviour, i.e. set the variable __metaclass__ to > DebugMeta and so get debug output, without chang

Re: (not really) randon ideas

2006-03-25 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, oluoluolu wrote: > I have been programming in Python for many years, and I generally have > run into alot of the same problems repeatedly. > > What is the consensus on these ideas please? > > * enums There's a cookbook recipe: http://aspn.activestate.com/ASPN/Cookbook/P

Re: HIRING: PHP Developer

2006-03-25 Thread Jerry Stuckle
[EMAIL PROTECTED] wrote: > From: In Need - view profile > Date: Fri, Mar 24 2006 10:39 pm > Email: "In Need" <[EMAIL PROTECTED]> > Groups: hfx.forsale > Not yet ratedRating: > show options > > > Reply | Reply to Author | Forward | Print | Individual Message | Show > original | Report Abuse

noobie mkdir problem/question

2006-03-25 Thread ProvoWallis
Hi, I'm trying to write a script that will create a new directory and then write the results to this newly created directory but it doesn't seem to work for me and I don't know why. I'm hoping someone can see my mistake or at least point me in the right direction. I start like this capturing the

Re: is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread Ravi Teja
Yes! It does. Assuming that you are not terribly bandwidth constrained, isn't it easier for you to try it yourself on your own machine than wait for other people to assure you, given that both are free and pretty much run on any platform? -- http://mail.python.org/mailman/listinfo/python-list

using regex to pull out email addresses

2006-03-25 Thread Kun
i have a regular expression that searches a string and plucks out email addresses however it doesn't work for email addresses w/a subdomain e.g. [EMAIL PROTECTED] emails = re.findall('([EMAIL PROTECTED])', senderlist) <-- my code is there any way to modify that to include email addresses that

Re: Why are so many built-in types inheritable?

2006-03-25 Thread Fabiano Sidler
Kent Johnson <[EMAIL PROTECTED]> wrote: > You could do this with a simple decorator: > http://wiki.python.org/moin/PythonDecoratorLibrary#head-d4ce77c6d6e75aad25baf982f6fec0ff4b3653f4 > > or I think your class PrintingFunction would work as > class PrintingFunction(object): >def __init__(self,

Re: simple string search and replace

2006-03-25 Thread bearophileHUGS
Generally, to remove a substring (like ">") from a string you can use the replace method (that returns a new string): >>> s = "...anon.wharton.com>..." >>> s.replace(">", "") '...anon.wharton.com...' You can use it with something like: print [s.replace(">", "") for s in parsed_senders] or you ca

is mysqlsb compatible with MySQL 5.0?

2006-03-25 Thread John Salerno
My web server told me it isn't, which is why they are sticking with MySQL 4.0 for now, but I'm obsessed with using the latest versions, so I just want to be sure. According to the mysqldb download page at sourceforge, it is compatible with 5.0 Thanks. -- http://mail.python.org/mailman/listinfo

Re: a somewhat off-topic question about linux

2006-03-25 Thread John Salerno
Duncan Booth wrote: > John Salerno wrote: > >> I'm interested in trying out Linux, probably Ubuntu, but I was wondering >> which distribution you guys like to use (because it's a pain trying to >> decide!) and you guys are smart. > > If you just want to try out Linux then a very easy way is to

(not really) randon ideas

2006-03-25 Thread oluoluolu
I have been programming in Python for many years, and I generally have run into alot of the same problems repeatedly. What is the consensus on these ideas please? * enums * constants * an imagefile ala smalltalk * symbols ala lisp/scheme thx in advance -- http://mail.python.org/mailman/listinf

simple string search and replace

2006-03-25 Thread Kun
hey guys, here's my code, senders = [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] print senders parsed_senders = [] sender = "" for item in senders: if isinst

Re: a somewhat off-topic question about linux

2006-03-25 Thread Duncan Booth
John Salerno wrote: > I'm interested in trying out Linux, probably Ubuntu, but I was wondering > which distribution you guys like to use (because it's a pain trying to > decide!) and you guys are smart. If you just want to try out Linux then a very easy way is to use VMWare Player: download it

Re: detecting drives for windows and linux

2006-03-25 Thread BWill
Tim Golden wrote: > BWill wrote: >> Hi, I'm writing a file browser, but I'm not sure how I could go about >> detecting the drives available on windows and linux systems (preferably >> using the standard modules if possible). I guess I could just try to >> list root on each letter of the alphabet fo

pondering about the essence of types in python

2006-03-25 Thread gangesmaster
let's start with a question: == >>> class z(object): ... def __init__(self): ... self.blah=5 ... >>> class x(object): ... def __init__(self): ... z.__init__(self) ... >>> y=x() Traceback (most recent call last): File "", line 1, in ? File "", line 3, in

Re: a somewhat off-topic question about linux

2006-03-25 Thread John Salerno
Christoph Haas wrote: > On Sat, Mar 25, 2006 at 03:09:53PM -0500, John Salerno wrote: >> I'm interested in trying out Linux, probably Ubuntu, but I was wondering >> which distribution you guys like to use (because it's a pain trying to >> decide!) and you guys are smart. > > We had this discussi

Re: Comparisons and singletons

2006-03-25 Thread Felipe Almeida Lessa
Em Sáb, 2006-03-25 às 09:11 -0800, Ziga Seilnacht escreveu: > Python has a special internal list of integers in which it caches > numbers smaller than 1000 (I'm not sure that the number is correct), > but that is an implementation detail and you should not rely on it. By testing: >>> a = 10 >>> b

Re: detecting drives for windows and linux

2006-03-25 Thread Tim Golden
BWill wrote: > Hi, I'm writing a file browser, but I'm not sure how I could go about > detecting the drives available on windows and linux systems (preferably > using the standard modules if possible). I guess I could just try to > list root on each letter of the alphabet for windows and see if it

Re: a somewhat off-topic question about linux

2006-03-25 Thread Christoph Haas
On Sat, Mar 25, 2006 at 03:09:53PM -0500, John Salerno wrote: > I'm interested in trying out Linux, probably Ubuntu, but I was wondering > which distribution you guys like to use (because it's a pain trying to > decide!) and you guys are smart. We had this discussion a couple of time during the

a somewhat off-topic question about linux

2006-03-25 Thread John Salerno
I'm interested in trying out Linux, probably Ubuntu, but I was wondering which distribution you guys like to use (because it's a pain trying to decide!) and you guys are smart. And to keep it Python related, I'll also ask, is there anything special I need to know about using Python on Linux? Do

Re: a problem to solve

2006-03-25 Thread John Salerno
[EMAIL PROTECTED] wrote: > Well, I don't get the prize for most elegant. > > But that's partly because I included the ooloop6 > function. :: snip a bunch of scary code :: :) Wow, that's impressive. My solution looks a whole lot simpler than yours, but I certainly could not have done it witho

Re: Custom behavior defined in the imported module

2006-03-25 Thread Paul McGuire
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: > > The alternatives I've come up with for the user to enable this packrat parse > > mode are: > > > > 1. Add a staticmethod enablePackrat() to the pyparsing ParserElement class, > > to modify the Parse

Re: Accessing func_name from inside a function

2006-03-25 Thread James Thiele
OK. But that's just as ugly as my attempt. -- http://mail.python.org/mailman/listinfo/python-list

Re: Custom behavior defined in the imported module

2006-03-25 Thread Paul McGuire
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: > > The alternatives I've come up with for the user to enable this packrat parse > > mode are: > > > > 1. Add a staticmethod enablePackrat() to the pyparsing ParserElement class, > > to modify the Parse

Re: Custom behavior defined in the imported module

2006-03-25 Thread Paul McGuire
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: > > The alternatives I've come up with for the user to enable this packrat parse > > mode are: > > > > 1. Add a staticmethod enablePackrat() to the pyparsing ParserElement class, > > to modify the Parse

Re: Accessing func_name from inside a function

2006-03-25 Thread Kent Johnson
James Thiele wrote: > I'd like to access the name of a function from inside the function. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062 Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Custom behavior defined in the imported module

2006-03-25 Thread Kent Johnson
Paul McGuire wrote: > The alternatives I've come up with for the user to enable this packrat parse > mode are: > > 1. Add a staticmethod enablePackrat() to the pyparsing ParserElement class, > to modify the ParserElement defintion of the internal (non-packrat) parse() > method. This method essent

detecting drives for windows and linux

2006-03-25 Thread BWill
Hi, I'm writing a file browser, but I'm not sure how I could go about detecting the drives available on windows and linux systems (preferably using the standard modules if possible). I guess I could just try to list root on each letter of the alphabet for windows and see if it works, but that s

HIRING: PHP Developer

2006-03-25 Thread HiringDivision
From: In Need - view profile Date: Fri, Mar 24 2006 10:39 pm Email: "In Need" <[EMAIL PROTECTED]> Groups: hfx.forsale Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author We are hiri

Re: Accessing func_name from inside a function

2006-03-25 Thread Martin v. Löwis
James Thiele wrote: > Is there a standard way of getting the name of a function from inside > the function? No, there isn't. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: __slots__

2006-03-25 Thread Duncan Booth
Ron Garret wrote: > [EMAIL PROTECTED] (Alex Martelli) wrote: > >> > One other question I did not get answered: is there any >> > simple example of a Pythonic use of __slots__ that does NOT >> > involve the creation of **many** instances. >> >> Since the only benefit of __slots__ is saving a fe

Re: Python types

2006-03-25 Thread Salvatore
Grazie ALex, for your comment. -- http://mail.python.org/mailman/listinfo/python-list

Accessing func_name from inside a function

2006-03-25 Thread James Thiele
I'd like to access the name of a function from inside the function. My first idea didn't work. >>> def foo(): ... print func_name ... >>> foo() Traceback (most recent call last): File "", line 1, in ? File "", line 2, in foo NameError: global name 'func_name' is not defined My second atte

Re: image reduction script

2006-03-25 Thread Philippe Martin
Larry, I actually did not find what I needed in PIL (missed it ?) but found this package quite usefull: http://www.imagemagick.org/script/index.php Philippe Larry Bates wrote: > Philippe Martin wrote: >> Hi, >> >> I need to write a script to reduce the resolution/color depth of an image >>

Re: __slots__

2006-03-25 Thread Alex Martelli
Ron Garret <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Alex Martelli) wrote: > > > > One other question I did not get answered: is there any > > > simple example of a Pythonic use of __slots__ that does NOT > > > involve the creation of **many** instances.

Re: newbie parsing question

2006-03-25 Thread Paul McGuire
"Kun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i have a list of that is: > > [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend > <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)] {37}', > 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] > > > how do i pa

Re: imap folder scanner

2006-03-25 Thread Sebastjan Trepca
"senders" is list, that is why that regex does not work. I don't like regexes that much so you can try this:parsed_senders = []sender = ""for item in senders:   if isinstance(item,tuple):   item= ''.join(item)   if item==')':  parsed_senders.append(sender[sender.find('From:')+5:].strip())  

Re: Python types

2006-03-25 Thread Alex Martelli
Salvatore <[EMAIL PROTECTED]> wrote: > Thank's everybody :-) > > > Here is a type définition I've found on the net which I agree with : > > Attribute of a variable which determines the set of the values this > variabe can take and the > operations we can apply on it. Hmmm -- that doesn't work

Re: __slots__

2006-03-25 Thread Ron Garret
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: > > One other question I did not get answered: is there any > > simple example of a Pythonic use of __slots__ that does NOT > > involve the creation of **many** instances. > > Since the only benefit of __slots__ is saving

Custom behavior defined in the imported module

2006-03-25 Thread Paul McGuire
I have a new enhancement to pyparsing that doubles the parse speed (using a technique called "packrat parsing"), but which is not suitable for all parsers, specifically those that have complex parse actions. I don't want to just enable this feature by default - I think there is too much risk of it

Re: check object being a compiled regular expression

2006-03-25 Thread Diez B. Roggisch
Helmut Jarausch schrieb: > Hi, > sorry, this seems to be a FAQ but I couldn't find anything > > I need to check if an object is a compiled regular expression > > Say > import re > RX= re.compile('^something') > > how to test > > "if RX is a compiled regular expression" > > type(RX) says > >

Re: Comparisons and singletons

2006-03-25 Thread Ziga Seilnacht
David Isaac wrote: > "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > >>> a = 1 > > >>> b = 1 > > >>> a == b > > True > > >>> a is b > > False > > Two follow up questions: > > 1. I wondered about your example, > and noticed > >>> a = 10 > >>> b = 10 > >>> a

Re: Python types

2006-03-25 Thread Salvatore
Thank's everybody :-) Here is a type définition I've found on the net which I agree with : Attribute of a variable which determines the set of the values this variabe can take and the operations we can apply on it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python types

2006-03-25 Thread BWill
Salvatore wrote: > Hello, > > I've read several articles where it's said that Python is weakly typed. > I'm a little surprised. All objects seem to have a perfectly defined > type > > Am i wrong? > > Regards > Aye, the other posters are right about you being right. This is just one of the grea

Re: check object being a compiled regular expression

2006-03-25 Thread James Thiele
This is crude, but works: >>> import re >>> RX= re.compile('^something') >>> str(RX).find("<_sre.SRE_Pattern") == 0 True -- http://mail.python.org/mailman/listinfo/python-list

Re: how to format a return value by using re.sub(regx,rep1,str)?

2006-03-25 Thread Paul McGuire
"dongdong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > for example: > re.sub(']+)+\s?>[^<^>]*','',' asd ga href="http://www.sine.com"; class="wordstyle"> asdgasdghae rha') > > I wish to get the return value "asd ga asdgasdghae rha",how do do? > I have a impression on "%" and "{nu

Re: MySQLDB - return strange type of variable

2006-03-25 Thread Jeffrey Froman
Grzegorz Smith wrote: > Hi all. I'm trying get data from text field in MySQl 5.0 with my National > characters. Data are stored in utf8 encodings. Here is the script: > import MySQLdb, MySQLdb.cursors > conn = MySQLdb.connect(host='localhost', user='root', passwd='123456', > db='profile_locale') >

Re: Comparisons and singletons

2006-03-25 Thread Chris Mellon
On 3/25/06, David Isaac <[EMAIL PROTECTED]> wrote: > "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > >>> a = 1 > > >>> b = 1 > > >>> a == b > > True > > >>> a is b > > False > > Two follow up questions: > > 1. I wondered about your example, > and noticed >

check object being a compiled regular expression

2006-03-25 Thread Helmut Jarausch
Hi, sorry, this seems to be a FAQ but I couldn't find anything I need to check if an object is a compiled regular expression Say import re RX= re.compile('^something') how to test "if RX is a compiled regular expression" type(RX) says but if isinstance(RX,_sre.SRE_Pattern) and if isinstanc

Re: __slots__

2006-03-25 Thread Alex Martelli
David Isaac <[EMAIL PROTECTED]> wrote: ... > Does this beg the question of whether __slots__ > *should* break with inheritance? How would you expect the following code to behave: class Base(object): def __init__(self): self.x = 23 class Derived(Base): __slots__ = 'y', ? I would expe

Re: Comparisons and singletons

2006-03-25 Thread David Isaac
"Ziga Seilnacht" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>> a = 1 > >>> b = 1 > >>> a == b > True > >>> a is b > False Two follow up questions: 1. I wondered about your example, and noticed >>> a = 10 >>> b = 10 >>> a is b True Why the difference? 2. If I really w

Re: overlapping sets

2006-03-25 Thread Alex Martelli
Lonnie Princehouse <[EMAIL PROTECTED]> wrote: > There is a sets.Set class built in to Python. You might want to use In 2.4, there's also a set builtin type -- you can keep using the sets module from the standard library, but the built-in set is faster. If you need compatibility with both 2.3 an

Re: __slots__

2006-03-25 Thread David Isaac
"Aahz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Because __slots__ breaks with inheritance. I believe that was the point of Ziga's example, which I acknowledged as a good one in my reply. So there still appears to be this single reason, which applies if your class may be subcla

Re: What's The Best Editor for python

2006-03-25 Thread gene tani
gene tani wrote: > Christoph Zwerschke wrote: > > Just because nobody has mentioned them so far: > > http://spyced.blogspot.com/2006/02/pycon-python-ide-review.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner's question: executing scripts under Win XP pro

2006-03-25 Thread Scott Souva
On Sat, 25 Mar 2006 14:45:34 +0100, "Jean-Claude Garreau" <[EMAIL PROTECTED]> wrote: >Hi, > >I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems >with the GUI IDLE, but >when I copy the instructions in a script file, say 'test.py' and double >click on the file, I have just

Re: What's The Best Editor for python

2006-03-25 Thread gene tani
Christoph Zwerschke wrote: > Just because nobody has mentioned them so far: > > - SciTe is a perfect editor for Pyhton on Win and Linx > - PyScripter is a wonderful IDE (but only on Win) > - DrPython is a nice platform independent editor/mini-IDE > http://www.artima.com/forums/flat.jsp?forum=106

Re: Beginner's question: executing scripts under Win XP pro

2006-03-25 Thread Jean-Claude Garreau
Thank you for your answer. I did it. It executes perfectly in IDLE. I made a copy/paste from IDLE into the 'test.py' and I obseved the behavior I discribed. The script is extremely simple (it is just a test): n=0 while( n<10 ): print n,n*n n+=1 <[EMAIL PROTECTED]> a écrit dans le mes

Re: How do I handle #

2006-03-25 Thread Michael Sperlle
On Sat, 25 Mar 2006 07:06:59 +0100, Fredrik Lundh wrote: > Michael Sperlle wrote: > >> I need to write out a file containing the # comment. When I try to >> specify it as part of a literal, everything afterward turns into a >> comment. > > "turns into a comment" in what sense ? from your descri

Re: Beginner's question: executing scripts under Win XP pro

2006-03-25 Thread [EMAIL PROTECTED]
there seems to be an error in your script. Why don't you execute it directly from IDLE (F5) ? There, you should see where the problem is. -- http://mail.python.org/mailman/listinfo/python-list

Beginner's question: executing scripts under Win XP pro

2006-03-25 Thread Jean-Claude Garreau
Hi, I'm a beginner with python 2.4. I use it on Win XP Pro. I have no problems with the GUI IDLE, but when I copy the instructions in a script file, say 'test.py' and double click on the file, I have just a console window for a few moments, no output shown and the window closes automatically be

  1   2   >