[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-04 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, Joe Jevnik worked hard to squeeze every possible nanosecond out of these 
calls because they were frequently used.  Extending this API will tend to undo 
his efforts.

The original intent of itemgetter() was to provide a minimal alternative to 
writing a simple lambda -- it did not have the goal of being a parameterized 
way to express all possible calling patterns -- it just aspired to be good at 
the common cases.  In particular, itemgetter/attrgetter/methodcaller aimed at 
building key-functions for sorted/min/max/nlargest/nsmallest applied to a 
homogenous list of records.  In none of those cases would it have been common 
or normal to have a missing fields with meaningful default values.

Over the years, we've had various requests to extend the functionality in all 
kinds of exotic ways (i.e. multi-level gets like s[5][1][3] or Tcl-like 
keyed-list chains).  Some of those went far beyond the original scope, were 
non-harmonious with the current API, or ended-up needing more complex and 
complete solutions.

Most of the requests were rarely accompanied by meaningful use cases. For 
example, the referenced python-ideas post only included toy examples and its 
sole expressed motivation was a half thought-out notion of consistency with 
getattr().  The consistency argument doesn't make much sense because the 
itemgetter() and attrgetter() API had already gone down a different road. The 
getattr() function only looks-up one attribute, while the itemgetter() and 
attrgetter() callable factories do multiple lookups such as 
attrgetter(lastname, firstname) or itemgetter(3, 8, 2).  It isn't clear that a 
default argument would make sense for those cases, nor would it handle cases 
where only one field had a default value but the others did not (I expect this 
would likely be more common than having a meaningful default value for every 
field).  Also, since multiple positional arguments are allowed, the default 
parameter would have to be a keyword argument (which isn't parallel with 
getattr()).

IIRC, GvR at one time rejected a request for a list.get(index, default) method 
on the basis that it rarely made sense for indexed lookups; however, that seems 
very much like what is being proposed here for itemgetter().

Lastly, I'm concerned that every bit of extra functionality makes this API more 
complex (meaning harder to learn and remember) and makes it slower (undoing 
previous optimization efforts in order to speed-up its primary use cases for 
namedtuple() and as a key function).

Even now, these APIs have are complex enough to where very fewer developers 
even know what functionality is already provided.  Even Python experts won't 
immediately have correct interpretations for the likes of methodcaller('name', 
'foo', bar=1) or itemgetter(slice(2,None))('ABCDEFG').  In both cases (both of 
which are documented), the code would be better-off with a plain lambda or def. 
 ISTM that pushing the itemgetter/attrgetter/methodcaller API further would be 
a readability anti-pattern.

If this does go forward, I think we should look for some actual use cases in 
real code to help inform the decision of whether this would be an net win or 
whether it would result in code that wouldn't pass a code review.

--
assignee: rhettinger -> 

___
Python tracker 

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



[issue33427] Dead link in "The Python Standard Library" page

2018-05-04 Thread SilentGhost

SilentGhost  added the comment:

The language of that paragraph could be updated as well.

--
nosy: +SilentGhost
stage:  -> needs patch
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.7, Python 3.8

___
Python tracker 

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



[issue22276] pathlib glob ignores trailing slash in pattern

2018-05-04 Thread SilentGhost

Change by SilentGhost :


--
assignee:  -> emilyemorehouse
nosy: +brianmsheldon, emilyemorehouse
stage:  -> test needed
versions: +Python 3.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue22276] pathlib glob ignores trailing slash in pattern

2018-05-04 Thread SilentGhost

Change by SilentGhost :


--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue22276] pathlib glob ignores trailing slash in pattern

2018-05-04 Thread SilentGhost

Change by SilentGhost :


--
nosy: +robbuckley -brianmsheldon

___
Python tracker 

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



[issue33392] pathlib .glob('*/') returns files as well as directories

2018-05-04 Thread SilentGhost

Change by SilentGhost :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> pathlib glob ignores trailing slash in pattern

___
Python tracker 

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



[issue33426] Behavior of os.path.join does not match documentation

2018-05-04 Thread SilentGhost

SilentGhost  added the comment:

your example actually produces '/abc//def/'.

However, I'm not sure where do you get the idea that it should clean up 
internal directory separators or do anything at all with the strings in paths. 
To me it reads like it's concatenating arguments skipping over the empty ones 
unless it's also the last one. 

In any case, what would you propose to fix the language to describe the 
behaviour more clear?

--
nosy: +SilentGhost

___
Python tracker 

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



[issue33427] Dead link in "The Python Standard Library" page

2018-05-04 Thread MATSUURA, yosuke

New submission from MATSUURA, yosuke :

"The Python Standard Library" page 
(https://docs.python.org/3.6/library/index.html#the-python-standard-library) 
has a link to "Python Package Index" in the fourth paragraph
 but it linked to 404 URI(https://pypi.org/pypi/).
That link should be changed to a new URI(https://pypi.org/).

---
Fourth paragraph
"In addition to the standard library, there is a growing collection of several 
thousand components (from individual programs and modules to packages and 
entire application development frameworks), available from the ""Python Package 
Index""(This link is broken)."

--
assignee: docs@python
components: Documentation
messages: 316193
nosy: docs@python, lighthawk
priority: normal
severity: normal
status: open
title: Dead link in "The Python Standard Library" page
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue33392] pathlib .glob('*/') returns files as well as directories

2018-05-04 Thread Brian Sheldon

Brian Sheldon  added the comment:

This appears to be a duplicate of #22276

--
nosy: +brianmsheldon

___
Python tracker 

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



[issue33389] argparse redundant help string

2018-05-04 Thread paul j3

paul j3  added the comment:

Also

https://bugs.python.org/issue27303
[argparse] Unify options in help output

--

___
Python tracker 

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



[issue33389] argparse redundant help string

2018-05-04 Thread paul j3

paul j3  added the comment:

https://bugs.python.org/issue29626
Issue with spacing in argparse module while using help

This deals with a extra space that is produced when a blank metavar is used to 
produce a more compact help line

   -s , --service   help text

My answers have links to relevant SO questions.

--

___
Python tracker 

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



[issue33415] When add_mutually_exclusive_group is built without argument, the help breaks with "IndexError: list index out of range"

2018-05-04 Thread paul j3

paul j3  added the comment:

The usage formatter is brittle, especially the part that adds mutually 
exclusive markings to the normal usage string.  I don't think I've seen this 
error before, but I'm not surprised. 

A real fix requires a rewrite of the usage formatter, which I've suggested in 
an other bug/issue.  It would be a good idea to include this as a test case for 
such a patch.

The simplest immediate fix is to just not use a mutually exclusive group when 
it isn't needed.  I don't think it's urgent enough to require a special patch.

---

start = actions.index(group._group_actions[0])

group is the mutually exclusive group that's being formatted.  _group_actions 
is is list of Actions.  The developer expected that the group would be 
populated (normally by 2 or more Actions), and didn't think it necessary to 
first check if it was empty.  That's a reasonable assumption.

--
nosy: +paul.j3

___
Python tracker 

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



[issue33389] argparse redundant help string

2018-05-04 Thread paul j3

paul j3  added the comment:

This is normal behavior for argparse.

People have asked before for a more compact display.  I remember suggesting 
changes to the HelpFormatter subclass on Stackoverflow questions, and there's 
probably one or more bug/issues addressing the same issue.

--
nosy: +paul.j3

___
Python tracker 

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



[issue33400] logging.Formatter does not default to ISO8601 date format

2018-05-04 Thread Vinay Sajip

Vinay Sajip  added the comment:


New changeset eb5abdc70815c4207829551ede4a7dc302d56c19 by Vinay Sajip (Miss 
Islington (bot)) in branch '3.6':
bpo-33400: Clarified documentation to indicate no strict adherence to ISO 8601. 
(GH-6703)
https://github.com/python/cpython/commit/eb5abdc70815c4207829551ede4a7dc302d56c19


--

___
Python tracker 

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



[issue33417] Isinstance() behavior is not consistent with the document

2018-05-04 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

https://docs.python.org/3/reference/datamodel.html#customizing-instance-and-subclass-checks
says
"Note that these methods are looked up on the type (metaclass) of a class. They 
cannot be defined as class methods in the actual class. This is consistent with 
the lookup of special methods that are called on instances, only in this case 
the instance is itself a class."

IE, your first example is documented as wrong.  Your second example, which 
works, follows the example in
https://docs.python.org/3/reference/datamodel.html#customizing-instance-and-subclass-checks

--
nosy: +terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +Python 3.8

___
Python tracker 

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



[issue33400] logging.Formatter does not default to ISO8601 date format

2018-05-04 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6396

___
Python tracker 

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



[issue33400] logging.Formatter does not default to ISO8601 date format

2018-05-04 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6395

___
Python tracker 

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



[issue33400] logging.Formatter does not default to ISO8601 date format

2018-05-04 Thread Vinay Sajip

Vinay Sajip  added the comment:


New changeset c4994dc00d9828a99510f3851da93b0e1c18361d by Vinay Sajip in branch 
'master':
bpo-33400: Clarified documentation to indicate no strict adherence to ISO 8601. 
(GH-6702)
https://github.com/python/cpython/commit/c4994dc00d9828a99510f3851da93b0e1c18361d


--

___
Python tracker 

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



[issue33394] the build of the shared modules is quiet/non-visible when GNU make gets passed macros

2018-05-04 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue33420] [typing] __origin__ invariant broken

2018-05-04 Thread Brett Cannon

Change by Brett Cannon :


--
title: __origin__ invariant broken -> [typing] __origin__ invariant broken

___
Python tracker 

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



[issue33400] logging.Formatter does not default to ISO8601 date format

2018-05-04 Thread Vinay Sajip

Change by Vinay Sajip :


--
keywords: +patch
pull_requests: +6394
stage:  -> patch review

___
Python tracker 

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



[issue33426] Behavior of os.path.join does not match documentation

2018-05-04 Thread Michael Klatt

New submission from Michael Klatt :

The behavior of os.path.join() regarding path separators does not match the 
documentation. This affects Python 3.6, and goes back to at least Python 2.7.

>From the documenation: 

"The return value is the concatenation of path and any members of *paths with 
exactly one directory separator (os.sep) following each non-empty part except 
the last, meaning that the result will only end in a separator if the last part 
is empty."

To me, this means that join will remove extraneous separators from the path, 
and that the only way to produce a trailing separator is to use join "" as the 
final path segment.

I expect `os.path.join("/abc//", "def/")` to produce the string "/abc/def" 
based on the documentation, but what it actually produces is "abc//def/".

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 316184
nosy: Michael Klatt, docs@python
priority: normal
severity: normal
status: open
title: Behavior of os.path.join does not match documentation
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue33384] Build does not work with closed stdin

2018-05-04 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

I cannot reproduce the problem with Python 3.6.5, building pyephem and with the 
command:

( sleep 15; python  setup.py  build ) >foo.log 2>&1

--
nosy: +xdegaye

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Andrés Delfino

Andrés Delfino  added the comment:

I have updated the PR. Now symbols show:

Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

!=  +   <=  __
"   +=  <>  `
""" ,   ==  b"
%   -   >   b'
%=  -=  >=  f"
&   .   >>  f'
&=  ... >>= j
'   /   @   r"
''' //  J   r'
(   //= [   u"
)   /=  \   u'
*   :   ]   |
**  <   ^   |=
**= <<  ^=  ~
*=  <<= _   

I don't understand how topics.py gets autogenerated by Sphinx (by te way, it 
says it was generated on January 2018), so I'm having trouble with using a more 
specific topic for f'.

--

___
Python tracker 

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



[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-04 Thread Guido van Rossum

Guido van Rossum  added the comment:

I think represents a legitimate use case. There's another request for this on 
python-ideas: 
https://groups.google.com/d/msg/python-ideas/0jeftqQpm9c/yZ_uKO84BAAJ

--
nosy: +gvanrossum
resolution: later -> 
status: closed -> open

___
Python tracker 

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



[issue33389] argparse redundant help string

2018-05-04 Thread Jakub Wilk

Jakub Wilk  added the comment:

GNU programs seem to use this format:

   $ ls --help | grep ',.*=[A-Z]'
 -I, --ignore=PATTERN   do not list implied entries matching shell 
PATTERN
 -T, --tabsize=COLS assume tab stops at each COLS instead of 8
 -w, --width=COLS   set output width to COLS.  0 means no limit

The argparse format is more accurate, but also less practical, especially for 
long variable names.

--

___
Python tracker 

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



[issue33389] argparse redundant help string

2018-05-04 Thread Jakub Wilk

Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Option 2 LGTM.

--

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Andrés Delfino

Andrés Delfino  added the comment:

And what should symbols show in pydoc?

Should symbols show:

1. All legal combinations with ("'", '"') (48 possible combinations)
2. Only b/f/r/u with ("'", '"') (IMHO, this is the most reasonable option) 
3. Only b/f/r/u with ' or "

Depending on that, we can choose one of the options you mentioned.

--

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't think we need to support prefixes without quotes or with triple qoutes. 
'ur' is not valid prefix. Using simplified code from tokenize:

_strprefixes = [''.join(u) + q
for t in ('b', 'r', 'u', 'f', 'br', 'rb', 'fr', 'rf')
for u in itertools.product(*[(c, c.upper()) for c in t])
for q in ("'", '"')]

Or you can use tokenize._all_string_prefixes() directly:

_strprefixes = [p + q
for p in tokenize._all_string_prefixes()
for q in ("'", '"')]

But it may be simple to just convert the string to lower case before looking up 
in the symbols dict. Then

_strprefixes = [p + q
for p in ('b', 'r', 'u', 'f', 'br', 'rb', 'fr', 'rf')
for q in ("'", '"')]

--

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Andrés Delfino

Andrés Delfino  added the comment:

To get the 144 combinations I used the logic in tokenize.py:

import re

def _combinations(*l):
return set(
x + y for x in l for y in l + ("",) if x.casefold() != y.casefold()
)

_strprefixes = (
_combinations('r', 'R', 'f', 'F') | _combinations('r', 'R', 'b', 'B') | 
{'u', 'U', 'ur', 'uR', 'Ur', 'UR'}
)

triple_quoted = (
{"'''", '"""'} | {f"{prefix}'''" for prefix in _strprefixes} | 
{f'{prefix}"""' for prefix in _strprefixes}
)
single_quoted = (
{"'", '"'} | {f"{prefix}'" for prefix in _strprefixes} | {f'{prefix}"' for 
prefix in _strprefixes}
)

all_combinations = _strprefixes | single_quoted | triple_quoted

print(' '.join(list(all_combinations)))

print(len(all_combinations))

--

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Andrés Delfino

Andrés Delfino  added the comment:

Eric, I entered "r'" in the interactive prompt.

Serhiy, using the code in tokenize, I got a total of 144 combinations. For 
comparison, the list of symbols help() shows, after the proposed change, has 67 
items.

IMHO, we should compromise. Maybe just mentioning the letters? With no quoting 
character. I do know that this can be confusing, since J is shown as a letter 
but it's used as a suffix unlike b/f/r/u...

What do you think?

--

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Yes, but we're not losing anything by being overly cautious.

--

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

+if (sigemptyset() || sigfillset()) {

I'm not sure that sigemptyset() is needed.

sigfillset() manual page:

   sigfillset() initializes set to full, including all signals.

The function is used to *initialize* a set.

--

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This is expected, see issue33329.

--

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

On Ubuntu 14.04, I get the same results as Victor.

--
nosy: +csabella

___
Python tracker 

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



[issue5430] imaplib: must not replace LF or CR by CRLF in literals

2018-05-04 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I'm not sure if this is a 2.6/2.7 only issue because the code mentioned in 
msg86572 still exists, although with a change for #21800 (RFC 6855/UTF-8) 
applied.

For reference, #25591 expanded the test coverage for the imaplib.  However, I 
don't see any tests related to CR or LF in literals.

--
nosy: +csabella

___
Python tracker 

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



[issue26256] Fast decimalisation and conversion to other bases

2018-05-04 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

ping

--

___
Python tracker 

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



[issue6270] Menu deletecommand fails if command is already deleted

2018-05-04 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I installed the latest version of pmw on Ubuntu 14.04 and did not receive any 
errors using the supplied test snippet.  It appears that pmw added a patch to 
the code to only delete the commands when used with Python versions before 
2.5.4 so that this bug would not be triggered.

This could be revisited if someone else runs into an issue with deletecommand, 
but closing for now as out of date.

--
nosy: +csabella
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-04 Thread Neil Girdhar

Neil Girdhar  added the comment:

I'm not sure that this should be in the stdlib. The three-line function can be 
enough for your simple case, and it is too simple for including it in the 
stdlib. But for general stdlib quality solution it lacks many details.

1. It doesn't work with classes that implement the constructor as __new__, but 
not __init__. It may need of using metaclasses with overridden __call__. But 
how then handle classes with custom metaclasses?

Can you illustrate how you would do it for these kinds of classes?

Anyway, I think using __new__ on user classes is extremely rare.

2. inspect.signature() doesn't give the correct signature as for partial(). 
This requires changing the inspect module.

Good point.  I can look into this.

3. pickling and copying of instances are broken in many cases. Pickling a class 
is always broken. I afraid that this can't be solved without significant 
reworking of the pickle and the copy modules.

Okay, interesting, but this doesn't seem relevant to partialclass.

4. It adds instance attributes __dict__ and __weakref__ even if they were 
disabled by using __slots__. This increases the size of instances and breaks 
some properties.

Can we just copy the parent class' __slots__ to the partialclass return value?

5. repr() of the class doesn't show that it is a partialclass (unlike to the 
result of partial()).

I will fix this.

6. Many alternate constructors and copying methods are broken. For example the 
copy() method of partialclass(defaultdict, list) in your example. There is no 
general solution of this, it should be solved individually for every class.

Ultimately, if pickling works, then copying should work too.  The usual way I 
do it is implementing __getnewargs__, etc.   This should work fine?

> If there is a need of this feature in the stdlib, it needs changing many 
> parts of the stdlib. And the result will still need an additional work for 
> every concrete class.

Fair enough.

> Also note that the term "partial class" has different well known meaning in 
> some other programming languages: 
> https://en.wikipedia.org/wiki/Class_(computer_programming)#Partial .

Interesting.  Similarly "partial function" means something else.  That's why I 
changed the documentation to use the terms: "partial class application", 
"partial function application", and "partial method application".  All of these 
are "partial applications": https://en.wikipedia.org/wiki/Partial_application .

Should we discuss this on github?

--

___
Python tracker 

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



[issue33425] Library glob : Can't find a specific year with glob

2018-05-04 Thread Robin Champavier

Change by Robin Champavier :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

FYI on Fedora 27, I get:

>>> signal.NSIG
65
>>> set(range(0, signal.NSIG)) - signal.valid_signals()
{0, 33, 32}
>>> len(signal.valid_signals())
62
>>> min(signal.valid_signals())

>>> max(signal.valid_signals())


So signals 0, 32 and 33 are invalid, the first valid signal is 1 and the last 
is 64.

--
nosy: +vstinner

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 9d3627e311211a1b4abcda29c36fe4afe2c46532 by Antoine Pitrou in 
branch 'master':
bpo-2: Add signal.valid_signals() (GH-6581)
https://github.com/python/cpython/commit/9d3627e311211a1b4abcda29c36fe4afe2c46532


--

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Eric V. Smith

Eric V. Smith  added the comment:

It's not clear to me what you're typing to get the output in the first message. 
Can you clarify? Is this at the interactive prompt?

--

___
Python tracker 

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



[issue33425] Library glob : Can't find a specific year with glob

2018-05-04 Thread Robin Champavier

New submission from Robin Champavier :

Hello,

I work with file name like : PRECI_mmddhh_00.txt and I put them in 
different directory depending of the year. For file between year 1999 and 2016 
there is no problem but with file in year 2017 with months 12, glob.glob can't 
find them. When I do print K in my file Tri_fichier_texte.py there is no file 
with PRECI_201712.txt but it works to find the beginning of the year 2017 
like PRECI_201701xxx.txt. All file get exactly the same syntax. 

Thanks for looking my issues.

--
components: Library (Lib)
files: Tri_fichier_texte.py
messages: 316163
nosy: Robin Champavier
priority: normal
severity: normal
status: open
title: Library glob : Can't find a specific year with glob
versions: Python 2.7
Added file: https://bugs.python.org/file47571/Tri_fichier_texte.py

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Interesting, I didn't know that pydoc supports this.

Specifying all possible prefixes is cumbersome and errorprone. The number of 
combinations grows exponentially with adding new letters. I suggest either to 
specify only lower-case variants and generate all variants with upper-case 
letters (as it done in the tokenize module) or always calls the lower() method 
when look up in the symbols dictionary.

It may be worth to add a special topic for f-strings.

--
nosy: +eric.smith, serhiy.storchaka

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm not sure that this should be in the stdlib. The three-line function can be 
enough for your simple case, and it is too simple for including it in the 
stdlib. But for general stdlib quality solution it lacks many details.

1. It doesn't work with classes that implement the constructor as __new__, but 
not __init__. It may need of using metaclasses with overridden __call__. But 
how then handle classes with custom metaclasses?

2. inspect.signature() doesn't give the correct signature as for partial(). 
This requires changing the inspect module.

3. pickling and copying of instances are broken in many cases. Pickling a class 
is always broken. I afraid that this can't be solved without significant 
reworking of the pickle and the copy modules.

4. It adds instance attributes __dict__ and __weakref__ even if they were 
disabled by using __slots__. This increases the size of instances and breaks 
some properties.

5. repr() of the class doesn't show that it is a partialclass (unlike to the 
result of partial()).

6. Many alternate constructors and copying methods are broken. For example the 
copy() method of partialclass(defaultdict, list) in your example. There is no 
general solution of this, it should be solved individually for every class.

If there is a need of this feature in the stdlib, it needs changing many parts 
of the stdlib. And the result will still need an additional work for every 
concrete class.

Also note that the term "partial class" has different well known meaning in 
some other programming languages: 
https://en.wikipedia.org/wiki/Class_(computer_programming)#Partial .

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33424] 4.4. break and continue Statements, and else Clauses on Loops

2018-05-04 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Joe, we have no idea what you think is the bug.

It is intentional that the second argument for range is excluded. This is 
called an "half-open" range, and it helps avoid off-by-one and signpost errors.

Your comments about break, continue and else don't seem to actually mean 
anything. Please write in complete English sentences and explain the nature of 
the supposed bug.

--
nosy: +steven.daprano

___
Python tracker 

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