Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-25 Thread Arup Rakshit
On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote: On 24/04/2019 12:22, Arup Rakshit wrote: In the simple code like what are the advantages we get from? I'm not really sure what you are asking about? Ok. My question is that when people add such a class to the module? What is the goal/intention

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-25 Thread Arup Rakshit
On 25/04/19 1:21 PM, Steven D'Aprano wrote: On Thu, Apr 25, 2019 at 11:30:28AM +0530, Arup Rakshit wrote: On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote: On 24/04/2019 12:22, Arup Rakshit wrote: In the simple code like what are the advantages we get from? I'm not really sure what you are

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-25 Thread Steven D'Aprano
On Thu, Apr 25, 2019 at 11:30:28AM +0530, Arup Rakshit wrote: > On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote: > >On 24/04/2019 12:22, Arup Rakshit wrote: > >>In the simple code like what are the advantages we get from? > >I'm not really sure what you are asking about? > > Ok. My question is

[Tutor] help with colormode

2019-04-25 Thread Mark Alderson
hi Ihave a very small program. I want to cycle colours. I cant set the colormode from 1 to 255 tried screen.colormode(255) tells me screen is not defined. the program works without the colormode, but i want to use it. I just change the a and b variable values to generate new art.

[Tutor] module import from a packager works inconsistent between REPL and command line

2019-04-25 Thread Arup Rakshit
I have a small app like this: pizza-shop$ tree . . └── pizzapy ├── __init__.py ├── menu.py └── pizza.py 1 directory, 3 files # menu.py from typing import List from pizza import Pizza MENU: List[Pizza] = [ Pizza('Margherita', 30, 10.0), Pizza('Carbonara', 45, 14.99),

Re: [Tutor] help with colormode

2019-04-25 Thread Peter Otten
Mark Alderson wrote: > hi > > Ihave a very small program. I want to cycle colours. I cant set the > colormode from 1 to 255 > > tried screen.colormode(255) > > tells me screen is not defined. the program works without the colormode, > but i want to use it. > > I just change the a and b

[Tutor] str.replace error

2019-04-25 Thread Roger Lea Scherer
I'm working wtih python 3.7 on Windows 10. I'm trying to write some code in order to clean up the data in the csv file. Using spreadsheet language, I want to replace part of a cell ("Basic P1") with an empty string and write it in the comments cell. I thought assigning a variable and replacing the

Re: [Tutor] help with colormode

2019-04-25 Thread Alan Gauld via Tutor
On 25/04/2019 11:54, Mark Alderson wrote: > tried screen.colormode(255) Peter has shown you how to make that work but there is a wee issue below I need to point out. > -code- > from turtle import Turtle > t = Turtle() > t.speed(0) > > b = 180

Re: [Tutor] str.replace error

2019-04-25 Thread Alan Gauld via Tutor
On 25/04/2019 18:46, Roger Lea Scherer wrote: > Here is my code: > > import csv > > with open('somefile') as csvDataFile: > csvReader = csv.reader(csvDataFile) > for row in range(100): what happens if there are more rows in the file than 100? Or even if there are less!? > a =

Re: [Tutor] str.replace error

2019-04-25 Thread Steven D'Aprano
On Thu, Apr 25, 2019 at 10:46:31AM -0700, Roger Lea Scherer wrote: > with open('somefile') as csvDataFile: > csvReader = csv.reader(csvDataFile) > for row in range(100): > a = "Basic P1" > str.replace(a, "") > print(next(csvReader)) I'm not quite sure what you

Re: [Tutor] module import from a packager works inconsistent between REPL and command line

2019-04-25 Thread Steven D'Aprano
On Thu, Apr 25, 2019 at 05:40:18PM +0530, Arup Rakshit wrote: > I have a small app like this: Please simplify your code to the minimum needed to demonstrate the problem you are asking about. This bit is excellent: > pizza-shop$ tree . > . > └── pizzapy > ├── __init__.py > ├── menu.py >

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-25 Thread Steven D'Aprano
On Thu, Apr 25, 2019 at 02:52:07PM +0530, Arup Rakshit wrote: > Here it is: *3.3.2.1. Customizing module attribute access* > (https://docs.python.org/3/reference/datamodel.html#customizing-module-attribute-access) Oh! That's brand new in 3.7, no wonder I didn't know about it. I did see the