Re: How to record the console's content in the interpreter?

2019-08-22 Thread Cameron Simpson
On 22Aug2019 21:48, Jach Fong wrote: Cameron Simpson於 2019年8月23日星期五 UTC+8下午12時09分54秒寫道: On 22Aug2019 19:38, Jach Fong wrote: >Say I like to record everything showing in the console into a file >after I start a debug session, and stop it when finished. It's not >a console redirection. I still n

Re: How should we use global variables correctly?

2019-08-22 Thread Windson Yang
I also want to know what is the difference between "using 'global variables' in a py module" and "using a variable in class". For example: In global.py: foo = 1 def bar(): global foo return foo + 1 In class.py class Example: def __init__(self): s

Re: How to record the console's content in the interpreter?

2019-08-22 Thread jfong
Cameron Simpson於 2019年8月23日星期五 UTC+8下午12時09分54秒寫道: > On 22Aug2019 19:38, Jach Fong wrote: > >Say I like to record everything showing in the console into a file > >after I start a debug session, and stop it when finished. It's not > >a console redirection. I still need to see what is going on durin

Re: How to record the console's content in the interpreter?

2019-08-22 Thread Cameron Simpson
On 22Aug2019 19:38, Jach Fong wrote: Say I like to record everything showing in the console into a file after I start a debug session, and stop it when finished. It's not a console redirection. I still need to see what is going on during the session. If you're in a terminal you can run the 'sc

How to record the console's content in the interpreter?

2019-08-22 Thread jfong
Say I like to record everything showing in the console into a file after I start a debug session, and stop it when finished. It's not a console redirection. I still need to see what is going on during the session. --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: How should we use global variables correctly?

2019-08-22 Thread Chris Angelico
On Fri, Aug 23, 2019 at 11:24 AM Windson Yang wrote: > > Thank you all for the great explanation, I still trying to find some good > example to use 'global', In CPython, I found an example use 'global' in > cpython/Lib/zipfile.py > > _crctable = None > def _gen_crc(crc): > for j in

Re: How should we use global variables correctly?

2019-08-22 Thread Windson Yang
Thank you all for the great explanation, I still trying to find some good example to use 'global', In CPython, I found an example use 'global' in cpython/Lib/zipfile.py _crctable = None def _gen_crc(crc): for j in range(8): if crc & 1: crc = (crc >> 1) ^

Re: How should we use global variables correctly?

2019-08-22 Thread Richard Damon
On 8/22/19 12:00 PM, Windson Yang wrote: > I can 'feel' that global variables are evil. I also read lots of articles > proves that (http://wiki.c2.com/?GlobalVariablesAreBad). However, I found > CPython Lib use quite a lot of `global` keyword. So how should we use > `global` keyword correctly? IIUC

Re: How should we use global variables correctly?

2019-08-22 Thread Chris Angelico
On Fri, Aug 23, 2019 at 10:18 AM Cameron Simpson wrote: > As Michael says, "you can always read from a parent scope if the name > hasn't been used by the local scope". What this means is this: > > _MODULE_LEVEL_CACHE = {} > > def factors_of(n): > factors = _MODULE_LEVEL_CACHE.get(n

Re: How should we use global variables correctly?

2019-08-22 Thread Cameron Simpson
On 22Aug2019 11:12, Michael Torrie wrote: On 8/22/19 10:00 AM, Windson Yang wrote: I can 'feel' that global variables are evil. I also read lots of articles proves that (http://wiki.c2.com/?GlobalVariablesAreBad). However, I found CPython Lib use quite a lot of `global` keyword. So how should w

Broken

2019-08-22 Thread Nikos63205
I am using python for MM creator pro/relocator G but any time I try to generate Gcode it tells me to update or fix my python but any time I do it and try to generate gcode it says the same thing -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about Python syntax

2019-08-22 Thread Kyle Stanley
> You are right, but it is even worse than you think. I do not have a tutorial so I have no examples to understand. The tutorial that Terry was referring to was the one on docs.python.org, here's a couple of links for the sections he was referring to: Full section on classes: https://docs.python.

Re: Newbie question about Python syntax

2019-08-22 Thread Paul St George
On 22/08/2019 20:02, Terry Reedy wrote: On 8/22/2019 3:34 AM, Paul St George wrote: I have the Python API for the Map Value Node here: . All well and good. Now I just want to write a simple line of code such as: i

Re: Newbie question about Python syntax

2019-08-22 Thread Terry Reedy
On 8/22/2019 3:34 AM, Paul St George wrote: I have the Python API for the Map Value Node here: . All well and good. Now I just want to write a simple line of code such as: import bpy ... >>>print(bpy.types.Composi

Re: itertools cycle() docs question

2019-08-22 Thread Terry Reedy
On 8/22/2019 11:35 AM, Dennis Lee Bieber wrote: On Wed, 21 Aug 2019 12:52:44 -0700, Tobiah declaimed the following: I see. What is an example of an iterable that is not reusable? Essentially all iterators, which included all generators, which includes the return from all generator functio

Re: Tkinter Progress Bar

2019-08-22 Thread Terry Reedy
On 8/22/2019 12:12 PM, Dennis Lee Bieber wrote: On Thu, 22 Aug 2019 15:49:28 +0200, nospam_2...@efbe.prima.de declaimed the following: Am 22.08.19 um 15:19 schrieb Daniel: If i have a figure like 13247347347437x23828328382  how to make a progress bar in tkinter that shows the time the pc takes

Re: How should we use global variables correctly?

2019-08-22 Thread Michael Torrie
On 8/22/19 10:00 AM, Windson Yang wrote: > I can 'feel' that global variables are evil. I also read lots of articles > proves that (http://wiki.c2.com/?GlobalVariablesAreBad). However, I found > CPython Lib use quite a lot of `global` keyword. So how should we use > `global` keyword correctly? IIUC

Tkinter Progress Bar

2019-08-22 Thread Daniel
If i have a figure like 13247347347437x23828328382 how to make a progress bar in tkinter that shows the time the pc takes to give the result? --- Este email foi escaneado pelo Avast antivírus. https://www.avast.com/antivirus -- https://mail.python.org/mailman/listinfo/python-list

How should we use global variables correctly?

2019-08-22 Thread Windson Yang
I can 'feel' that global variables are evil. I also read lots of articles proves that (http://wiki.c2.com/?GlobalVariablesAreBad). However, I found CPython Lib use quite a lot of `global` keyword. So how should we use `global` keyword correctly? IIUC, it's fine that we use `global` keyword inside t

Re: itertools cycle() docs question

2019-08-22 Thread Chris Angelico
On Fri, Aug 23, 2019 at 1:41 AM Dennis Lee Bieber wrote: > > On Wed, 21 Aug 2019 12:52:44 -0700, Tobiah declaimed the > following: > > > > >I see. What is an example of an iterable that is not reusable? > > > >>> x = range(5) > >>> x > range(0, 5) > >>> > >>> x = range(0, 5) >>> list(x) [0, 1,

Re: Tkinter Progress Bar

2019-08-22 Thread nospam_2019
Am 22.08.19 um 15:19 schrieb Daniel: > If i have a figure like 13247347347437x23828328382  how to make a > progress bar in tkinter that shows the time the pc takes to give the > result? > https://docs.python.org/3/library/tkinter.ttk.html?highlight=progressbar -- https://mail.python.org/mailman

Re: Newbie question about Python syntax

2019-08-22 Thread Chris Angelico
On Thu, Aug 22, 2019 at 9:20 PM Paul St George wrote: > > On 22/08/2019 11:49, Cameron Simpson wrote: > > On 22Aug2019 09:34, Paul St George wrote: > >> I have the Python API for the Map Value Node here: > >> . > >> > >>

Re: Newbie question about Python syntax

2019-08-22 Thread Paul St George
On 22/08/2019 11:49, Cameron Simpson wrote: On 22Aug2019 09:34, Paul St George wrote: I have the Python API for the Map Value Node here: . All well and good. Now I just want to write a simple line of code such as:

Re: Newbie question about Python syntax

2019-08-22 Thread Cameron Simpson
On 22Aug2019 09:34, Paul St George wrote: I have the Python API for the Map Value Node here: . All well and good. Now I just want to write a simple line of code such as: import bpy print(bpy.types.CompositorNodeMapVa

Newbie question about Python syntax

2019-08-22 Thread Paul St George
I have the Python API for the Map Value Node here: . All well and good. Now I just want to write a simple line of code such as: import bpy ... >>>print(bpy.types.CompositorNodeMapValue.max[0]) If this works, I will d