Re: [Tutor] Custom metaclass?

2007-04-19 Thread Andrei
Michael Hannon physics.ucdavis.edu> writes: > The approach, in essence, is a fairly standard one: redefine the > __setattr__ method to add some logic to enforce whatever restrictions > you choose, but the details are a bit convoluted. Copyright law > probably prohibits me from posting the ent

[Tutor] Custom metaclass?

2007-04-19 Thread Michael Hannon
Greetings. I've been looking at O'Reilly's "Python Cookbook", 2nd edition, just for my own edification. In particular, I'm looking at chapter 6, "Object-Oriented Programming". Recipe 6.3, "Restricting Attribute Setting", intends to solve the problem that, by default, users can add and modify

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Kent Johnson
Alan Gauld wrote: > "Alan Gauld" <[EMAIL PROTECTED]> wrote > >> it doesn't throw errors when you get an http error back, > > Oops, confusing myself here. > Its urllib2 that throws errors and nothing to do with HTMLParser. > The advantage of HTMLParser is the lack of a need for a > formatter and

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Alan Gauld
"Alan Gauld" <[EMAIL PROTECTED]> wrote > it doesn't throw errors when you get an http error back, Oops, confusing myself here. Its urllib2 that throws errors and nothing to do with HTMLParser. The advantage of HTMLParser is the lack of a need for a formatter and writer object. Sorry for any co

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote in > FWIW most real-world HTML parsers (including Beautiful Soup) seem to > be > based directly on SMTPlib, not htmllib or HTMLParser. Yes, I noticed that, although htmllib is itself based on sgmllib... And it has a better event based parsing model but un

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote > On a lawyerly note, I think your Google example violates Google's > terms > of service which prohibits any automated access. > http://www.google.com/accounts/TOS Thanks for pointing that out Kent. It probably explains why they send me a Restricted HTTP

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Kent Johnson
Tim Golden wrote: > Kent Johnson wrote: >> FWIW most real-world HTML parsers (including Beautiful Soup) seem to >> be based directly on SMTPlib, not htmllib or HTMLParser. > > I'm assuming you mean sgmllib here? :-) yes, I mean sgmllib.SGMLParser Kent ___

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Tim Golden
Kent Johnson wrote: > FWIW most real-world HTML parsers (including Beautiful Soup) seem to be > based directly on SMTPlib, not htmllib or HTMLParser. I'm assuming you mean sgmllib here? TJG ___ Tutor maillist - Tutor@python.org http://mail.python.org

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Kent Johnson
Alan Gauld wrote: > > "Switanek, Nick" <[EMAIL PROTECTED]> wrote > >> Please let us know when you have a draft of your tutorial on Beautiful >> Soup and such. I'd be eager to have a look! > > Here is the current draft, the concepts bits are all there (nothing > on Beautiful Soup as yet) but the

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Alan Gauld
"Switanek, Nick" <[EMAIL PROTECTED]> wrote Please let us know when you have a draft of your tutorial on Beautiful Soup and such. I'd be eager to have a look! Here is the current draft, the concepts bits are all there (nothing on Beautiful Soup as yet) but the example is giving me some heada

Re: [Tutor] Questions of Maths

2007-04-19 Thread Abu Ismail
Thank you very much guys, this has been most helpful. At the moment I run the program as Alan suggests. However, the goal is to incorporate the program into Glade2 GUI and I am not sure that it will work with Tk, although I must admit I have not tried it out yet. Abu Ismail On 4/18/07, János Juh

Re: [Tutor] Builtin "property" decorator hiding exceptions

2007-04-19 Thread Kent Johnson
Jacob Abraham wrote: > Hi, > >The sample script below throws the exception "AttributeError: input" > rather than the expected exception "AttributeError: non_existent_attribute". > >Please help me write a decorator or descriptor of my own that fixes the > issue. > > class Sample(objec

Re: [Tutor] Builtin "property" decorator hiding exceptions

2007-04-19 Thread Kent Johnson
Andreas Kostyrka wrote: > * Jacob Abraham <[EMAIL PROTECTED]> [070419 10:08]: >> Hi Andreas Kostyrka, >> >>I am aware that property is a data descriptor. And I still don't see why >> if can't be uses as a decorator since decorators were created to fix the >> issue. >> >> getx= property(getx)

Re: [Tutor] screen scraping web-based email (Alan Gauld)

2007-04-19 Thread Switanek, Nick
Alan, Please let us know when you have a draft of your tutorial on Beautiful Soup and such. I'd be eager to have a look! Thanks, Nick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Builtin "property" decorator hiding exceptions

2007-04-19 Thread Andreas Kostyrka
* Jacob Abraham <[EMAIL PROTECTED]> [070419 10:08]: > Hi Andreas Kostyrka, > >I am aware that property is a data descriptor. And I still don't see why > if can't be uses as a decorator since decorators were created to fix the > issue. > > getx= property(getx) Simple, they don't return func