Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 2:38 PM, Python wrote: > On Sat, Nov 18, 2017 at 02:19:25PM +1100, Chris Angelico wrote: >> On Sat, Nov 18, 2017 at 2:12 PM, Python wrote: >> > On Sat, Nov 18, 2017 at 10:47:55AM +1100, Chris Angelico wrote: >> >> On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: >> >> > On

Re: "help( pi )"

2017-11-17 Thread Python
On Sat, Nov 18, 2017 at 02:19:25PM +1100, Chris Angelico wrote: > On Sat, Nov 18, 2017 at 2:12 PM, Python wrote: > > On Sat, Nov 18, 2017 at 10:47:55AM +1100, Chris Angelico wrote: > >> On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: > >> > On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico

Re: ctypes help

2017-11-17 Thread Python
On Sat, Nov 18, 2017 at 10:49:40AM +1100, Chris Angelico wrote: > On Sat, Nov 18, 2017 at 9:11 AM, Python wrote: > > Hello Pythonistas, > > > > I'm starting to play with ctypes, as I'd like to provide Python > > interfaces to a C/C++ library I have. For now I'm just messing with a > > very simple

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 2:12 PM, Python wrote: > On Sat, Nov 18, 2017 at 10:47:55AM +1100, Chris Angelico wrote: >> On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: >> > On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico wrote: >> >> Perhaps what we want is not so much "attach docstrings to

Re: "help( pi )"

2017-11-17 Thread Python
On Sat, Nov 18, 2017 at 10:47:55AM +1100, Chris Angelico wrote: > On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: > > On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico wrote: > >> Perhaps what we want is not so much "attach docstrings to floats" but > >> "get documentation for a module attr

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 10:35 AM, Stefan Ram wrote: > Dennis Lee Bieber writes: >>should >> help(3.1415926536) #or whatever precision is used in >> module math >>produce anything? > > That question made me try something else whose output > surprises me: > > |Python 3.7.0 .

Re: ctypes help

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 9:11 AM, Python wrote: > Hello Pythonistas, > > I'm starting to play with ctypes, as I'd like to provide Python > interfaces to a C/C++ library I have. For now I'm just messing with a > very simple piece of code to get things sorted out. I'm working with > this example C+

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 10:34 AM, Python wrote: > On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico wrote: >> Perhaps what we want is not so much "attach docstrings to floats" but >> "get documentation for a module attribute, not for the object referred >> to". > > The reason this can't rea

Re: "help( pi )"

2017-11-17 Thread Python
On Sat, Nov 18, 2017 at 09:50:29AM +1100, Chris Angelico wrote: > Perhaps what we want is not so much "attach docstrings to floats" but > "get documentation for a module attribute, not for the object referred > to". The reason this can't really work is that members are just variables with arbitrar

ctypes help

2017-11-17 Thread Python
Hello Pythonistas, I'm starting to play with ctypes, as I'd like to provide Python interfaces to a C/C++ library I have. For now I'm just messing with a very simple piece of code to get things sorted out. I'm working with this example C++ library, which just wraps a call to stat(): -=-=-=-=-=-=

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 9:38 AM, Cameron Simpson wrote: > I don't think he's arguing that help magicly recognises 3.1415926536 as "pi" > and produces a docstring for it and all "sufficiently close" values. I'm > not. But the math module has bound "pi" to a specific float. Why _can't_ we > annotat

Re: "help( pi )"

2017-11-17 Thread Cameron Simpson
On 17Nov2017 11:09, Dennis Lee Bieber wrote: On 17 Nov 2017 12:36:37 GMT, r...@zedat.fu-berlin.de (Stefan Ram) declaimed “The argument to pydoc can be the name of a function, module, or package, or a dotted reference to a class, method, or function within a module or module in a package.” , b

Re: Should constants be introduced to Python?

2017-11-17 Thread Marcin Tustin
Yes the same consideration applies to any new feature. I think that Python's reticence to add new features has been a strength. And I do think the benefit here is absolutely negligible. It's not that I don't like constants - but there's a bunch of things that go great together, like constants, fun

Re: "help( pi )"

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 8:27 AM, Gregory Ewing wrote: > It *could* be made to work: > > import math > > class PI(float): > > __doc__ = "The circle constant (Note: tau is better :-)" > > math.pi = PI(math.pi) > > print(math.pi) > help(math.pi) How is THAT an improvemen

Re: "help( pi )"

2017-11-17 Thread Gregory Ewing
It *could* be made to work: import math class PI(float): __doc__ = "The circle constant (Note: tau is better :-)" math.pi = PI(math.pi) print(math.pi) help(math.pi) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Artificial creating of [Lists], is it possible? the best way...

2017-11-17 Thread Rick Johnson
On Thursday, November 16, 2017 at 12:48:05 PM UTC-6, Jakub Raj ok wrote: > Artificial creating of [Lists], is it possible? the best way... There is nothing "artificial" about creating any object. Much less python lists. And i believe the usage of such word in the title of this thread was unfortun

Re: Should constants be introduced to Python?

2017-11-17 Thread bartc
On 17/11/2017 15:14, Marcin Tustin wrote: I'm against this because Python's strength is its simplicity. If it was simple once, then it isn't any more. Perhaps you mean consistency, in having only one class of identifier which can always be assigned to. All the benefits of this can be achie

Re: from xx import yy

2017-11-17 Thread Bob van der Poel
On Thu, Nov 16, 2017 at 2:46 PM, Cameron Simpson wrote: > On 16Nov2017 09:42, bvdp wrote: > >> In my original case, I think (!!!), the problem was that I had a variable >> in mod1.py and when I did the "from mod1 import myvarible" all was fine. >> Python create a new local-to-the-module variable

Re: Artificial creating of [Lists], is it possible? the best way...

2017-11-17 Thread Grant Edwards
On 2017-11-17, eth0 wrote: > On Fri, 17 Nov 2017 00:04:16 + in comp.lang.python, MRAB said: >> On 2017-11-16 18:47, jakub.raj...@gmail.com wrote: >> > Hello, im working on school project, its deck game Sorry! >> > I need to create specific lists: >> > My idea is about to using for >> > For i

Re: "help( pi )"

2017-11-17 Thread Paul Moore
On 17 November 2017 at 15:52, Marko Rauhamaa wrote: > Paul Moore : >> numbers don't have docstrings. > > There's no reason they couldn't: In the sense that the Python object model could be amended to attach docstrings to instances of classes like "int", and syntax could be added to the language t

Re: Artificial creating of [Lists], is it possible? the best way...

2017-11-17 Thread Chris Angelico
On Sat, Nov 18, 2017 at 2:29 AM, eth0 wrote: > On Fri, 17 Nov 2017 00:04:16 + in comp.lang.python, MRAB said: >> On 2017-11-16 18:47, jakub.raj...@gmail.com wrote: >> > Hello, im working on school project, its deck game Sorry! >> > I need to create specific lists: >> > My idea is about to usi

Re: Artificial creating of [Lists], is it possible? the best way...

2017-11-17 Thread eth0
On Fri, 17 Nov 2017 00:04:16 + in comp.lang.python, MRAB said: > On 2017-11-16 18:47, jakub.raj...@gmail.com wrote: > > Hello, im working on school project, its deck game Sorry! > > I need to create specific lists: > > My idea is about to using for > > For i in range (n): > > i=[] > >

Re: Should constants be introduced to Python?

2017-11-17 Thread Marko Rauhamaa
Marcin Tustin : > I'm against this because Python's strength is its simplicity. This > doesn't actually simplify anything, but it does add a new language > feature to understand. And there will be eternal debates on the correct use of the feature. One of the ugliest features of C is the "const"

Re: "help( pi )"

2017-11-17 Thread Marko Rauhamaa
Paul Moore : > numbers don't have docstrings. There's no reason they couldn't: >>> help(2) Help on built-in number 2 in module builtins: 2 2 -> int The natural number immediately succeeding 1 (qv). The number of hemispheres in a healthy mammal's brain. It might also

Re: Should constants be introduced to Python?

2017-11-17 Thread Marcin Tustin
I'm against this because Python's strength is its simplicity. This doesn't actually simplify anything, but it does add a new language feature to understand. All the benefits of this can be achieved with linting. On Thu, Nov 16, 2017 at 1:16 AM, Saeed Baig wrote: > Hey guys I am thinking of perh

Re: "help( pi )"

2017-11-17 Thread Paul Moore
On 17 November 2017 at 12:36, Stefan Ram wrote: > A web page says: > > “The argument to pydoc can be the name of a function, > module, or package, or a dotted reference to a class, > method, or function within a module or module in a package.” [...] > , but not for »pi«: > > from math import p

Re: Should constants be introduced to Python?

2017-11-17 Thread bartc
On 16/11/2017 06:16, Saeed Baig wrote: Hey guys I am thinking of perhaps writing a PEP to introduce constants to Python. Something along the lines of Swift’s “let” syntax (e.g. “let pi = 3.14”). Since I’m sort of new to this, I just wanted to ask: - Has a PEP for this already been written? If

Re: Shoulid constants be introduced to Python?

2017-11-17 Thread Karsten Hilbert
On Thu, Nov 16, 2017 at 05:35:59PM -0500, ROGER GRAYDON CHRISTMAN wrote: > Well, pi already does have a value: > import math math.pi > > 3.141592653589793 > > but it's not a constant in the sense you are looking for: And, it's not really a constant at all, it's only got a constant de