Re: The slash "/" as used in the documentation

2019-02-10 Thread Terry Reedy
On 2/10/2019 11:32 PM, Ian Kelly wrote: On Sun, Feb 10, 2019 at 9:34 AM Chris Angelico wrote: Do you ACTUALLY want to call math.sin(x=1.234) or is it purely for the sake of consistency? Aside from questions about the help format, what is actually lost by the inability to pass those arguments

Re: The slash "/" as used in the documentation

2019-02-10 Thread Ian Kelly
On Mon, Feb 11, 2019 at 12:19 AM Terry Reedy wrote: > The pass-by-position limitation is not in CPython, it is the behavior of > C functions, which is the behavior of function calls in probably every > assembly and machine language. Allowing the flexibility of Python > function calls take extra c

Re: The use of type()

2019-02-10 Thread ^Bart
a = 5 print(a.__class__.__name__) int b = 5.0 print(b.__class__.__name__) float Thank you very much! :) ^Bart -- https://mail.python.org/mailman/listinfo/python-list

Re: The slash "/" as used in the documentation

2019-02-10 Thread Terry Reedy
On 2/10/2019 10:47 AM, Ian Kelly wrote: On Sat, Feb 9, 2019 at 1:19 PM Terry Reedy wrote: This is the result of Python being a project of mostly unpaid volunteers. See my response in this thread explaining how '/' appears in help output and IDLE calltips. '/' only appears for CPython C-coded

Re: The slash "/" as used in the documentation

2019-02-10 Thread Ian Kelly
On Sun, Feb 10, 2019 at 2:18 PM Avi Gross wrote: > I am not sure how python implements some of the functionality it does as > compared to other languages with similar features. But I note that there are > rules, presumably some for efficiency, such as requiring all keyword > arguments to be placed

Re: The slash "/" as used in the documentation

2019-02-10 Thread Ian Kelly
On Sun, Feb 10, 2019 at 9:34 AM Chris Angelico wrote: > > On Mon, Feb 11, 2019 at 2:49 AM Ian Kelly wrote: > > > > On Sat, Feb 9, 2019 at 1:19 PM Terry Reedy wrote: > > > > > > This is the result of Python being a project of mostly unpaid volunteers. > > > > > > See my response in this thread ex

RE: The use of type()

2019-02-10 Thread Avi Gross
Follow on to below. I was right and there is a fairly trivial and portable way to just show 'int' for the type of probably many types: No need to call the type() function at all. If "a" is an integer object containing "5" then you can ask for the class of it and then within that for the name like

RE: The use of type()

2019-02-10 Thread Avi Gross
Without using regular expressions, if you just want to extract the word "int" or "float" you can substring the results by converting what type says to a string: >>> a = 5 >>> str(type(a))[8:11] 'int' >>> a=5.0 >>> str(type(a))[8:13] 'float' Since the format and length vary, this may not meet you

Re: The use of type()

2019-02-10 Thread Chris Angelico
On Mon, Feb 11, 2019 at 8:46 AM ^Bart wrote: > > I need to print something like "this variable is int" or "this variable > is string" > > n1 = 10 > n2 = 23 > > print ("Total of n1+n2 is: ",n1+n2," the type is", type(n1+n2)) > > When I run it I have: > > Total of n1+n2 is: 33 the type is > >>>

The use of type()

2019-02-10 Thread ^Bart
I need to print something like "this variable is int" or "this variable is string" n1 = 10 n2 = 23 print ("Total of n1+n2 is: ",n1+n2," the type is", type(n1+n2)) When I run it I have: Total of n1+n2 is: 33 the type is >>> I'd like to read "the type is int" and NOT "the type is , how cou

RE: Im trying to replicate the youtube video Creating my own customized celebrities with AI.

2019-02-10 Thread Avi Gross
Bob, >> tenserflow, pygame, scipy, and numby > All of these are probably installable using pip. By the way did you mean numpy? > At a command prompt type pip install packagename. While you are correcting the spelling of downloads as the downloader is quite picky about exact spelling, please men

RE: The slash "/" as used in the documentation

2019-02-10 Thread Avi Gross
Chris, I would appreciate another pointer to the documentation explaining what was done and why as I deleted the earlier discussion. You ask: > Aside from questions about the help format, what is actually lost by the inability > to pass those arguments by name? I am not sure how python impleme

Re: Im trying to replicate the youtube video Creating my own customized celebrities with AI.

2019-02-10 Thread Bob Gailer
On Feb 10, 2019 11:40 AM, wrote: > > The video I don't see any video here. If you attached one the attachment did not come through. > gives the source code and the necessary things to download with it. But I'm new to python and don't understand how to install any of the files. The files includ

Re: where is math_sin defined?

2019-02-10 Thread Chris Angelico
On Mon, Feb 11, 2019 at 3:37 AM Barry Scott wrote: > > On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: > > As an aside, how is 'math.sin' actually implemented? mathmodule.c > > refers to the function 'math_sin' but that name is not defined > > anywhere in the Python source code. I'm a

Im trying to replicate the youtube video Creating my own customized celebrities with AI.

2019-02-10 Thread jadenfigger
The video gives the source code and the necessary things to download with it. But I'm new to python and don't understand how to install any of the files. The files include: Python 3, pip, tenserflow, pygame, scipy, and numby. Could anyone help me install all of this to run the AI. Thank you --

Re: where is math_sin defined?

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: > As an aside, how is 'math.sin' actually implemented? mathmodule.c > refers to the function 'math_sin' but that name is not defined > anywhere in the Python source code. I'm a bit mystified as to how > CPython manages to compile! I used

Re: The slash "/" as used in the documentation

2019-02-10 Thread Chris Angelico
On Mon, Feb 11, 2019 at 2:49 AM Ian Kelly wrote: > > On Sat, Feb 9, 2019 at 1:19 PM Terry Reedy wrote: > > > > This is the result of Python being a project of mostly unpaid volunteers. > > > > See my response in this thread explaining how '/' appears in help output > > and IDLE calltips. '/' onl

Re: C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 13:58:57 GMT Stefan Behnel wrote: > Barry Scott schrieb am 10.02.19 um 13:08: > > After calling PyObject_GetAttrString() I expected to get a PyObject string > > back but I found that I had been given a instead. > > > > (gdb) p *args_o > > $4 = > > > > What is going o

Re: [solved] C API version of str(exception) is not the same as pure python version

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 11:59:16 GMT Barry Scott wrote: > When I use the C API to get the str() of an execption I see this text: > > > > But python reports the following for the same exception: > > TypeError: unsupported operand type(s) for +: 'int' and 'str' > > What do I need

Re: print console out to a txt or csv file

2019-02-10 Thread Peter Otten
GISDude wrote: > Hi all, > I have been working on some code to list the files of a folder that has > .pdf extension. I have the basic code to create a list, but it prints that > list to the console. I'd like my code to write a txt file that contains > that list (to later import into excel). > > #

Re: The slash "/" as used in the documentation

2019-02-10 Thread Jon Ribbens
On 2019-02-10, Chris Angelico wrote: > On Mon, Feb 11, 2019 at 2:21 AM Jon Ribbens wrote: >> On 2019-02-09, Terry Reedy wrote: >> > '/' is no uglier than, and directly analogous to, and as easy to produce >> > and comprehend, as '*'. It was selected after considerable discussion >> > of how to

Fwd: improve TypeError for AsyncIterables when attempting to sync iterate

2019-02-10 Thread Thomas Grainger
Currently when attempting to sync iterate an async iterable you get a TypeError: TypeError: 'SomeType' object is not iterable When attempting to iterate an async iterable (eg an object with a __aiter__ method the error could be something like: TypeError: 'SomeType' object is not iterable, it is

Re: The slash "/" as used in the documentation

2019-02-10 Thread Ian Kelly
On Sat, Feb 9, 2019 at 1:19 PM Terry Reedy wrote: > > This is the result of Python being a project of mostly unpaid volunteers. > > See my response in this thread explaining how '/' appears in help output > and IDLE calltips. '/' only appears for CPython C-coded functions that > have been modifie

Re: The slash "/" as used in the documentation

2019-02-10 Thread Chris Angelico
On Mon, Feb 11, 2019 at 2:21 AM Jon Ribbens wrote: > > On 2019-02-09, Terry Reedy wrote: > > '/' is no uglier than, and directly analogous to, and as easy to produce > > and comprehend, as '*'. It was selected after considerable discussion > > of how to indicate that certain parameters are, at l

Re: The slash "/" as used in the documentation

2019-02-10 Thread Jon Ribbens
On 2019-02-09, Terry Reedy wrote: > '/' is no uglier than, and directly analogous to, and as easy to produce > and comprehend, as '*'. It was selected after considerable discussion > of how to indicate that certain parameters are, at least in CPython, > positional only. The discussion of opti

print console out to a txt or csv file

2019-02-10 Thread GISDude
Hi all, I have been working on some code to list the files of a folder that has .pdf extension. I have the basic code to create a list, but it prints that list to the console. I'd like my code to write a txt file that contains that list (to later import into excel). ###A script to list pdf file

Re: C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Stefan Behnel
Barry Scott schrieb am 10.02.19 um 13:08: > After calling PyObject_GetAttrString() I expected to get a PyObject string > back but I found that I had been given a instead. > > (gdb) p *args_o > $4 = > > What is going on and how do I get from the to the object > I > want? Phil is right abou

Re: C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Phil Thompson
On 10 Feb 2019, at 12:08 pm, Barry Scott wrote: > > After calling PyObject_GetAttrString() I expected to get a PyObject string > back but I found that I had been given a instead. > > (gdb) p *args_o > $4 = > > What is going on and how do I get from the to the object > I > want? The "Str

C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Barry Scott
After calling PyObject_GetAttrString() I expected to get a PyObject string back but I found that I had been given a instead. (gdb) p *args_o $4 = What is going on and how do I get from the to the object I want? Barry -- https://mail.python.org/mailman/listinfo/python-list

C API version of str(exception) is not the same as pure python version

2019-02-10 Thread Barry Scott
When I use the C API to get the str() of an execption I see this text: But python reports the following for the same exception: TypeError: unsupported operand type(s) for +: 'int' and 'str' What do I need to do in the C API to get the the same text for the exception? All the c