Re: [Tutor] Tips

2014-06-19 Thread Steven D'Aprano
On Thu, Jun 19, 2014 at 11:10:26AM -0700, Alex Kleider wrote: > The idea of a singleton class is new to me as is this comparison of > class vs module. > Can anyone suggest a place to turn for more discussion of the topic? > thks, alexK "Singleton" is one of the classic "design patterns", althoug

Re: [Tutor] Tips

2014-06-19 Thread Albert-Jan Roskam
- Original Message - > From: Alex Kleider > To: tutor@python.org > Cc: > Sent: Thursday, June 19, 2014 8:10 PM > Subject: Re: [Tutor] Tips > > On 2014-06-18 18:37, Steven D'Aprano wrote: >> Python tries very hard to ensure that every module is

Re: [Tutor] Tips

2014-06-19 Thread Alex Kleider
On 2014-06-18 18:37, Steven D'Aprano wrote: Python tries very hard to ensure that every module is loaded only once. (There are circumstances where you can fool it, but they're rare.) Since the module holds state (variables) and behaviour (functions), modules perform the same sort of role as cla

Re: [Tutor] Tips

2014-06-19 Thread Albert-Jan Roskam
- Original Message - > From: Mark Lawrence > To: tutor@python.org > Cc: > Sent: Thursday, June 19, 2014 2:40 PM > Subject: Re: [Tutor] Tips > > On 19/06/2014 10:09, Albert-Jan Roskam wrote: >>> From: Mark Lawrence >>> To: tutor@python.org >

Re: [Tutor] Tips

2014-06-19 Thread Steven D'Aprano
On Tue, Jun 17, 2014 at 02:52:33PM -0400, keith papa wrote: > > Hi, I want to no what some tips or information you can give me to > remember some of the rules of python, when you first start learning > programming? Questions about memory (that is, *human* memory, in the brain) are not really on

Re: [Tutor] Tips

2014-06-19 Thread Mark Lawrence
On 19/06/2014 10:09, Albert-Jan Roskam wrote: - Original Message - From: Mark Lawrence To: tutor@python.org Cc: Sent: Thursday, June 19, 2014 8:41 AM Subject: Re: [Tutor] Tips On 19/06/2014 02:36, Danny Yoo wrote: [content about __add__ dispatch resolution cut] We should

Re: [Tutor] Tips

2014-06-19 Thread Steven D'Aprano
On Wed, Jun 18, 2014 at 06:36:12PM -0700, Danny Yoo wrote: > [content about __add__ dispatch resolution cut] > > > We should remember the target audience, lest this thread doesn't > spiral away so that only the tutors are talking to each other. I'm > guilty of this as anyone, mind you. Pot. Ke

Re: [Tutor] Tips

2014-06-19 Thread Sydney Shall
On 19/06/2014 03:37, Steven D'Aprano wrote: On Wed, Jun 18, 2014 at 12:35:20PM +0200, Sydney Shall wrote: On 17/06/2014 22:35, Alan Gauld wrote: Use modules instead of singleton classes As a new beginner with Python, I am having problem understanding the difference here. I think I understand c

Re: [Tutor] Tips

2014-06-19 Thread Albert-Jan Roskam
- Original Message - > From: Mark Lawrence > To: tutor@python.org > Cc: > Sent: Thursday, June 19, 2014 8:41 AM > Subject: Re: [Tutor] Tips > > On 19/06/2014 02:36, Danny Yoo wrote: >> [content about __add__ dispatch resolution cut] >> >> >

Re: [Tutor] Tips

2014-06-19 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Thursday, June 19, 2014 3:17 AM > Subject: Re: [Tutor] Tips > > On Wed, Jun 18, 2014 at 07:25:41AM -0700, Albert-Jan Roskam wrote: > >> Given that the concept of Du

Re: [Tutor] Tips

2014-06-18 Thread Mark Lawrence
On 19/06/2014 02:36, Danny Yoo wrote: [content about __add__ dispatch resolution cut] We should remember the target audience, lest this thread doesn't spiral away so that only the tutors are talking to each other. I'm guilty of this as anyone, mind you. Pot. Kettle. :P The original questi

Re: [Tutor] Tips

2014-06-18 Thread Steven D'Aprano
On Wed, Jun 18, 2014 at 12:35:20PM +0200, Sydney Shall wrote: > On 17/06/2014 22:35, Alan Gauld wrote: > >Use modules instead of singleton classes > As a new beginner with Python, I am having problem understanding the > difference here. > I think I understand classes, but still have problems with

Re: [Tutor] Tips

2014-06-18 Thread Danny Yoo
[content about __add__ dispatch resolution cut] We should remember the target audience, lest this thread doesn't spiral away so that only the tutors are talking to each other. I'm guilty of this as anyone, mind you. Pot. Kettle. :P The original question that the OP posed was: I want to

Re: [Tutor] Tips

2014-06-18 Thread Steven D'Aprano
On Wed, Jun 18, 2014 at 07:25:41AM -0700, Albert-Jan Roskam wrote: > Given that the concept of Ducktyping has already been mentioned, is > there a reason why you did not mention try-except? >   > def add(a, b): >     try: >     return a + b >     except TypeError: > raise  As others

Re: [Tutor] Tips

2014-06-18 Thread Dave Angel
Sydney Shall Wrote in message: > but I do not understand what defines a module Please post in plain text, not html. A module is a source file (eg. .py) or a compiled source file (eg .pyc) that's generally intended to be used via an import. -- DaveA ___

Re: [Tutor] Tips

2014-06-18 Thread Mark Lawrence
On 18/06/2014 20:17, Albert-Jan Roskam wrote: - Original Message - From: Mark Lawrence To: tutor@python.org Cc: Sent: Wednesday, June 18, 2014 9:03 PM Subject: Re: [Tutor] Tips On 18/06/2014 15:25, Albert-Jan Roskam wrote: - Original Message - From: Alan Gauld To

Re: [Tutor] Tips

2014-06-18 Thread Albert-Jan Roskam
- Original Message - > From: Mark Lawrence > To: tutor@python.org > Cc: > Sent: Wednesday, June 18, 2014 9:03 PM > Subject: Re: [Tutor] Tips > > On 18/06/2014 15:25, Albert-Jan Roskam wrote: >> - Original Message - >>> From: Alan Gaul

Re: [Tutor] Tips

2014-06-18 Thread Mark Lawrence
On 18/06/2014 15:25, Albert-Jan Roskam wrote: - Original Message - From: Alan Gauld To: tutor@python.org Cc: Sent: Wednesday, June 18, 2014 11:47 AM Subject: Re: [Tutor] Tips On 18/06/14 01:15, Nanohard wrote: On 2014-06-17 13:35, Alan Gauld wrote: Don't test types, us

Re: [Tutor] Tips

2014-06-18 Thread Alan Gauld
On 18/06/14 15:25, Albert-Jan Roskam wrote: Just do this: def add(a,b): return a+b Given that the concept of Ducktyping has already been mentioned, is there a reason why you did not mention try-except? def add(a, b): try: return a + b except TypeError: rais

Re: [Tutor] Tips

2014-06-18 Thread Albert-Jan Roskam
- Original Message - > From: Alan Gauld > To: tutor@python.org > Cc: > Sent: Wednesday, June 18, 2014 11:47 AM > Subject: Re: [Tutor] Tips > > On 18/06/14 01:15, Nanohard wrote: >>> On 2014-06-17 13:35, Alan Gauld wrote: >>> >>>> Do

Re: [Tutor] Tips

2014-06-18 Thread Sydney Shall
On 17/06/2014 22:35, Alan Gauld wrote: Use modules instead of singleton classes As a new beginner with Python, I am having problem understanding the difference here. I think I understand classes, but still have problems with inheritance, but I do not understand what defines a module. With many

Re: [Tutor] Tips

2014-06-18 Thread Alan Gauld
On 18/06/14 01:15, Nanohard wrote: On 2014-06-17 13:35, Alan Gauld wrote: Don't test types, use the interface Can you please explain what you mean by this? He means use the Python interpreter, by going to your console and typing "python", or in Windows it's called 'IDLE'. Nope, I meant

Re: [Tutor] Tips

2014-06-18 Thread Nanohard
> On 2014-06-17 13:35, Alan Gauld wrote: > >> Don't test types, use the interface > > Can you please explain what you mean by this? > alex He means use the Python interpreter, by going to your console and typing "python", or in Windows it's called 'IDLE'. __

Re: [Tutor] Tips

2014-06-18 Thread Mark Lawrence
On 18/06/2014 01:02, Alex Kleider wrote: On 2014-06-17 13:35, Alan Gauld wrote: Don't test types, use the interface Can you please explain what you mean by this? alex Further to Danny Yoo's response have a read of this http://en.wikipedia.org/wiki/Duck_typing -- My fellow Pythonistas, a

Re: [Tutor] Tips

2014-06-17 Thread Danny Yoo
On Tue, Jun 17, 2014 at 5:02 PM, Alex Kleider wrote: > On 2014-06-17 13:35, Alan Gauld wrote: > >> Don't test types, use the interface > > > Can you please explain what you mean by this? If you are writing type tests on a function's inputs, you might better off by having the inputs implement an

Re: [Tutor] Tips

2014-06-17 Thread Alex Kleider
On 2014-06-17 13:35, Alan Gauld wrote: Don't test types, use the interface Can you please explain what you mean by this? alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listi

Re: [Tutor] Tips

2014-06-17 Thread Alan Gauld
On 17/06/14 19:52, keith papa wrote: Hi, I want to no what some tips or information you can give me to > remember some of the rules of python, > when you first start learning programming? Most of my tips/rules are about programming rather than python... --

[Tutor] Tips

2014-06-17 Thread keith papa
Hi, I want to no what some tips or information you can give me to remember some of the rules of python, when you first start learning programming? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pytho

Re: [Tutor] Tips

2010-01-11 Thread Kent Johnson
On Mon, Jan 11, 2010 at 12:33 AM, VacStudent wrote: > I would like to get a python book, how and where to get one? Amazon.com? Or lots of free resources online. Kent ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] Tips

2010-01-11 Thread VacStudent
I would like to get a python book, how and where to get one? Jappie Monele Mechanical Engineer Student Koffiefontein Blue Diamond Mine JV Petra Diamonds Group Management Office: Elizabeth House, 9 Castle Street, St. Helier, Jersey, JE4 2QP South African Office: Block 3, Silver Point Of

Re: [Tutor] tips for writing a program

2007-06-20 Thread Alan Gauld
"Mat Newport" <[EMAIL PROTECTED]> wrote > Basically the program would scan a specified folder, > build a list of specific files (.txt in the example below), Look at the glob module and its glob function. Or if you want to include subdirectories lkook at the os.walk function. There are example

Re: [Tutor] tips for writing a program

2007-06-19 Thread Luke Paireepinart
Mat Newport wrote: > I have taken a fundamentals of programming course at a local college, but > that class does not provide the level of expertise to write a program I have > in mind. So I do have basic skills, I just need to be shown the tools to > write this thing and I think I could put it a

[Tutor] tips for writing a program

2007-06-19 Thread Mat Newport
I have taken a fundamentals of programming course at a local college, but that class does not provide the level of expertise to write a program I have in mind. So I do have basic skills, I just need to be shown the tools to write this thing and I think I could put it all together. Basically the