[Tutor] Shuts down when asking user for info

2011-01-26 Thread Casey Key
Please help , run the script and see that once you press enter after entering name it just shuts it down, help. print("\tWelcome to Casey's magical python code!") print("\tWritten by no other than Casey Key!") print("\nWe will begin by getting some information,mmmkay?") name = input("what is your n

Re: [Tutor] The trap of the year

2011-01-26 Thread ALAN GAULD
> When I read your tutorial I was probably blind... :-D > I am going to re-read it. Actually I don't think I discuss it. I only mention default arguments very briefly because they are not a standard programming feature. My tutor tries to teach general programming not Python specifics so it d

Re: [Tutor] Shuts down when asking user for info

2011-01-26 Thread tee chwee liong
maybe you can use raw_input? Date: Tue, 25 Jan 2011 19:51:28 -0700 From: i.eat.brain...@gmail.com To: tutor@python.org Subject: [Tutor] Shuts down when asking user for info Please help , run the script and see that once you press enter after entering name it just shuts it down, help.

Re: [Tutor] class question

2011-01-26 Thread Alan Gauld
"Karim" wrote Program towards interface that means you have to use inheritance. Just to be picky, you can program by interface without using inheritance. Inheritance is only needed to implement interfaces in languages like C++. In Python (and other dynamically bound OOP languages) you can

Re: [Tutor] Shuts down when asking user for info

2011-01-26 Thread Alan Gauld
"Casey Key" wrote Please help , run the script and see that once you press enter after entering name it just shuts it down, help. -- print("\tWelcome to Casey's magical python code!") print("\tWritten by no other than Casey Key!") print("\nWe will begin by getting some informat

Re: [Tutor] Shuts down when asking user for info

2011-01-26 Thread Alan Gauld
"tee chwee liong" wrote maybe you can use raw_input? It looks like the OP is using Python 3 so input() is the correct function. Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pytho

Re: [Tutor] class question

2011-01-26 Thread Karim
Sure, but I come from java world and 1 inheritance is allowed but we can implement multiple interfaces. I like to use Abstract classes in Python then inherit and implement abstract method like in java (at least that's all I remember from Java experience). Indeed I was too direct everybody has

Re: [Tutor] class question

2011-01-26 Thread Karim
I know the the law of Murphy. But this one is a must-have.:-) Regards Karim * One way to reduce coupling is with the Law of Demeter: if you want your dog to walk, don't talk to your dog's legs. You will only confuse the dog and it won't get anywhere. http://en.wikipedia.org/wiki/Law_of_Deme

Re: [Tutor] class question

2011-01-26 Thread Elwin Estle
Elwin Estle wrote: > Is it better to have one large sort of "do it all" class, or break > the larger class up into smaller classes? Yes. Or no. It's impossible to answer that question definitively without knowing more about what "it all" is. But I can give some general advice: * Python isn't

Re: [Tutor] class question

2011-01-26 Thread Tino Dai
> > > A raw casting comes into a factory. It is listed as such. When machined, > this part number changes to a different part number. The raw casting has > no "quality related" stuff, but the machined casting does, and it can have > more than one "quality related" thing. > > ...because, the raw

Re: [Tutor] class question

2011-01-26 Thread Izz ad-Din Ruhulessin
class Raw ---> class Processor ---> class Final 2011/1/26 Tino Dai > > >> >> A raw casting comes into a factory. It is listed as such. When machined, >> this part number changes to a different part number. The raw casting has >> no "quality related" stuff, but the machined casting does, and

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread Tino Dai
On Wed, Jan 26, 2011 at 2:46 AM, ian douglas wrote: > Hey all, > > I followed a tutorial on creating a very simple wiki in Python, which > worked fine until the example where the instructor wanted to render the > output through markdown.markdown() > > Here's the view code: > > from agwiki.wiki.mo

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread ian douglas
Thanks Tino, It's certainly not homework, I'm learning Python after being in the Perl/PHP world for well over a decade. Trying to teach this old dog some new tricks. On Jan 26, 2011 6:47 AM, "Tino Dai" wrote: > On Wed, Jan 26, 2011 at 2:46 AM, ian douglas wrote: > >> Hey all, >> >> I followed a t

[Tutor] Print to std output with color

2011-01-26 Thread Karim
Hello all, Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a warning!^[[0m' ) where <=> ^[ *I see thing with curses module. But is there an more simple object in other module to do the trick? Kind of _/decorate_output( mode=

[Tutor] Is it possible to make a circle of 1 hour

2011-01-26 Thread shaheryar ali
Hi every body, I was wondering, Is it possible to generate a circle on Google maps using python, such that distance in the created circle could be travel in 1 hour. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription o

[Tutor] tkinter, create widgets during runtime?

2011-01-26 Thread Elwin Estle
With Tcl/Tk, you can generate widgets "on the fly" during program execution, without having to explicitly create them in your code.  i.e., something like: for {set i 0} {$i <= 5} {incr i} {     label .myLabel_$i -text "this is label myLabel_$i"     pack .myLabel_$i } ...which will generate five

Re: [Tutor] Tutor Digest, Vol 83, Issue 115

2011-01-26 Thread echowit
ormation associated with a given part.? I am thinking it as a sort of tree structure.? I am just wondering if some of the branches of he tree should be separate classes that are then tied into the "trunk" of the aster class, or if the who

Re: [Tutor] class question

2011-01-26 Thread Alan Gauld
"Karim" wrote Sure, but I come from java world and 1 inheritance is allowed but we can implement multiple interfaces. I like to use Abstract classes in Python then inherit and implement abstract method like in java (at least Sure and that is the normal way of doing it. Not least because you

Re: [Tutor] Is it possible to make a circle of 1 hour

2011-01-26 Thread Alan Gauld
"shaheryar ali" wrote I was wondering, Is it possible to generate a circle on Google maps using python, such that distance in the created circle could be travel in 1 hour. Technically it would be possible I'm sure. The trick is determining how big the circle should be. How are you travelli

Re: [Tutor] Print to std output with color

2011-01-26 Thread Scott Nelson
Curses is one way to go. Another is to use the PyWin32 module discussed in this thread: http://thread.gmane.org/gmane.comp.python.tutor/58450/focus=58454 Basically, here's a snippet of code that can get you started. This requires that you have the PyWin32 module installed (already installed by

Re: [Tutor] class question

2011-01-26 Thread Alan Gauld
"Elwin Estle" wrote The class in question, does, in fact, deal with a thing. The problem is, the "thing" is highly mutable. You can mutate objects, that is not a problem. But you need to be sure you need to. Is this really a series of different types of casting or a single Workpiece goin

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread Benjamin Kircher
On Jan 26, 2011, at 4:11 PM, ian douglas wrote: > Thanks Tino, > > It's certainly not homework, I'm learning Python after being in the Perl/PHP > world for well over a decade. Trying to teach this old dog some new tricks. > > On Jan 26, 2011 6:47 AM, "Tino Dai" wrote: > > On Wed, Jan 26, 2011

Re: [Tutor] Print to std output with color

2011-01-26 Thread Alan Gauld
"Karim" wrote Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a warning!^[[0m' ) Not generically since stdout is a data stream which may not be printed (it could be spoken for example - how does the synthesiser interpret colou

Re: [Tutor] Print to std output with color

2011-01-26 Thread Alan Gauld
"Karim" wrote Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a warning!^[[0m' ) I should have said the effbot solution (and WConio) are only for Windows. On Linux I think you are pretty well stuck with curses. I did find a si

Re: [Tutor] Is it possible to make a circle of 1 hour

2011-01-26 Thread C.Y. Ruhulessin
Do time machines count to? 2011/1/26 Alan Gauld > > "shaheryar ali" wrote > > > I was wondering, Is it possible to generate a circle on Google maps using >> python, such that distance in the created circle could be travel in 1 >> hour. >> > > Technically it would be possible I'm sure. The tric

[Tutor] Class Docs - how much is too much?

2011-01-26 Thread Tim Johnson
FYI: I'm currently using version 2.6.5 I've developed a module which necessitates a very large amount of documentation. At this point all of the documentation is in the class docstring. I'm thinking that perhaps I should pare down the docstring and deliver specific documentation topics with object

Re: [Tutor] Print to std output with color

2011-01-26 Thread Tim Golden
On 26/01/2011 6:10 PM, Scott Nelson wrote: Curses is one way to go. Another is to use the PyWin32 module discussed in this thread: http://thread.gmane.org/gmane.comp.python.tutor/58450/focus=58454 Basically, here's a snippet of code that can get you started. This requires that you have the Py

Re: [Tutor] Print to std output with color

2011-01-26 Thread Karim
Thanks a lot Scott for the tip! Regards Karim On 01/26/2011 07:10 PM, Scott Nelson wrote: Curses is one way to go. Another is to use the PyWin32 module discussed in this thread: http://thread.gmane.org/gmane.comp.python.tutor/58450/focus=58454 Basically, here's a snippet of code that can get

Re: [Tutor] Print to std output with color

2011-01-26 Thread Karim
Thanks Alan! I will go there have a look. Regards Karim On 01/26/2011 07:24 PM, Alan Gauld wrote: "Karim" wrote Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a warning!^[[0m' ) Not generically since stdout is a data strea

Re: [Tutor] Print to std output with color

2011-01-26 Thread Scott Nelson
> > Curses is one way to go. Another is to use the PyWin32 module discussed in > this thread: > I just realized I was assuming you were on Windows. If you are on another OS, the code I posted will obviously not work for you as it is specific to Windows. __

Re: [Tutor] Print to std output with color

2011-01-26 Thread Karim
That's what I figured out at effbot website. Thanks for the additional link Alan! Regards Karim On 01/26/2011 07:27 PM, Alan Gauld wrote: "Karim" wrote Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a warning!^[[0m' ) I sh

Re: [Tutor] Is it possible to make a circle of 1 hour

2011-01-26 Thread shaheryar ali
Alan, Well its gonna be by foot (walk) and it could be any place, road, city center, countryside, preferably you can say a leisure. but how to proceed with it, any Idea? I have made some logic for it but I am more Interested to know what other ideas could be, one more thing every time a rando

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread ian douglas
Thanks, Benjamin, I figured it was a version issue, I'm just so new to Python that I didn't know where to look. Sorry for polluting the list with Django questions, I thought it was an underlying Python issue, not the framework. -id On 01/26/2011 10:10 AM, Benjamin Kircher wrote: Hi Ian. W

Re: [Tutor] class question

2011-01-26 Thread Elwin Estle
--- On Wed, 1/26/11, Alan Gauld wrote: From: Alan Gauld Subject: Re: [Tutor] class question To: tutor@python.org Date: Wednesday, January 26, 2011, 1:10 PM >>Is this really a series of different types of casting or a single Workpiece >>going through a sequence of Actions >>each Action having a

Re: [Tutor] Class Docs - how much is too much?

2011-01-26 Thread Emile van Sebille
On 1/26/2011 11:03 AM Tim Johnson said... FYI: I'm currently using version 2.6.5 I've developed a module which necessitates a very large amount of documentation. At this point all of the documentation is in the class docstring. I'm thinking that perhaps I should pare down the docstring and deliv

Re: [Tutor] Is it possible to make a circle of 1 hour

2011-01-26 Thread shaheryar ali
No, From: C.Y. Ruhulessin To: Alan Gauld Cc: tutor@python.org Sent: Wed, January 26, 2011 8:37:45 PM Subject: Re: [Tutor] Is it possible to make a circle of 1 hour Do time machines count to? 2011/1/26 Alan Gauld >"shaheryar ali" wrote > > > >I was wonde

Re: [Tutor] Class Docs - how much is too much?

2011-01-26 Thread Tim Johnson
* Emile van Sebille [110126 12:30]: > On 1/26/2011 11:03 AM Tim Johnson said... >> >> I've developed a module which necessitates a very large amount of >> documentation. At this point all of the documentation is in the >> class docstring. I'm thinking that perhaps I should pare down the >> docstri

Re: [Tutor] class question

2011-01-26 Thread Steven D'Aprano
Elwin Estle wrote: --- On Wed, 1/26/11, Alan Gauld wrote: From: Alan Gauld Subject: Re: [Tutor] class question To: tutor@python.org Date: Wednesday, January 26, 2011, 1:10 PM Is this really a series of different types of casting or a single Workpiece going through a sequence of Actions each

Re: [Tutor] class question

2011-01-26 Thread ALAN GAULD
> >>I'm not sure I follow that bit. > > Say you have a master part, # 3245671, this is sort of a "primary machined >number". > > On the blueprint for this part, there will be certain features that don't > have >any dimensional > > information, but instead have a callout of some kind, i

Re: [Tutor] Is it possible to make a circle of 1 hour

2011-01-26 Thread Alan Gauld
"shaheryar ali" wrote Well its gonna be by foot (walk) and it could be any place, road, city center, countryside, preferably you can say a leisure. OK, so if we limit it to on foot by any means then the circle would be about 3 miles (5km) in radius. but how to proceed with it, any Idea?

[Tutor] get xml for parsing?

2011-01-26 Thread Alex Hall
Hi all, How would I go about getting the xml from a website through the site's api? The url does not end in .xml since the xml is generated based on the parameters in the url. For example: https://api.website.com/user/me/count/10?api_key=MY_KEY would return ten results (the count parameter) as xml.

Re: [Tutor] get xml for parsing?

2011-01-26 Thread Stefan Behnel
Alex Hall, 27.01.2011 05:01: How would I go about getting the xml from a website through the site's api? The url does not end in .xml since the xml is generated based on the parameters in the url. For example: https://api.website.com/user/me/count/10?api_key=MY_KEY would return ten results (the c