Re: [Tutor] create class Pet

2015-06-17 Thread Alan Gauld
On 17/06/15 20:43, Stephanie Quiles wrote: You are right I don't understand functions very well still. This prompts the next question is there a book or online resource that you suggest I look at? Right now I am using a text book provides by the instructor called Starting Out With Python 3rd e

Re: [Tutor] create class Pet

2015-06-17 Thread Stephanie Quiles
You are right I don't understand functions very well still. This prompts the next question is there a book or online resource that you suggest I look at? Right now I am using a text book provides by the instructor called Starting Out With Python 3rd ed. Anything you can suggest I reference wou

Re: [Tutor] How to return a list in an exception object?

2015-06-17 Thread Steven D'Aprano
On Wed, Jun 17, 2015 at 12:49:38PM +, David Aldrich wrote: > Hi > > I have a function that compares a set of files with a reference set of > files. All files are compared and then, if any differences were > found, an exception is raised: [...] > I would like to pass back to the caller a lis

Re: [Tutor] How to return a list in an exception object?

2015-06-17 Thread Alan Gauld
On 17/06/15 13:49, David Aldrich wrote: I have a function that compares a set of files with a reference set of files. All files are compared and then, if any differences were found, an exception > is raised: That's a pretty horrible way to deal with things. Exceptions should be used for except

Re: [Tutor] How to return a list in an exception object?

2015-06-17 Thread Martin A. Brown
Greetings David, I have a function that compares a set of files with a reference set of files. All files are compared and then, if any differences were found, an exception is raised: If you had been trying to compare files, I would have suggested examining difflib, but it sounds like you a

Re: [Tutor] How to return a list in an exception object?

2015-06-17 Thread Peter Otten
David Aldrich wrote: > Hi > > I have a function that compares a set of files with a reference set of > files. All files are compared and then, if any differences were found, an > exception is raised: > > class Error(Exception): pass > > def check_results(file_list): > > > > if isDif

[Tutor] How to return a list in an exception object?

2015-06-17 Thread David Aldrich
Hi I have a function that compares a set of files with a reference set of files. All files are compared and then, if any differences were found, an exception is raised: class Error(Exception): pass def check_results(file_list): if isDifferent: raise Error('One or more resul

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Alan Gauld
On 17/06/15 09:58, Anubhav Yadav wrote: I understand that my title was a little misleading, and I apologise for the same. Here is code that worked: marks = [] for i in range(int(input())): Don't use input(). Use raw_input() instead. You almost never want input() in python 2. name = raw

Re: [Tutor] Dynamic linking vs Static linking of libraries in python

2015-06-17 Thread Steven D'Aprano
On Wed, Jun 17, 2015 at 07:52:46AM +, Velummaylum Kajenthiran via Tutor wrote: > Dear Sir/MadamI know the difference between static and dynamic linking > in C or C++. But what does it mean this in Python? Nothing. It isn't relevant to pure Python code. All Python code is dynamically linke

Re: [Tutor] Variables in email addresses

2015-06-17 Thread Joel Goldstick
On Wed, Jun 17, 2015 at 7:04 AM, Laura Creighton wrote: > In a message of Wed, 17 Jun 2015 02:05:49 +0100, Oliver Mercer-Deadman writes: >>Hi I am a complete newbie but am hoping to learn some python for a >>particular project. Before I hurl myself in I would like to know if a key >>element is goi

Re: [Tutor] Dynamic linking vs Static linking of libraries in python

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 07:52:46 -, Velummaylum Kajenthiran via Tu tor writes: Dear Sir/MadamI know the difference between static and dynamic linking in C or C++. But what does it mean this in Python? Since it's just an interpreter, and only having one style of import mechanism of

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 14:28:54 +0530, Anubhav Yadav writes: >Either the subject is misleading or you misunderstand something. Im am >sorry to tell you the great truth, but there was no list comprehension in >your code at all, just a list. Comprehension is what Alan wrote for you, >that

Re: [Tutor] Variables in email addresses

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 02:05:49 +0100, Oliver Mercer-Deadman writes: >Hi I am a complete newbie but am hoping to learn some python for a >particular project. Before I hurl myself in I would like to know if a key >element is going to be possible. > >I will need to be able to use a variable

[Tutor] Dynamic linking vs Static linking of libraries in python

2015-06-17 Thread Velummaylum Kajenthiran via Tutor
Dear Sir/MadamI know the difference between static and dynamic linking in C or C++. But what does it mean this in Python? Since it's just an interpreter, and only having one style of import mechanism of modules, how this make sense?If I freeze my python application with PyInstaller, Is it a kind

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Anubhav Yadav
Either the subject is misleading or you misunderstand something. Im am sorry to tell you the great truth, but there was no list comprehension in your code at all, just a list. Comprehension is what Alan wrote for you, that is the next step in studying Python, when you already understand lists and

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Válas Péter
Either the subject is misleading or you misunderstand something. Im am sorry to tell you the great truth, but there was no list comprehension in your code at all, just a list. Comprehension is what Alan wrote for you, that is the next step in studying Python, when you already understand lists and

[Tutor] Variables in email addresses

2015-06-17 Thread Oliver Mercer-Deadman
Hi I am a complete newbie but am hoping to learn some python for a particular project. Before I hurl myself in I would like to know if a key element is going to be possible. I will need to be able to use a variable as the username in an email address. E.G. username = Input("Enter Something: ") T

Re: [Tutor] create class Pet

2015-06-17 Thread Alan Gauld
On 16/06/15 21:15, Stephanie Quiles wrote: sorry this is the correct error. File "/Users/stephaniequiles/PycharmProjects/untitled3/pets.py", line 7, in main pet.get_name(name, animal_type, age) AttributeError: 'module' object has no attribute 'get_name' There are several errors in