[issue46282] print() docs do not indicate its return value

James Gerity report at bugs.python.org
Thu Jan 6 12:26:35 EST 2022


James Gerity <snoop.jedi at gmail.com> added the comment:

The original question was closer to the related issue of "indicate return types for all built-ins," conversation log follows (UTC-5):

```
09:33:50         ringo__ | is there a stdlib api docs which actually has *full* functions signature?                                                                                                       
09:34:27         ringo__ | for example, https://docs.python.org/3/library/functions.html, function                                                                                                         
                         | abs(x), it returns what, int? I need to read the whole sentence to figure                                                                                                       
                         | out the return value of a function?                                                                                                                                             
09:34:48         ringo__ | (or argument for that matter)                                                                                                                                                   
09:35:51             bjs | ringo__: well like it says it doesn't just support int                                                                                                                          
09:36:00             bjs | int, float, or any type that supports it                                                                                                                                        
09:37:01             bjs | in general you can find actual type annotations for the functions in the                                                                                                        
                         | typeshed                                                                                                                                                                        
                         | https://github.com/python/typeshed/blob/master/stdlib/builtins.pyi                                                                                                              
09:37:32             bjs | I wonder if it would be useful to include the typeshed annotation in the                                                                                                        
                         | docs, or whether it would be more confusing                                                                                                                                     
09:37:49         ringo__ | Thanks bjs ! I'll bookmark this typeshed                                                                                                                                        
09:38:13          SnoopJ | abs() will do whatever __abs__() on the type does, which can be different                                                                                                       
                         | for any given type. You'd expect T -> T but it's not guaranteed.                                                                                                                
09:38:18         ringo__ | I used abs() as an example. In fact I was wondering what does print()                                                                                                           
                         | return. I *guessed* it returns None, but the docs won't say                                                                                                                     
09:39:05         ringo__ | I could do a try-it-yourself approach but I was puzzled why the docs                                                                                                            
                         | simply won't give you full fn signature, ie print(..) -> None                                                                                                                   
09:39:17          SnoopJ | that one is just an omission :)
```

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46282>
_______________________________________


More information about the Python-bugs-list mailing list