Decorator as a class and Descriptor __get__ working? - cookbook, 9.9, pg 349

2019-12-08 Thread Veek M
I did not follow the grok bit.. He's creating a Descriptor within class 'Spam' by doing @Profiled def bar() because Profiled replaces 'bar' with it's instance that contains __get__ which means I have to do s.grok = 20 to trigger it? Which would imply, s.__get__(instance, instance, value) NOT wha

Re: python 2 to 3 converter

2019-12-08 Thread jfong
Greg Ewing於 2019年12月9日星期一 UTC+8上午6時18分32秒寫道: > On 8/12/19 9:30 pm, songbird wrote: > >wouldn't it make more sense to just go back and fix the > > converter program than to have to manually convert all this > > python2 code? > > Anything that isn't already fixed by 2to3 is probably > somewhere

Re: Aw: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 22:06, Greg Ewing wrote: On 9/12/19 7:47 am, RobH wrote: I wanted it to work as is, like it did for the author, without changing anything. So why should I now start to learn how python works. There are many, many reasons a piece of code could work in one environment but not ano

Re: Python3 - How do I import a class from another file

2019-12-08 Thread Greg Ewing
On 9/12/19 6:28 am, R.Wieser wrote: Are you sure there's a difference between classes and functions here? Yes, quite sure. And we're even more sure that there isn't. :-) Try it with a test module containing a class definition, a function definition and some top-level code that does somethin

Re: Aw: Re: stuck on time

2019-12-08 Thread DL Neil via Python-list
It's a lot like the misuse of the word "theory". You mean to say that in theory there is no difference between theory and practice, but in practice there is? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package

2019-12-08 Thread DL Neil via Python-list
On 9/12/19 8:13 AM, b...@bbhoyer.com wrote: Just registered Thanks Hi @bob, welcome to the gang... I am a beginner in Python, been working on class material from Mosh ... from email.mime.multipart import MIMEMultipart ... Here is the error message: Trace

Re: Aw: Re: stuck on time

2019-12-08 Thread MRAB
On 2019-12-08 20:34, Michael Torrie wrote: On 12/8/19 11:47 AM, RobH wrote: Err, excuse me, I was not attempting to hack into someone else's code. As the code is in the public domain, I wanted it to work as is, like it did for the author, without changing anything. No worries, you're totally

Re: ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package

2019-12-08 Thread MRAB
On 2019-12-08 19:13, b...@bbhoyer.com wrote: Just registered Thanks Original Message Subject: ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package From: <[1]b...@bbhoyer.com> Date: Sun, December 08, 2019 11:14 am

Re: python 2 to 3 converter

2019-12-08 Thread Greg Ewing
On 8/12/19 9:30 pm, songbird wrote: wouldn't it make more sense to just go back and fix the converter program than to have to manually convert all this python2 code? Anything that isn't already fixed by 2to3 is probably somewhere between very difficult and impossible to fix using an automate

Re: stuck on time

2019-12-08 Thread Greg Ewing
On 9/12/19 7:46 am, Dennis Lee Bieber wrote: Minecraftia appears to be a monospaced font meant to look like the character set of old 8-bit gaming systems from the 80s. From the name, it's probably mean to resemble the font in Minecraft. As used in the game it's not actually monospaced,

Re: Aw: Re: stuck on time

2019-12-08 Thread Greg Ewing
On 9/12/19 7:47 am, RobH wrote: I wanted it to work as is, like it did for the author, without changing anything. So why should I now start to learn how python works. There are many, many reasons a piece of code could work in one environment but not another. Figuring out why requires actual u

Re: Python3 - How do I import a class from another file

2019-12-08 Thread DL Neil via Python-list
On 9/12/19 7:29 AM, R.Wieser wrote: ... Note that in all cases when you import a module (either by import the_file or from the_file importe whatever) you actually import ALL of it So much for my assumption only the class itself would be loaded - and a wrench into my idea to have a number of cl

RE: ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package

2019-12-08 Thread bob
Just registered  Thanks Original Message Subject: ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package From: <[1]b...@bbhoyer.com> Date: Sun, December 08, 2019 11:14 am To: [2]python-list@python.org Hello Python Tea

Re: Regarding problem in python 3.8.0 installation

2019-12-08 Thread Terry Reedy
On 12/8/2019 1:08 PM, alok singh wrote: My system is windows 7 SP1 32-bit . after installing python in my system,when i try to launch it using command prompt then a message is shown. I am attaching a screenshot of the following. Screenshots are not allowed. Copy and paste from CommandPrompt.

Re: Aw: Re: stuck on time

2019-12-08 Thread Michael Torrie
On 12/8/19 11:47 AM, RobH wrote: > Err, excuse me, I was not attempting to hack into someone else's code. > As the code is in the public domain, I wanted it to work as is, like it > did for the author, without changing anything. No worries, you're totally fine. The word "hack" means something di

Re: Aw: Re: stuck on time

2019-12-08 Thread DL Neil via Python-list
On 9/12/19 7:47 AM, RobH wrote: On 08/12/2019 16:49, Dennis Lee Bieber wrote: On Sun, 8 Dec 2019 09:44:54 +, RobH declaimed the following: def print_time():   current_time = time.strftime("%I:%M") ... I don't know if that is the correct way as I am just using the code from the proje

Re: Python3 - How do I import a class from another file

2019-12-08 Thread Terry Reedy
On 12/8/2019 1:29 PM, R.Wieser wrote: from the_file import ClassName from somemod import name has the same effect as import somemod name = somemod.name del somemod which is to import a particular 'name' linked to a particular python object into the namespace where the import is executed.

Re: Python3 - How do I import a class from another file

2019-12-08 Thread R.Wieser
Dennis, > Common practice is that the class is capitalized. Instances >are lowercase. Thanks. Regards, Rudy Wieser -- https://mail.python.org/mailman/listinfo/python-list

Regarding problem in python 3.8.0 installation

2019-12-08 Thread alok singh
Sir, My system is windows 7 SP1 32-bit . after installing python in my system,when i try to launch it using command prompt then a message is shown. I am attaching a screenshot of the following. kindly look seriously into my problem and tell me the solution.. thank you -- https://mail.python.org/

Re: Aw: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 16:49, Dennis Lee Bieber wrote: On Sun, 8 Dec 2019 09:44:54 +, RobH declaimed the following: def print_time(): current_time = time.strftime("%I:%M") returns nothing. So what did you expect it to do? All that does is define a function (binding the

Re: Python3 - How do I import a class from another file

2019-12-08 Thread R.Wieser
Peter, >> "from file import function" works, but fails when I try to do the same >> with a class. > > Are you sure? It should behave the same for any name in the module. I am. At least, that is what the error said: "cannot import 'classname' from 'filename' " But as it turns out the problem is

Re: Python3 - How do I import a class from another file

2019-12-08 Thread R.Wieser
Python, > from the_file import ClassName > > should work. I guess that your class name is not "class" right? You guessed that right. :-) Not a good idea to pick confusing names like that, especially when you do something the first time. > Note that in all cases when you import a module (either

Re: Python3 - How do I import a class from another file

2019-12-08 Thread R.Wieser
Chris, > Are you sure there's a difference between classes and functions here? Yes, quite sure. If not my attempt to load a class he same way as a function would have worked. Which it doesn't. > Try "from file import function" and see if it runs commands at > the root of the file. What funct

Re: python 2 to 3 converter

2019-12-08 Thread songbird
Chris Angelico wrote: > On Sun, Dec 8, 2019 at 7:36 PM songbird wrote: >> this would be a heck of a lot of fun. > > Then go ahead and do it. i know you're just being flip here and that's fine with me. that said, i'd love to! how big is PyPI? (huge) will it fit on an SSD? (no) my local m

Re: Python3 - How do I import a class from another file

2019-12-08 Thread Peter Otten
R.Wieser wrote: > Hello all, > > Using Python3 I would like to import a specific class from another file > (in the same folder), and have trouble doing so. > > "from file import function" works, but fails when I try to do the same > with a class. Are you sure? It should behave the same for any

Re: Python3 - How do I import a class from another file

2019-12-08 Thread Python
R.Wieser wrote: Hello all, Using Python3 I would like to import a specific class from another file (in the same folder), and have trouble doing so. "from file import function" works, but fails when I try to do the same with a class. "import file x = file.class" works, but also executes comman

Re: Python3 - How do I import a class from another file

2019-12-08 Thread Chris Angelico
On Mon, Dec 9, 2019 at 3:31 AM R.Wieser wrote: > > Hello all, > > Using Python3 I would like to import a specific class from another file (in > the same folder), and have trouble doing so. > > "from file import function" works, but fails when I try to do the same with > a class. > > "import file >

Re: Aw: Re: Re: Re: stuck on time

2019-12-08 Thread Ethan Furman
On 12/08/2019 06:32 AM, Python wrote: Well... Maybe it's time to admit, Rob, that programming is not your thing. Rob, my apologies. Whoever this person is, they are not "Python", and their behavior will not be tolerated. "Python", if you don't want to help then remain silent. If you don't

Python3 - How do I import a class from another file

2019-12-08 Thread R.Wieser
Hello all, Using Python3 I would like to import a specific class from another file (in the same folder), and have trouble doing so. "from file import function" works, but fails when I try to do the same with a class. "import file x = file.class" works, but also executes commands that are in t

Re: stuck on time

2019-12-08 Thread duncan smith
On 07/12/2019 17:48, RobH wrote: > I am trying to do this project on a pi zero: > > http://frederickvandenbosch.be/?p=1365 > > After overcoming a few errors, I now have the display working and the > start of the code showing on the display, that being the time. > > It doesn't move on to the next

Re: Aw: Re: Re: Re: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 14:26, Karsten Hilbert wrote: Like this? >>>print_time() Traceback (most recent call last) File "stdin>", line 1, in File "stdin>", line 2, in print_time File "stdin>", line 2, in print_time File "stdin>", line 2, in print_time [Previous line repeated 996 more times] RecursionEr

Re: Aw: Re: Re: Re: stuck on time

2019-12-08 Thread Chris Angelico
On Mon, Dec 9, 2019 at 1:56 AM RobH wrote: > Thanks, but I am only using the code which someone else has written, and > apparently it works ok for them and others but not for me. > > I only came here to find out why, and that is why I posted the link to > the code, which I thought would be helpful

Re: Aw: Re: Re: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 14:39, Chris Angelico wrote: On Mon, Dec 9, 2019 at 1:36 AM Python wrote: RobH wrote: On 08/12/2019 13:06, Karsten Hilbert wrote: In an interactive interpreter: def print_time(): current_time = time.strftime("%I:%M") What happens if you then do print_time() print_

Re: Aw: Re: Re: Re: stuck on time

2019-12-08 Thread Chris Angelico
On Mon, Dec 9, 2019 at 1:36 AM Python wrote: > > RobH wrote: > > On 08/12/2019 13:06, Karsten Hilbert wrote: > > In an interactive interpreter: > > > > def print_time(): > > current_time = time.strftime("%I:%M") > > What happens if you then do > > print_ti

Re: Aw: Re: Re: Re: stuck on time

2019-12-08 Thread Python
RobH wrote: On 08/12/2019 13:06, Karsten Hilbert wrote: In an interactive interpreter: def print_time():   current_time = time.strftime("%I:%M") What happens if you then do print_time() print_time() on it's own returns NameError: name 'print_time' is not defined Notice the "then" ab

Aw: Re: Re: Re: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
> Like this? > >>>print_time() > Traceback (most recent call last) > File "stdin>", line 1, in > File "stdin>", line 2, in print_time > File "stdin>", line 2, in print_time > File "stdin>", line 2, in print_time > [Previous line repeated 996 more times] > RecursionError: maximum recursion depth

Re: Aw: Re: Re: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 13:06, Karsten Hilbert wrote: In an interactive interpreter: def print_time(): current_time = time.strftime("%I:%M") What happens if you then do print_time() print_time() on it's own returns NameError: name 'print_time' is not defined Notice the "then" above ? Mo

Re: Vim settings for Python (was: tab replace to space 4)

2019-12-08 Thread Peter J. Holzer
On 2019-12-07 11:59:31 -0800, Bill Campbell wrote: > On Sat, Dec 07, 2019, Peter J. Holzer wrote: > >As an aside, to prevent vim from inserting tabs in the first place, set > >expandtab > >sw=4 > >and maybe also > >ts=4 > > Inserting a comment in the file like this makes thing easy. >

Aw: Re: Re: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
> >> In an interactive interpreter: > >> > >> def print_time(): > >> current_time = time.strftime("%I:%M") > > > > What happens if you then do > > > > print_time() > > > > print_time() > on it's own returns NameError: name 'print_time' is not defined Notice the "then" above ? More precisely:

Re: Aw: Re: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 10:39, Karsten Hilbert wrote: In an interactive interpreter: def print_time(): current_time = time.strftime("%I:%M") returns nothing. That should be correct. What happens if you then do print_time() inside the interpreter ? Karsten print_time() on it's own return

Aw: Re: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
> In an interactive interpreter: > > def print_time(): > current_time = time.strftime("%I:%M") > > returns nothing. That should be correct. What happens if you then do print_time() inside the interpreter ? Karsten -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2 to 3 converter

2019-12-08 Thread Chris Angelico
On Sun, Dec 8, 2019 at 7:36 PM songbird wrote: > this would be a heck of a lot of fun. Then go ahead and do it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 04:37, Dennis Lee Bieber wrote: On Sat, 7 Dec 2019 20:38:20 +, RobH declaimed the following: What program has or is an interactive interpreter, if it's not Thonny Thonny is an IDE... It might expose access to the Python interpreter (I've only loaded it once -- I t

Re: Aw: Re: stuck on time

2019-12-08 Thread RobH
On 08/12/2019 08:18, Karsten Hilbert wrote: Sorry, I should have said just the line, and it didn't return anything. OK, a bit strange, but then that might be due to Thonny. Is Thonny an interpreter then. It sort of is, or at least it runs one. We'd like to take that out of the equation. I m

Re: Aw: Re: stuck on time

2019-12-08 Thread DL Neil via Python-list
On 8/12/19 9:18 PM, Karsten Hilbert wrote: Sorry, I should have said just the line, and it didn't return anything. OK, a bit strange, but then that might be due to Thonny. Is Thonny an interpreter then. It sort of is, or at least it runs one. We'd like to take that out of the equation. I me

python 2 to 3 converter

2019-12-08 Thread songbird
wouldn't it make more sense to just go back and fix the converter program than to have to manually convert all this python2 code? how many small test bits of code from PyPI could be used as templates for patterns to search for that can then be automatically converted and the test rerun? thous

Aw: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
> Sorry, I should have said just the line, and it didn't return anything. OK, a bit strange, but then that might be due to Thonny. > Is Thonny an interpreter then. It sort of is, or at least it runs one. We'd like to take that out of the equation. I meant to run *just* an interpreter, namely, th