Re: [Tutor] Web framework: looking for python-tutor's angle.

2009-08-17 Thread Mal Wanstall
On Fri, Aug 14, 2009 at 4:09 AM, Mac Ryan wrote: > A couple of months ago I took the time to read a few articles on python > web application frameworks and I got the impression that the two most > mature and active projects are Zope and Django. > > Zope vs. Django hits 879.000 pages on google but m

Re: [Tutor] Problems with encoding in BeautifulSoup

2009-08-17 Thread Mal Wanstall
On Tue, Aug 18, 2009 at 9:00 AM, Eduardo Vieira wrote: > Hello, I have this sample script from beautiful soup, but I keep > getting an error because of encoding. I have google for solutions but > I don't seem to understand. Even this is dealt in Beautiful Soup's doc > but I am not able to understan

Re: [Tutor] How to format JSON output within script

2009-08-17 Thread Vincent Gulinao
Got it, what I need was json.dumps. Sorry I posted too early. Thanks. On Tue, Aug 18, 2009 at 11:50 AM, Kent Johnson wrote: > On Mon, Aug 17, 2009 at 11:02 PM, Vincent > Gulinao wrote: >> I see you could pipe your output to 'python -mjson.tool', but how do I >> achieve the same within my script?

Re: [Tutor] How to format JSON output within script

2009-08-17 Thread Kent Johnson
On Mon, Aug 17, 2009 at 11:02 PM, Vincent Gulinao wrote: > I see you could pipe your output to 'python -mjson.tool', but how do I > achieve the same within my script? json.tool is a pretty simple wrapper around json.load() and json.dump(). You can look at the source code in your Python lib directo

Re: [Tutor] How to format JSON output within script

2009-08-17 Thread Mal Wanstall
On Tue, Aug 18, 2009 at 1:02 PM, Vincent Gulinao wrote: > I see you could pipe your output to 'python -mjson.tool', but how do I > achieve the same within my script? > > TIA. > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/li

Re: [Tutor] How to format JSON output within script

2009-08-17 Thread Alan Gauld
"Vincent Gulinao" wrote I see you could pipe your output to 'python -mjson.tool', but how do I achieve the same within my script? We don't charge you by the word. A wee bit more explanation and background would be useful please? What are you trying to do exactly? Alan G. ___

[Tutor] How to format JSON output within script

2009-08-17 Thread Vincent Gulinao
I see you could pipe your output to 'python -mjson.tool', but how do I achieve the same within my script? TIA. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python and java report writers

2009-08-17 Thread John
On Monday 17 August 2009 05:43:05 pm Kent Johnson wrote: > Forwarding to the list with my reply. > > On Mon, Aug 17, 2009 at 4:04 PM, John wrote: > > Thanks for taking the time to write. But I was really looking for a > > simple way of calling a report writer (like using a com object) to print >

Re: [Tutor] python and java report writers

2009-08-17 Thread Kent Johnson
Forwarding to the list with my reply. On Mon, Aug 17, 2009 at 4:04 PM, John wrote: > Thanks for taking the time to write. But I was really looking for a simple > way of calling a report writer (like using a com object) to print a report. > At this point in the project changing to jython is not

Re: [Tutor] python and java report writers

2009-08-17 Thread Oxymoron
On Tue, Aug 18, 2009 at 8:50 AM, John wrote: > I don't know enough about jython to understand what has to be done.  Let's say > I can write the code to retrieve the data in cPython.  And I can write a > module in jython that will accept the data passing it on to the report > writer.  How can I call

[Tutor] Problems with encoding in BeautifulSoup

2009-08-17 Thread Eduardo Vieira
Hello, I have this sample script from beautiful soup, but I keep getting an error because of encoding. I have google for solutions but I don't seem to understand. Even this is dealt in Beautiful Soup's doc but I am not able to understant/apply the solution successfully. from BeautifulSoup import B

Re: [Tutor] python and java report writers

2009-08-17 Thread John
On Monday 17 August 2009 01:08:15 pm Oxymoron wrote: > (Posting to list!) > > On Tue, Aug 18, 2009 at 6:01 AM, John wrote: > > First I love your handle.  And second, thanks for taking the time to > > explain > > > :-) > : > > jython world.  But I was really looking for a simple way of calling a > >

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Mac Ryan
On Mon, 2009-08-17 at 20:27 +0100, Alan Gauld wrote: > > way I could enforce behaviours like "not null" or "default" from within > > the datastructure itself (for example in the __init__ method) rather > > than enforcing a logic from outside (i.e. the "mother class"). > > But those features are fe

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Mac Ryan
On Mon, 2009-08-17 at 13:33 -0400, Kent Johnson wrote: > On Mon, Aug 17, 2009 at 1:12 PM, Mac Ryan wrote: > > > Finally, I somewhere read that embedded declarations are much faster > > than external ones in being referenced. So, if performance is an issue, > > maybe embedding one class within anot

Re: [Tutor] python and java report writers

2009-08-17 Thread Oxymoron
(Posting to list!) On Tue, Aug 18, 2009 at 6:01 AM, John wrote: > > First I love your handle.  And second, thanks for taking the time to explain :-) > jython world.  But I was really looking for a simple way of calling a report > writer (like using a com object) to print a report.  At this point

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Alan Gauld
"Mac Ryan" wrote in message news:1250529165.18338.24.ca...@jabbar... On Fri, 2009-08-14 at 11:26 -0400, Serdar Tumgoren wrote: Hi everyone, I was wondering if there's anyone who can I would use a nested class to create a particular data structure which represent a "sub-unit" of the mother c

Re: [Tutor] python and java report writers

2009-08-17 Thread Alan Gauld
"John" wrote I'd like to understand how python can integrate with Java in general and then how it would work with the Java report writers. I have read a little about jPython but do not understand how to make that work with my python programs. I assume you mean jython? jython allows you to

Re: [Tutor] python and java report writers

2009-08-17 Thread Oxymoron
(Sent to John only by mistake, now sending to list. Sorry John!) On Tue, Aug 18, 2009 at 5:48 AM, Oxymoron wrote: > Hi John, > > On Tue, Aug 18, 2009 at 4:31 AM, John wrote: >> >> I'd like to understand how python can integrate with Java in general and then >> how it would work with the Java repor

Re: [Tutor] python and java report writers

2009-08-17 Thread Kent Johnson
On Mon, Aug 17, 2009 at 2:31 PM, John wrote: > Hi, > > I have been searching for a report writer to work with my python programs.  I > did find reportlab. But most of the other report writers are java based.  I > am confused by all the jargon associated with Java and have very little > working know

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Kent Johnson
On Mon, Aug 17, 2009 at 1:36 PM, Serdar Tumgoren wrote: > Say that I've created a series of Campaign Committee objects from an > initial data set. > > class Committee(object): >    def __init__(self, data): >        self.id = data[0] >        self.name = data[1] >        self.candidate = data[2] >

[Tutor] python and java report writers

2009-08-17 Thread John
Hi, I have been searching for a report writer to work with my python programs. I did find reportlab. But most of the other report writers are java based. I am confused by all the jargon associated with Java and have very little working knowledge of the environment. So I'm hoping someone will

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Serdar Tumgoren
> I would use a nested class to create a particular data structure which > represent a "sub-unit" of the mother class. ... In this > way I could enforce behaviours like "not null" or "default" from within > the datastructure itself (for example in the __init__ method) rather > than enforcing a logi

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Kent Johnson
On Mon, Aug 17, 2009 at 1:12 PM, Mac Ryan wrote: > Finally, I somewhere read that embedded declarations are much faster > than external ones in being referenced. So, if performance is an issue, > maybe embedding one class within another one might bring you some > benefit rather than having an obje

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Mac Ryan
On Fri, 2009-08-14 at 11:26 -0400, Serdar Tumgoren wrote: > Hi everyone, > > I was wondering if there's anyone who can offer a use case/rationale > for nested class? ... > Are there specific situations when nested classes come in handy > (perhaps for grouping conceptually related classes that don'

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Tino Dai
Bob, I could see where you could use a class inside of a class. Is it possible for you give a simple example of it? Thanks, Tino On Fri, Aug 14, 2009 at 2:05 PM, Serdar Tumgoren wrote: > Okay, those explanations definitely help. I thought I had run into a > situation where nested classes m