[issue46282] return value of builtins is not clearly indicated

2022-02-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy:  -rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-02-08 Thread Irit Katriel


Irit Katriel  added the comment:

I should have said "redundant information" rather than "obvious". 

I consider it redundant to specify that the default behavior applies to some 
specific case. If I read redundant information I may pause to think why it was 
necessary to explicitly state it, and whether I am misunderstanding something.

(Let's not make my bad choice of word turn this into a discussion about "what 
is obvious". The issue will probably never be closed if we do that.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-02-08 Thread Ned Batchelder


Ned Batchelder  added the comment:

What we're debating here is a micro-cosm of the broader "documentation 
philosophy" questions that I'm hoping the Documentation WG can iron out.  

What is "obvious"? Is it obvious that print returns None when file.write does 
not? Why does "exec" explicitly say it returns None, and no beginners were 
harmed, but having "print" say it returns None would be bad?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-02-07 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> New learners coming to Python don't know the same things
> as people with experience.

IMO, new learners will be worse off by adding "returns None" to all of the 
builtins.  At best it a distractor.

I work with new learners almost every day.  The issue never arises.  No one 
writes "x = print('hello world')" and they would be worse off if shown such a 
possibility.

One other consideration is that MyPy and the tools that use it (such as 
PyCharm) reject the idea of None as return value.  Their view is that no value 
is returned all.  We don't want the docs to contradict that world view.

  $ cat hello.py
  x = print('hello world')
  $ mypy hello.py
  hello.py:1: error: "print" does not return a value
  Found 1 error in 1 file (checked 1 source file)

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-02-07 Thread Ned Batchelder


Ned Batchelder  added the comment:

> When you state the obvious...

Obvious to who? New learners coming to Python don't know the same things as 
people with experience.

--
nosy: +nedbat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Steven, I am also inclined to close this.  What do you think after the 
discussion?  It is sometimes easier to clarify when we have a confused person 
present in the discussion.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-26 Thread Irit Katriel


Irit Katriel  added the comment:

> "have the :ref:`default return value  of ``None``."


This sounds to me like "by default they return None but you can override this 
default".

I don't think any change to the doc makes sense here. When you state the 
obvious people wonder what they're missing.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-25 Thread James Gerity


James Gerity  added the comment:

My thought was to add something like this to the top of functions.rst:

```
Note that some of the functions listed here have the :ref:`default return value 
 of ``None``.
```

For reference, the builtins this applies to are:

* breakpoint()
* delattr()
* exec()
* help()
* print()
* setattr()

Which makes me wonder if the hint is even worth having, since it's so few of 
them.

Note that of these, exec() does what this ticket originally proposed for 
print() - i.e. it explicitly says that the function returns None.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-25 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Please post your proposed change here to be discussed by participants here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-25 Thread James Gerity

James Gerity  added the comment:

> advertising that all functions default to returning None

This is already communicated in § 4.7 ("Defining Functions") of the official 
tutorial. 

I think it would be a good idea to revise that section so that this property of 
functions is a little more clear, but that isn't the scope of this ticket.

The title change reflects my intent to submit a PR that adds a hint to the 
builtins doc.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-25 Thread Éric Araujo

Éric Araujo  added the comment:

The new title is puzzling; the discussion moved to advertising that all 
functions default to returning None, this is not related to the built-in status.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46282] return value of builtins is not clearly indicated

2022-01-25 Thread James Gerity


Change by James Gerity :


--
title: print() docs do not indicate its return value -> return value of 
builtins is not clearly indicated

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com