[issue43525] pathlib: Highlight pathlib operator behavior with anchored paths

2021-03-16 Thread diegoe


Change by diegoe :


--
title: pathlib: Highlight operator behavior with anchored paths -> pathlib: 
Highlight pathlib operator behavior with anchored paths

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



[issue43525] pathlib: Highlight operator behavior with anchored paths

2021-03-16 Thread diegoe


Change by diegoe :


--
keywords: +patch
pull_requests: +23664
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24900

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



[issue43525] pathlib: Highlight operator behavior with anchored paths

2021-03-16 Thread diegoe


New submission from diegoe :

In the '/' operator documentation for `pathlib`, the behavior for anchored 
paths is not described:

https://docs.python.org/3/library/pathlib.html#operators

The behavior (prefer the second/right-hand root/anchor) is only explained in 
the `PurePath` class:

https://docs.python.org/3/library/pathlib.html#pathlib.PurePath

I ran into this while helping migrate a code base that was using "naive" 
concatenation of strings, so this:

```
PROJECT_DIR = ROOT_DIR + "/project-name"
```

was migrated to:
```
PROJECT_DIR = ROOT_DIR / "/project-name"
```

Note that, of course, we missed the leading "/".

Although the docs _do_ describe the behavior somewhere else, I believe it's 
worth being redundant in the operator section.

I believe it's a reasonable mistake to warn new users against, specially since 
"naive" concatenation is a common "ugly" pattern that many would be migrating 
from. Plus, a leading "/" is easy to miss, which would only compound the 
confusion if you are seeing your path "omit the (left-hand) Path object" 
(because the anchored string took precedence).

------
assignee: docs@python
components: Documentation
messages: 388904
nosy: diegoe, docs@python
priority: normal
severity: normal
status: open
title: pathlib: Highlight operator behavior with anchored paths
versions: Python 3.9

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



[issue43082] descriptor howto: typo in "Definition and introduction"

2021-01-31 Thread diegoe


Change by diegoe :


--
keywords: +patch
pull_requests: +23208
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24394

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



[issue43082] descriptor howto: typo in "Definition and introduction"

2021-01-30 Thread diegoe


New submission from diegoe :

In
  https://docs.python.org/3.10/howto/descriptor.html#definition-and-introduction

The paragraph reads:
"""
Definition and introduction

In general, a descriptor is an attribute value that has one of the methods in 
the descriptor protocol. Those methods are __get__(), __set__(), and 
__delete__(). If any of those methods are defined for an the attribute, it is 
said to be a descriptor.
"""

I believe it should be either "an attribute" or "the attribute" in the last 
sentence. Probably missed it because both options would read fine.

--
assignee: docs@python
components: Documentation
messages: 386011
nosy: diegoe, docs@python
priority: normal
severity: normal
status: open
title: descriptor howto: typo in "Definition and introduction"
type: enhancement
versions: Python 3.10

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