Consider not using single char variables in docs
See original GitHub issueSummary.
I was debugging a requests example from the website here (http://docs.python-requests.org/en/master/) and was in a PDB session. Went to inspect “r” by typing “r” and <enter> it did not reference the variable “r”.
What you expected.
I expected that it would return the object R
What happened instead.
It returned to the next method, because PDB uses hotkeys.
import requests
r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
import pdb; pdb.set_trace()
Then type ‘r’ in PDB session, will return instead of instance of ‘r’.
Suggestion.
Update the docs to not use single-char variables. I would have sent a PR, but wanted to start here, as it’s more emergent behavior of using PDB and single char vars then a direct requests issue, but is reflected in your examples.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
SPLIT function - Google Docs Editors Help
Divides text around a specified character or string, and puts each fragment into a separate cell in the row.
Read more >Documentation: 15: 8.3. Character Types - PostgreSQL
Table 8.4 shows the general-purpose character types available in PostgreSQL. SQL defines two primary character types: character varying( n ) and character( ...
Read more >char and varchar (Transact-SQL) - SQL Server - Microsoft Learn
Character data types that are either fixed-size (char), or variable-size (varchar).
Read more >11.3.2 The CHAR and VARCHAR Types
The following table illustrates the differences between CHAR and VARCHAR by showing the result of storing various string values into CHAR(4) and VARCHAR(4) ......
Read more >Variable names - Survey Solutions | Documentation
No other characters are permitted in the variable name. Specifically, spaces are not permitted in the variable names, as variable name must be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @claudijd, thanks for starting the conversation. While we want to make sure the documentation is easily accessible, I’m not sure this warrants a change. PDB has specifically added syntax to handle this issue. Whenever you’re printing a variable in the console, you should be prefixing it with an ! (e.g. !r) to avoid conflicts.
Given that we cannot control how other tools behave, the new variable could fail elsewhere and we’ll have to continue changing it. For those reasons, I think we’ll pass on this.
@claudijd no it shouldn’t. The examples are (mostly) shown as if you’ve opened a python prompt, e.g.,
Not PDB