Re: f-string anomaly

2018-05-13 Thread Ken Kundert
Terry, Thanks for your response. I apologize about the double posting. I am well aware how doing so is bad form. My double posting was unintentional; it occurred when my news reader misbehaved. What I did in my code was to put double braces inside the format_spec, which the syntax specificati

random.choices() Suggest that the code confirm that cum_weights sequence is in ascending order

2018-05-13 Thread Paul
Hi, I just learned how to use random.choices(). I initially misunderstood the documentation for cum_weights as meaning that a cumulative sequence would be *constructed from* the sequence which I supplied. Consequently, I specified 'cum_weights' with a sequence which wasn't in ascending order.

Re: pylint/pyreverse with Python3

2018-05-13 Thread Terry Reedy
On 5/13/2018 1:01 PM, Rich Shepard wrote:   Installed here is pylint-1.7.1 and python-3.6.5. When I try to run pyreverse (and pylint) on python3 source code it fails because it finds only the python-2.7 site-package and not the python-3.6 site-package.   If you have learned how to run pyli

Re: f-string anomaly

2018-05-13 Thread Terry Reedy
On 5/13/2018 3:22 PM, Ken Kundert wrote: Please do not double post. I am seeing an unexpected difference between the behavior of the string format method and f-strings. Read https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals carefully. Here is an example:

f-string anomaly

2018-05-13 Thread Ken Kundert
I am seeing an unexpected difference between the behavior of the string format method and f-strings in Python3.6. Here is an example: import sys, os from inform import error, os_error class mydict(dict): def __format__(self, template): print('Template:', template)

Re: object types, mutable or not?

2018-05-13 Thread Richard Damon
On 5/13/18 4:02 PM, Mike McClain wrote: > I'm new to Python and OOP. > Python en 2.7.14 Documentation The Python Language Reference > 3. Data model > 3.1. Objects, values and types > An object's type is also unchangeable. [1] > [1] It is possible in some cases to change an object's type, >

Re: object types, mutable or not?

2018-05-13 Thread MRAB
On 2018-05-13 21:02, Mike McClain wrote: I'm new to Python and OOP. Python en 2.7.14 Documentation The Python Language Reference 3. Data model 3.1. Objects, values and types An object's type is also unchangeable. [1] [1] It is possible in some cases to change an object's type, under ce

Re: object types, mutable or not?

2018-05-13 Thread Peter J. Holzer
On 2018-05-13 13:02:01 -0700, Mike McClain wrote: > I'm new to Python and OOP. > Python en 2.7.14 Documentation The Python Language Reference Python 2 is near end-of-life. If you are new to Python you should use Python 3 (unless you have to maintain legacy software written in Python 2). > 3. Da

object types, mutable or not?

2018-05-13 Thread Mike McClain
I'm new to Python and OOP. Python en 2.7.14 Documentation The Python Language Reference 3. Data model 3.1. Objects, values and types An object's type is also unchangeable. [1] [1] It is possible in some cases to change an object's type, under certain controlled conditions. It appears to

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-13 Thread Peter J. Holzer
On 2018-05-11 12:32:24 +0100, bartc wrote: > I tried it in Python 3 (0o100.5 - I find that prefix fiddly to type actually > as I have to stop and think), and it seems to be illegal. You could also read the docs. > Based floating point literals may be unusual, but bear in mind that in > decimal,

f-string anomaly

2018-05-13 Thread Ken Kundert
I am seeing an unexpected difference between the behavior of the string format method and f-strings. Here is an example: import sys, os from inform import error, os_error class mydict(dict): def __format__(self, template): print('Template:', template)

pylint/pyreverse with Python3

2018-05-13 Thread Rich Shepard
Installed here is pylint-1.7.1 and python-3.6.5. When I try to run pyreverse (and pylint) on python3 source code it fails because it finds only the python-2.7 site-package and not the python-3.6 site-package. If you have learned how to run pylint/pyreverse on python3 code please share your kn

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-13 Thread Chris Angelico
On Sun, May 13, 2018 at 9:05 PM, Steven D'Aprano wrote: > On Sat, 12 May 2018 21:42:13 -0500, Python wrote: > >> Responding to this further would essentially just require me to >> reiterate what I already wrote--I won't do that. I'll simply maintain >> that in my rather lenghty experience, this m

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-13 Thread Steven D'Aprano
On Sat, 12 May 2018 21:42:13 -0500, Python wrote: > Responding to this further would essentially just require me to > reiterate what I already wrote--I won't do that. I'll simply maintain > that in my rather lenghty experience, this mistake has actually been > rather rare and has to my knowledge