Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Marko Rauhamaa
Chris Angelico : > Ah. Okay. So in theory, you could have exact float literals and > inexact integer literals, if you tag them in some way: > > 300 ; Exactly 300 > 300! ; Inexact - roughly 300 > 3.0 ; Exactly three > 3.0! ; Roughly three and zero tenths In Scheme: #e300 #i300 #e3.0

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Chris Angelico
On Mon, Jul 18, 2016 at 3:37 PM, Rustom Mody wrote: > On Monday, July 18, 2016 at 10:06:11 AM UTC+5:30, Chris Angelico wrote: >> Why does that mean that 3.0 is inexact? In what way is 3.0 "inexact"? >> It's an exact value representing the integer three. > > [Assuming you are asking in good faith a

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Rustom Mody
On Monday, July 18, 2016 at 10:06:11 AM UTC+5:30, Chris Angelico wrote: > On Mon, Jul 18, 2016 at 2:16 PM, Rustom Mody wrote: > > On Saturday, July 16, 2016 at 3:16:48 PM UTC+5:30, Steven D'Aprano wrote: > > Here are the first couple of hits it gives (me) for “scheme exact number” > > > > | Scheme

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Rustom Mody
On Monday, July 18, 2016 at 10:16:58 AM UTC+5:30, Ben Finney wrote: > You will be able to express yourself much more clearly on this topic > when you cease conflating a number with measurements of that number, or > conflating a number with representations of that number. > That more or less sums

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Ben Finney
Rustom Mody writes: > AIUI… > There are two almost completely unrelated notions of exact > > 1. ⅓ in decimal cannot be exactly represented though 0.3 0.33 etc are > approximations. We could call these inexact forms of ⅓ Better would be to use the term already used: 0. is an inexact *represen

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Chris Angelico
On Mon, Jul 18, 2016 at 2:16 PM, Rustom Mody wrote: > On Saturday, July 16, 2016 at 3:16:48 PM UTC+5:30, Steven D'Aprano wrote: > Here are the first couple of hits it gives (me) for “scheme exact number” > > | Scheme integers can be exact and inexact. For example, a number > | written as 3.0 with

What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-17 Thread Rustom Mody
On Saturday, July 16, 2016 at 3:16:48 PM UTC+5:30, Steven D'Aprano wrote: > On Sat, 16 Jul 2016 04:53 pm, Random832 wrote: > > > Eliminate both of them. Move to a single abstract numeric type* a la > > Scheme, with an "inexact" attribute (inexact numbers may or may not be > > represented by a floa

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Lawrence D’Oliveiro
On Monday, July 18, 2016 at 3:04:13 AM UTC+12, Steven D'Aprano wrote: > __slots__ is not obsolete, but 99% of the time you shouldn't bother with it. I find __slots__ very useful. I have them right through my Qahirah classes , for example. -- https://mail.python.o

Re: Python code change

2016-07-17 Thread Steven D'Aprano
On Mon, 18 Jul 2016 05:00 am, tsanchez117...@gmail.com wrote: > Im trying to run a Python application but im stuck on a problem. The > application requires a log in and password to run the application. The > only problem that I'm having is that the code was written to connect to a > data base and

Python code change

2016-07-17 Thread tsanchez117 . ts
Im trying to run a Python application but im stuck on a problem. The application requires a log in and password to run the application. The only problem that I'm having is that the code was written to connect to a data base and from there it sees the username and password that is linked to the d

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread ldompeling
Op zondag 17 juli 2016 11:19:32 UTC+2 schreef ldomp...@casema.nl: > I copy this script from the magpi but when I run this script I get this > error: > SyntaxError: Non-ASCII character '\xe2' in file sound.py on line 32, but no > encoding declared; see http://python.org/dev/peps/pep-0263/ for det

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Wildman via Python-list
On Sun, 17 Jul 2016 05:01:21 -0700, ldompeling wrote: > I installed python 3.4 and set my python path to PYTONPATH:/usr/bin/python3.4 > > When I try to import pyaudio then I get this error: > Python 3.4.2 (default, Oct 19 2014, 13:31:11) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Steven D'Aprano
On Mon, 18 Jul 2016 01:58 am, Steven D'Aprano wrote: > All objects > can be coerced to strings, using either str() or repr(). If you define > only one of __str__ or __repr__, Python will use the other. Er, sorry, that was incoherent. I hit Send too quick, without editing. What I meant to say was

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Steven D'Aprano
On Mon, 18 Jul 2016 01:00 am, Rustom Mody wrote: >> I'm still waiting to hear in what way it is not straightforward. You keep >> insisting that it isn't, but haven't told us in what way it is not. > > The re/automaton/graph examples were towards this only and I think we are > running in circles o

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 09:50 pm, Wilson Ong wrote: > >> Use this feature sparingly, only when you know that there are going to be >> many (millions rather than thousands) of Test instances. > > Why use it sparingly? Is it for extensibility? What if I'm pretty sure > that my class is going to have e

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Rustom Mody
On Sunday, July 17, 2016 at 4:32:36 PM UTC+5:30, Steven D'Aprano wrote: > On Sun, 17 Jul 2016 04:44 pm, Rustom Mody wrote: > > > My earlier statement (with emphasis in original): > >> You also have a bizarre notion that python's property: “Everything has > >> auto-bool-nature” IS STRAIGHTFORWARD.

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 11:35 pm, ldompel...@casema.nl wrote: > I also get a lot off alsa errors on my screen so I don't no if that result > in this error: > > Traceback (most recent call last): > File "sound.py", line 19, in > rate=RATE, input=TRUE, frames_per_buffer=CHUNK) > NameError: name 'TRUE'

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 10:01 pm, ldompel...@casema.nl wrote: > I installed python 3.4 and set my python path to > PYTONPATH:/usr/bin/python3.4 > > When I try to import pyaudio then I get this error: > Python 3.4.2 (default, Oct 19 2014, 13:31:11) > [GCC 4.9.1] on linux > Type "help", "copyright", "c

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread ldompeling
Op zondag 17 juli 2016 11:19:32 UTC+2 schreef ldomp...@casema.nl: > I copy this script from the magpi but when I run this script I get this > error: > SyntaxError: Non-ASCII character '\xe2' in file sound.py on line 32, but no > encoding declared; see http://python.org/dev/peps/pep-0263/ for det

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 10:01 PM, wrote: > I installed python 3.4 and set my python path to PYTONPATH:/usr/bin/python3.4 > > When I try to import pyaudio then I get this error: > Python 3.4.2 (default, Oct 19 2014, 13:31:11) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread ldompeling
Op zondag 17 juli 2016 11:19:32 UTC+2 schreef ldomp...@casema.nl: > I copy this script from the magpi but when I run this script I get this > error: > SyntaxError: Non-ASCII character '\xe2' in file sound.py on line 32, but no > encoding declared; see http://python.org/dev/peps/pep-0263/ for det

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 9:50 PM, Wilson Ong wrote: >> Use this feature sparingly, only when you know that there are going to be >> many (millions rather than thousands) of Test instances. > > Why use it sparingly? Is it for extensibility? What if I'm pretty sure that > my class is going to have e

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Kent Tong
Hi Peter, Thanks a lot for your excellent explanation! -- https://mail.python.org/mailman/listinfo/python-list

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Wilson Ong
> Use this feature sparingly, only when you know that there are going to be > many (millions rather than thousands) of Test instances. Why use it sparingly? Is it for extensibility? What if I'm pretty sure that my class is going to have exactly these attributes only? -- https://mail.python.org

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Peter Otten
Kent Tong wrote: > Hi, > > I can add new variables to user-defined classes like: > class Test: > ... pass > ... a=Test() a.x=100 > > but it doesn't work if the instances belong to a built-in class such as > str or list: > a='abc' a.x=100 > Traceback (most recent c

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 04:44 pm, Rustom Mody wrote: > My earlier statement (with emphasis in original): >> You also have a bizarre notion that python's property: “Everything has >> auto-bool-nature” IS STRAIGHTFORWARD. I'm still waiting to hear in what way it is not straightforward. You keep insisti

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 07:57 pm, Rustom Mody wrote: > I dare say that Python3’s : > Traceback (most recent call last): > File "", line 1, in > File "/home/ariston/foo.py", line 31 > wf = wave.open(“test.wav”, “rb”) >^ > SyntaxError: invalid character in identifier If

can't add variables to instances of built-in classes

2016-07-17 Thread Kent Tong
Hi, I can add new variables to user-defined classes like: >>> class Test: ... pass ... >>> a=Test() >>> a.x=100 but it doesn't work if the instances belong to a built-in class such as str or list: >>> a='abc' >>> a.x=100 Traceback (most recent call last): File "", line 1, in Attribu

Re: Clean Singleton Docstrings

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 06:03 pm, Random832 wrote: > On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote: >> > True, although the programmer has control over the feature. If you >> > *want* the luxury of exact fractions, you pay the price. If you don't, >> > you make the numbers inexact. >> >> Not i

Re: python IDLE display with a 13.3-inch screen

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 07:09 pm, bbking4...@laposte.net wrote: > Hello, I just load the latest version of Python 3.5 on my new computer > Asus 13.3-inch full HD display and the police is blurred in IDLE. Police? police n 1: the force of policemen and officers; "the law came looking fo

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 05:44 pm, Lawrence D’Oliveiro wrote: > On Sunday, July 17, 2016 at 7:33:19 PM UTC+12, Chris Angelico wrote: >> 1) REXX and, I think, Pascal: there are two specific values that may >> be used in conditionals, and anything else is an error > > Worth comparing how two different l

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Rustom Mody
On Sunday, July 17, 2016 at 2:56:53 PM UTC+5:30, Chris Angelico wrote: > On Sun, Jul 17, 2016 at 7:19 PM, wrote: > > wf = wave.open(“test.wav”, “rb”) > > Watch your quotes. They want to be flat quotes, U+0022 "this sort", > not any sort of typographical quote. > > Recommendation: Use a programm

Re: SyntaxError: Non-ASCII character

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 7:19 PM, wrote: > wf = wave.open(“test.wav”, “rb”) Watch your quotes. They want to be flat quotes, U+0022 "this sort", not any sort of typographical quote. Recommendation: Use a programmer's editor, not a word processor, for working with code. As well as not mangling it,

SyntaxError: Non-ASCII character

2016-07-17 Thread ldompeling
I copy this script from the magpi but when I run this script I get this error: SyntaxError: Non-ASCII character '\xe2' in file sound.py on line 32, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details Below is the eamplescript. What is wrong with this script. # You ne

python IDLE display with a 13.3-inch screen

2016-07-17 Thread bbking4611--- via Python-list
Hello, I just load the latest version of Python 3.5 on my new computer Asus 13.3-inch full HD display and the police is blurred in IDLE. I like to use IDLE with my students but I am unable to solve the problem. If someone can do an update for its screens. Thank you. Cordially. -- https://mail.p

Re: Clean Singleton Docstrings

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 6:08 PM, Random832 wrote: > On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote: >> Currently yes, you can choose to use fractions.Fraction and pay the >> price. How, if you have a single type with different representations, >> can you make that choice? > > Sorry, I forgot

Re: Clean Singleton Docstrings

2016-07-17 Thread Random832
On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote: > Currently yes, you can choose to use fractions.Fraction and pay the > price. How, if you have a single type with different representations, > can you make that choice? Sorry, I forgot to answer your question. Though, your implicit claim that

Re: Clean Singleton Docstrings

2016-07-17 Thread Random832
On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote: > > True, although the programmer has control over the feature. If you > > *want* the luxury of exact fractions, you pay the price. If you don't, > > you make the numbers inexact. > > Not if you have a single "Number" type: Saying that exact a

Re: Clean Singleton Docstrings

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 5:41 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> The trouble is, repeated addition of fractions is *able* to deliver an >> exact result. It just might result in an incredibly slow program. > > True, although the programmer has control over the feature. If you > *want*

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Lawrence D’Oliveiro
On Sunday, July 17, 2016 at 7:33:19 PM UTC+12, Chris Angelico wrote: > 1) REXX and, I think, Pascal: there are two specific values that may > be used in conditionals, and anything else is an error Worth comparing how two different languages deal with strict enforcement of booleans: * Modula-2 doe

Re: Clean Singleton Docstrings

2016-07-17 Thread Marko Rauhamaa
Chris Angelico : > The trouble is, repeated addition of fractions is *able* to deliver an > exact result. It just might result in an incredibly slow program. True, although the programmer has control over the feature. If you *want* the luxury of exact fractions, you pay the price. If you don't, y

Re: PEP Request: Advanced Data Structures

2016-07-17 Thread Rustom Mody
On Sunday, July 17, 2016 at 3:45:04 AM UTC+5:30, Shrey Desai wrote: > I have found it slightly frustrating that Python does not have built-in > support for advanced data structures (Linked Lists, Stacks/Queues, BST) in > its distribution. Many computer science students, developers, and software

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 4:44 PM, Rustom Mody wrote: > I am sure Chris you can distinguish between: > > - Python’s (bool) model is bizarre > - The model “Everything has auto-bool-nature” is bizarre > - The notion « “Everything has auto-bool-nature” is straightforward » is > bizarre > > > My earlie

Re: PEP Request: Advanced Data Structures

2016-07-17 Thread Marko Rauhamaa
MRAB : > Given that Python has dict, there's not much need for a binary search tree. Dicts don't have the concept of key order. I use my own AVL tree to implement timers. A balanced tree data structure is the only major data structure I've missed in Python. It is there in Java and C++, for example

Re: Passing File Descriptors To Subprocesses

2016-07-17 Thread Lawrence D’Oliveiro
On Sunday, July 17, 2016 at 3:01:36 PM UTC+12, eryk sun wrote: > It works correctly in 3.4+ ... Yup, confirmed it happens only in 3.3. -- https://mail.python.org/mailman/listinfo/python-list

Re: Operator Precedence/Boolean Logic

2016-07-17 Thread Rustom Mody
On Sunday, July 17, 2016 at 12:15:40 PM UTC+5:30, Rustom Mody wrote: > On Sunday, July 17, 2016 at 9:35:57 AM UTC+5:30, Chris Angelico wrote: > > On Sun, Jul 17, 2016 at 1:43 PM, Rustom Mody wrote: > > > Heh! A flurry of opinions! > > > No time right now… other than to say thank you (MRAB) for thi