Re: [Tutor] Everything in one file?

2018-07-18 Thread Mats Wichmann
On 07/18/2018 10:00 AM, Alan Gauld via Tutor wrote: > On 18/07/18 14:46, Shall, Sydney wrote: > >> > is no need to put every class in a separate file, and it usually leads >> > to complicated dependencies and circular imports. > >> I have constructed a program which has a parent class and a chi

Re: [Tutor] Everything in one file?

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 17:00, Alan Gauld via Tutor wrote: > Now the child class must import parent and dereference > Parent within its module. (ie use parent.Parent) > > So two classes is more work for you and more work > for the interpreter. Oops, that should be two *files* is more work... sorry, -- Ala

Re: [Tutor] Stuck on some basics re floats

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 14:10, Matthew Polack wrote: > Thanks for the reply Alan. > > I found another fix where I could just use this: > > num1 =int(input('Ener inches here?: ')) > > > but a lot of people like yourself seem to be recommending this > 'float' method. It all depends whether your input is a f

Re: [Tutor] Everything in one file?

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 14:46, Shall, Sydney wrote: > > is no need to put every class in a separate file, and it usually leads > > to complicated dependencies and circular imports. > I have constructed a program which has a parent class and a child class > and I have them in two different files. I import

Re: [Tutor] Everything in one file?

2018-07-18 Thread Steven D'Aprano
Comments below. On Wed, Jul 18, 2018 at 03:46:20PM +0200, Shall, Sydney wrote: > On 24/05/2018 03:27, Steven D'Aprano wrote: > > On Tue, May 22, 2018 at 03:46:50PM +0530, aishwarya selvaraj wrote: > >> Dear all, > >> I have created 2 classes in 2 separate files. > > > > If you have learned the

[Tutor] Everything in one file?

2018-07-18 Thread Shall, Sydney
On 24/05/2018 03:27, Steven D'Aprano wrote: > On Tue, May 22, 2018 at 03:46:50PM +0530, aishwarya selvaraj wrote: >> Dear all, >> I have created 2 classes in 2 separate files. > > If you have learned the bad habit from Java of putting every class in a > separate file, you should unlearn that h

Re: [Tutor] Stuck on some basics re floats

2018-07-18 Thread Ben Finney
Matthew Polack writes: > I'm a teacher trying to learn Python with my students. Wonderful! Thank you for choosing Python for teaching your students. > I am trying to make a very simple 'unit calculator' program...but I get an > error ..I think python is treating my num1 variable as a text strin

Re: [Tutor] Stuck on some basics re floats

2018-07-18 Thread Peter Otten
Matthew Polack wrote: > Hi, > > I'm a teacher trying to learn Python with my students. > > I am trying to make a very simple 'unit calculator' program...but I get an > error ..I think python is treating my num1 variable as a text string...not > an integer. > > How do I fix this? > > Thanks! >

Re: [Tutor] Stuck on some basics re floats

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 00:52, Matthew Polack wrote: > Hi, > > I'm a teacher trying to learn Python with my students. > > I am trying to make a very simple 'unit calculator' program...but I get an > error ..I think python is treating my num1 variable as a text string...not > an integer. You are correct. >

[Tutor] Stuck on some basics re floats

2018-07-18 Thread Matthew Polack
Hi, I'm a teacher trying to learn Python with my students. I am trying to make a very simple 'unit calculator' program...but I get an error ..I think python is treating my num1 variable as a text string...not an integer. How do I fix this? Thanks! - Matt print ("How many inches would you like