[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

I guess the technically correct term is positional-or-keyword, but that seems 
like too much: https://docs.python.org/3/glossary.html

I think dropping "positional" doesn't increase the precision of the error 
message, but I'll admit I can't think of anything better. And lacking something 
better I don't think we should change this.

--
nosy: +eric.smith

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

Given this current behavior:

>>> def foo(a, /, b): pass
...
>>> foo()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: foo() missing 2 required positional arguments: 'a' and 'b'

What would you suggest?

I agree the current messages aren't perfect.

--

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



[issue46683] Python 3.6.15 source tarball installs 3.6.8?

2022-02-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Where did you get the tarball?

--
nosy: +eric.smith

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



[issue46683] Python 3.6.15 source tarball installs 3.6.8?

2022-02-08 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> not a bug
status: open -> closed

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



[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith


New submission from Eric V. Smith :

You need to provide more information.

Is your concern that re.match objects aren't matched like dicts are, despite 
looking like a mapping?

import re

def f(map):
print(f'input={m["one"]} {m["two"]}')
match map:
case {'one': x, 'two': y}:
print(f"match {x} {y}")
case _:
print("no match")

m = re.match("(?Pa)b(?Pc)", "abc")
d = {'one':0, 'two':1}
f(d)
f(m)

produces:
input=a c
match 0 1
input=a c
no match

I assume you're not reporting a bug, so I'm going to mark this as a feature 
request.

--
nosy: +eric.smith
type: behavior -> enhancement
versions:  -Python 3.10

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



[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith


Change by Eric V. Smith :


--
components: +Interpreter Core

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



[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Oops, slight bug in my code. Use this:

import re

def f(map):
print(f'input={map["one"]} {map["two"]}')
match map:
case {'one': x, 'two': y}:
print(f"match {x} {y}")
case _:
print("no match")

d = {'one':0, 'two':1}
f(d)
m = re.match("(?Pa)b(?Pc)", "abc")
f(m)

With this output:
input=0 1
match 0 1
input=a c
no match

--

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



[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Looking at PEP 634, the obvious way to add support for this is to have the 
re.Match object specify Py_TPFLAGS_MAPPING. But I tried that, and then I get 
this error when using an re.Match object in a match statement:

case {'one': x, 'two': y}:
 
TypeError: object of type 're.Match' has no len()


Add len() to re.Match objects was rejected when __getitem__ was added to 
re.Match, in issue 24454.

I haven't explored other ways to support re.Match objects in the match 
statement.

--

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



[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Good catch, @xtreak. I think something like the discussed (but not implemented) 
custom matching protocol would be required here. __match_args__ won't work, 
because it's a special attribute only checked on classes, not instances.

Of course, I'm still not sure this is what the original poster is requesting!

But assuming so, this would require a PEP, and should be discussed with the PEP 
634 authors.

--

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



[issue46693] dataclass generated __str__ does not use overridden member __str__

2022-02-09 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

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



[issue46693] dataclass generated __str__ does not use overridden member __str__

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

I believe dataclasses uses repr() of the members, not str(). Can you try using 
specifying __repr__ in Teacup? Just __repr__ = __str__ should work.

--
nosy: +eric.smith

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



[issue43532] Add keyword-only fields to dataclasses

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks, Henry Schreiner!

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

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



[issue46693] dataclass generated __str__ does not use overridden member __str__

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'll close it.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue46701] cannot use typographical quotation marks in bug description

2022-02-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Please report bug tracker bugs at https://github.com/python/bugs.python.org

Although to be honest I doubt this will be fixed, since we're moving to Github 
issues.

--
nosy: +eric.smith
resolution:  -> third party
stage:  -> resolved
status: open -> closed

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



[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree with Mark. It's identical to:

>>> () == ()
True

As for the non-dataclass version, that's a normal object identity comparison if 
no __eq__ is defined: 
https://docs.python.org/3/reference/datamodel.html#object.__eq__ , third 
paragraph.

--

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



[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

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



[issue46735] gettext.translations crashes when locale is unset

2022-02-13 Thread Eric V. Smith


Change by Eric V. Smith :


--
components: +Library (Lib) -Parser
type: crash -> behavior

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



[issue46751] Windows-style path is not recognized under cygwin

2022-02-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Are you running from bash (or another cygwin shell), or from cmd.exe, or 
something else?

How did you install the version of python you're executing in the examples you 
provided? To my knowledge, cygwin's installer doesn't have a 3.9 available.

I don't see this behavior on cygwin's python3.8, either from cmd.exe or from 
zsh.

--
nosy: +eric.smith

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



[issue46751] Windows-style path is not recognized under cygwin

2022-02-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

>:) Citing myself:

>> Trying this *bash* command line:

Oops, sorry for missing that.

As for 3.9: it's not available through the 64 bit installer (at least, I don't 
see it there). I'll look and see what's involved in installing it.

Are you running the 32- or 64-bit version?

Also: I suspect this is a cygwin problem that will need to be reported upstream.

--

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



[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

Good catch! I'll have a patch tonight.

--

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



[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-15 Thread Eric V. Smith


Change by Eric V. Smith :


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

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



[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-16 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset ffd9f8ff84ed53c956b16d027f7d2926ea631051 by Eric V. Smith in 
branch 'main':
bpo-46762: Fix an assert failure in f-strings where > or < is the last 
character if the f-string is missing a trailing right brace. (#31365)
https://github.com/python/cpython/commit/ffd9f8ff84ed53c956b16d027f7d2926ea631051


--

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



[issue45559] pprint tests do not test pprint.pprint()

2022-02-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

Sure, have a go at it!

Any testing of pprint.pprint() would be an improvement, but ideally all options 
should be tested.

It would probably be worthwhile to restructure the tests to run both pformat 
and pprint tests from the same logic, so that we only need to change one thing 
if new options are added. I haven't looked at the tests, so I'm not sure how 
much work this would be.

--

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



[issue46792] Indentation now preserved with ruamel.yaml.round_trip_dump

2022-02-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

This looks like an issue with ruamel.yaml, which is a third party package. You 
should report it to them.

Good luck!

--
nosy: +eric.smith

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



[issue46792] Indentation not preserved with ruamel.yaml.round_trip_dump

2022-02-18 Thread Eric V. Smith


Change by Eric V. Smith :


--
title: Indentation now preserved with ruamel.yaml.round_trip_dump -> 
Indentation not preserved with ruamel.yaml.round_trip_dump

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-19 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not crazy about adding a method to every dataclass just for the 0.1% of the 
times it's needed.

I think using hasattr or catching the exception is a better way to go.

--

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-19 Thread Eric V. Smith


Eric V. Smith  added the comment:

The fact that it's never been needed in the years that dataclasses and attrs 
have existed tell me it's kind of a niche requirement.

This does not seem like the ugliest code I've ever seen:

if hasattr(super(), "__post_init__"):
super().__post_init__()

or the probably more efficient, but more lines of code:

try:
post_init = super().__post_init__
except AttributeError:
pass
else:
post_init()

As always with calling super functions, the whole hierarchy needs to cooperate. 
Say you had a dataclass:

@dataclass
class Base:
def __post_init__(self, some_arg):
pass

How would an arbitrary derived class know how to call this? It can't. There has 
to be knowledge of the base class's requirements already. Surely knowing 
"__post_init__ must be called with some_arg" isn't too different from "I know 
__post_init__ doesn't exist". I don't think adding ways to make the "always 
call super" pattern easier is a good idea.

I'm still unconvinced, but I'll hold off on making a decision to see if there's 
more support. Maybe taking it to python-ideas would be worthwhile.

--

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-20 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm going to close this issue. As Raymond says, it's a breaking change, and the 
workaround is easy enough.

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

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Change by Eric V. Smith :


--
pull_requests: +29650
pull_request: https://github.com/python/cpython/pull/31523

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm adding a test that mimic's Raymond's example of the proposed addition being 
a breaking change. This way, if we ever decide to actually add this feature, 
we'll break this test. If we do decide to continue and make the change anyway, 
at least we'll do so with the knowledge that it's a breaking change.

--

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 288af845a32fd2a92e3b49738faf8f2de6a7bf7c by Eric V. Smith in 
branch 'main':
bpo-46757: Add a test to verify dataclass's __post_init__ isn't being 
automatically added. (GH-31523)
https://github.com/python/cpython/commit/288af845a32fd2a92e3b49738faf8f2de6a7bf7c


--

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



[issue46856] datetime.max conversion

2022-02-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

Please show us how they fail.

--
nosy: +eric.smith

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



[issue46856] datetime.max conversion

2022-02-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

Probably so. You could step through the code to make sure that's what's going 
on.

--

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



[issue46900] marshal.dumps represents the same list object differently

2022-03-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

>From https://github.com/python/cpython/blob/main/Python/marshal.c:

41 is:

#define TYPE_SMALL_TUPLE')'

The difference between 41 and 169 is 128:

#define FLAG_REF'\x80' /* with a type, add obj to index */

So the difference is the FLAG_REF bit being set. I'm not sure if that helps you 
or not.

In any event, this doesn't look like a bug. You might want to ask on 
python-list or Stack Overflow for more help.

--
nosy: +eric.smith

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



[issue46904] Python Decimal supports '#' format, C Decimal does not.

2022-03-02 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

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



[issue46904] Python Decimal supports '#' format, C Decimal does not.

2022-03-02 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +mark.dickinson

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



[issue46061] GCState *gcstate = get_gc_state() gives fatal error in Python 3.10.2

2022-03-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

> I was running one python script

Again: you need to show us the script that's causing this problem. I (and 
millions of others) run scripts all the time which do not fail in the way you 
describe. Unless you show us a script that causes the problem, we cannot help 
you.

--

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



[issue46061] GCState *gcstate = get_gc_state() gives fatal error in Python 3.10.2

2022-03-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

I understand. Then I'm going to close this issue, since there's nothing we can 
do.

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

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



[issue46461] Kodi crashing

2022-03-06 Thread Eric V. Smith

Eric V. Smith  added the comment:

I don’t have Ubuntu to test on. Plus the steps to reproduce are too much for 
the average volunteer to work through. I don’t think we’ll be able to help.

--

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



[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think this is a bug in the code. I'll have a PR ready shortly.

But since it's a non-trivial change, I'm going to target it for 3.11 only.

--
assignee: docs@python -> eric.smith
versions:  -Python 3.10, Python 3.9

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



[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

Yeah, I've come to the conclusion that it's not so simple, either. I'm also 
thinking that advising to call the base __init__ is a mistake.

--

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



[issue46941] Bug or plug not removed (The operator "is")

2022-03-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

As others have noted, the behavior is intentional, so I'm closing this.

--
nosy: +Dennis Sweeney, Jelle Zijlstra, eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue46949] Print an indication if traceback exceeds sys.tracebacklimit

2022-03-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

If you go with the second idea, I'd say something like f"More than {2 * 
tracebacklimit} additional stack frames not shown". It seems handy to know the 
magnitude of the problem.

--
nosy: +eric.smith

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



[issue46945] Quantifier and Expanded Regex Expression Gives Different Results

2022-03-07 Thread Eric V. Smith


Change by Eric V. Smith :


--
components: +Regular Expressions -Library (Lib)
nosy: +ezio.melotti, mrabarnett

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



[issue1009] Implementation of PEP 3101, Advanced String Formatting

2007-08-23 Thread Eric V. Smith

Changes by Eric V. Smith:


--
versions: +Python 2.6

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1009>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1009] Implementation of PEP 3101, Advanced String Formatting

2007-08-25 Thread Eric V. Smith

Eric V. Smith added the comment:

Closed, code was checked in revision 57444.

--
versions: +Python 3.0 -Python 2.6

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1009>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1009] Implementation of PEP 3101, Advanced String Formatting

2007-08-25 Thread Eric V. Smith

Eric V. Smith added the comment:

I tried to close it, without success.  Possible tracker issue, I'll
investigate.

It should be closed!

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1009>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1158] %f format for datetime objects

2007-09-13 Thread Eric V. Smith

Eric V. Smith added the comment:

It's a nit, but there are a few other comments that should be changed to
mention %f in addition to %z/%Z.

 * giving special meanings to the %z and %Z format codes via a preprocessing

/* Scan the input format, looking for %z and %Z escapes, building

/* percent followed by neither z nor Z */

--
nosy: +eric.smith

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1158>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13033] recursive chown for shutils

2011-09-23 Thread Eric V. Smith

Eric V. Smith  added the comment:

See also issue 12191, where there was a brief discussion of this.

--
nosy: +eric.smith

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



[issue13079] Wrong datetime format in PEP3101

2011-09-30 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks for the report. Fixed in 9a9bd05b9fca.

--
resolution:  -> fixed
status: open -> closed

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



[issue13109] telnetlib insensitive to connection loss

2011-10-05 Thread Eric V. Smith

Eric V. Smith  added the comment:

Can you post some example code?

I would not expect disconnecting the network cable to close any TCP 
connections, unless you are transmitting data and/or you have keepalives turned 
on.

--
nosy: +eric.smith

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



[issue13109] telnetlib insensitive to connection loss

2011-10-06 Thread Eric V. Smith

Eric V. Smith  added the comment:

Assuming that you're unplugging the cable when the code is in the loop that 
occurs after the line "self.pcPart.write(cmdx)", and also assuming that you 
haven't turned on keepalives, then the behavior you see is expected.

You're just waiting to read some data, and there are no pending writes. 
Therefore the TCP stack will wait forever if there are no incoming packets. 
There could be no incoming packets due to no data being ready, of from the 
network being down. The TCP stack has no way of knowing, so it cannot notify 
your code.

I suggest turning on TCP keepalives, which would then allow the TCP stack to 
notify your code that the connection has been closed.

I'm going to close this issue. If you turn on keepalives and still see this 
problem, please reopen it.

--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

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



[issue13143] os.path.islink documentation is ambiguous

2011-10-10 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith, jason.coombs

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



[issue13271] When -h is used with argparse, default values that fail should not matter

2011-10-26 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +bethard, eric.smith

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



[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed

2011-11-01 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue13321] fstat doesn't accept an object with "fileno" method

2011-11-02 Thread Eric V. Smith

Eric V. Smith  added the comment:

If I understand it correctly, this change request is to change os.fstat(obj) 
(and probably other functions) to call obj.fileno(), instead of the caller 
doing that?

If so, -1. Keep os.fstat() as a thin wrapper around fstat.

--
nosy: +eric.smith

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



[issue13385] Add an explicit re.NOFLAGS flag value to the re module

2011-11-11 Thread Eric V. Smith

Eric V. Smith  added the comment:

Since the flags are OR'd together, I don't see what other value the "no flags" 
parameter could have, other than zero. That said, I don't feel strongly about 
it, and if it helps readability I'm not opposed.

--

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



[issue13386] Document documentation conventions for optional args

2011-11-12 Thread Eric V. Smith

Eric V. Smith  added the comment:

To your last point, I think it's important to specify the default value 
placeholder (basically a sentinel) in the documentation. For example, if a 
function takes -1 to mean "all occurrences", then the caller needs to know how 
what value to pass in in order to let the function compute the value. This is 
especially true if it's cheaper for the function to compute the value instead 
of the caller.

I've run into this problem before, where I wanted to pass in some sentinel 
value and I had to read the source to figure out what it was. I think the 
function was in the standard library, but now I can't recall what it was.

--
nosy: +eric.smith

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



[issue13410] String formatting bug in interactive mode

2011-11-15 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue13412] No knowledge of symlinks on Windows

2011-11-15 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith, jason.coombs

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



[issue13410] String formatting bug in interactive mode

2011-11-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

I think this must be a change between 2.5 and 2.6.

In 2.5.1 non-debug (Linux) I consistently see:
>>> print '%d' % y
Traceback (most recent call last):
  File "", line 1, in 
TypeError: int argument required

In 2.6.5 (Windows via activestate) I see the alternating errors reported here.

In 2.7.2+ debug (Linux) I consistently see:
>>> print '%d' % y
22
XXX undetected error
Traceback (most recent call last):
  File "", line 1, in 
TypeError: int() argument must be a string or a number, not 'Foo'
[38749 refs]

Note the "XXX undetected error".

In 2.7.2+ non-debug (Linux), I get the alternating errors reported here.

I don't think anything will be done about the problem in 2.6. For 2.7, the "XXX 
undetected error" should be investigated, and will likely point to the problem.

--
assignee: ronaldoussoren -> 
components: +Interpreter Core -Macintosh
versions: +Python 2.7

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



[issue13410] String formatting bug in interactive mode

2011-11-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

I don't think you're going to want those print statements in a test. You could 
just evaluate '%d' % y.

--

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



[issue13410] String formatting bug in interactive mode

2011-11-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

With an unpatched 2.7, this fails for me:

diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -289,6 +289,17 @@
 else:
 raise TestFailed, '"%*d"%(maxsize, -127) should fail'
 
+def test_issue13410(self):
+class Foo(object):
+def __init__(self, x):
+self.x = x
+def __long__(self):
+return long(self.x)
+def __float__(self):
+return float(self.x)
+'%d' % Foo(22)
+
 def test_main():
 test_support.run_unittest(FormatTest)
 

$ ./python Lib/test/regrtest.py test_format
test_format
test test_format crashed -- : int() argument must 
be a string or a number, not 'Foo'
1 test failed:
test_format

--

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



[issue13410] String formatting bug in interactive mode

2011-11-16 Thread Eric V. Smith

Eric V. Smith  added the comment:

Interesting! Same here.

Using eval() fails with or without -v:

--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -289,6 +289,18 @@
 else:
 raise TestFailed, '"%*d"%(maxsize, -127) should fail'
 
+def test_issue13410(self):
+class Foo(object):
+def __init__(self, x):
+self.x = x
+def __long__(self):
+return long(self.x)
+def __float__(self):
+return float(self.x)
+eval(u'%d' % Foo(22))
+eval('%d' % Foo(22))
+
+
 def test_main():
 test_support.run_unittest(FormatTest)
 
I've put both '%d' and u'%d' here, but it also fails with just one of them.

--

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



[issue13386] Document documentation conventions for optional args

2011-11-17 Thread Eric V. Smith

Eric V. Smith  added the comment:

I just ran across the other reason that having the actual default values 
documented is important. Sometimes I want to do this:

some_func(param if some_condition else )

If some_condition is False, I want the default behavior, if not, I want to pass 
in a parameter. If I don't know the real default value, I have to write:

if some_condition:
   some_func(param)
else:
   some_func()

--

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



[issue13433] String format documentation contains error regarding %g

2011-11-19 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue10621] >>> 1 + 2j --> (1 + 2j) and not (1+2j)

2011-11-20 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm not sure why this is being reopened. Unless there's been a discussion I'm 
not aware of, the change is still not worth the disruption it would cause.

And in any event, it can only be addressed in new (as yet unreleased) versions 
of python. It would never be implemented in any release before 3.3.

--
resolution: remind -> wont fix
status: open -> closed
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.4

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



[issue10621] >>> 1 + 2j --> (1 + 2j) and not (1+2j)

2011-11-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm -1 on this change. I think all the core devs who have commented on it here 
are -1 or -0. If you really want to lobby for this change, I suggest starting a 
discussion on python-dev.

My position is that I think it would indeed look nicer, but the breakage 
doesn't justify the small improvement.

--

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



[issue13450] add assertions to implement the intent in ''.format_map test

2011-11-21 Thread Eric V. Smith

Changes by Eric V. Smith :


--
assignee:  -> eric.smith

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



[issue13450] add assertions to implement the intent in ''.format_map test

2011-11-22 Thread Eric V. Smith

Eric V. Smith  added the comment:

I don't think the existing tests have any value. I might leave one of them, but 
I think I'll just use your new tests instead.

akira: I'd like to add your name to the Misc/ACKS file, if it's not already 
there. What's your full name?

Thanks for the bug report and patch.

--

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-05 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue13579] string.Formatter doesn't understand the !a conversion specifier

2011-12-11 Thread Eric V. Smith

Changes by Eric V. Smith :


--
assignee:  -> eric.smith
nosy: +eric.smith

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



[issue13598] string.Formatter doesn't support empty curly braces "{}"

2011-12-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

This bug is assigned to me. Sometimes it takes a while before a committer has 
time to review a bug and act on it. I can assure you that I will review this 
before the next release of Python.

Thank you for the bug report, and especially thanks for the patch!

One thing that will definitely need to be developed before this is committed is 
one or more tests. Either you can add them, or I will before I commit the fix. 
There are some existing tests for str.format that can be leveraged for 
string.Formatter.

--
stage:  -> patch review

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



[issue12014] str.format parses replacement field incorrectly

2011-12-15 Thread Eric V. Smith

Changes by Eric V. Smith :


--
assignee:  -> eric.smith

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



[issue13685] argparse does not sanitize help strings for % signs

2011-12-30 Thread Eric V. Smith

Eric V. Smith  added the comment:

This is because the help text support substitution, as mentioned here: 
http://docs.python.org/dev/library/argparse.html#help

It's possible this documentation could be improved.

--
assignee:  -> docs@python
components: +Documentation -None
nosy: +docs@python, eric.smith

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



[issue13685] argparse does not sanitize help strings for % signs

2012-01-02 Thread Eric V. Smith

Eric V. Smith  added the comment:

In case I wasn't clear, I mean that the help string supports %-formatting 
variable expansion, such as "%(default)s". I think it would be good if a 
sentence were added to the end of the "help" section, saying something like:

Because the help string supports %-formatting, if you want a literal "%" to 
appear in the help string, you must escape it as "%%".

--

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



[issue13706] non-ascii fill characters no longer work in numeric formatting

2012-01-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

I assume this is left over from the PEP 393 changes. I think the right thing to 
do is delete this code from line 277 of formatter_unicode.c:

if (format->fill_char > 127 || format->align > 127 ||
format->sign > 127) {
PyErr_SetString(PyExc_ValueError, "fill character too large");
return 0;
}

I'm not sure such a restriction needs to exist any more. But I'll admit to not 
having thought it through.

--

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



[issue13718] Format Specification Mini-Language does not accept comma for percent value

2012-01-06 Thread Eric V. Smith

Changes by Eric V. Smith :


--
assignee:  -> eric.smith

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Eric V. Smith

Changes by Eric V. Smith :


--
assignee:  -> rhettinger

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



[issue13718] Format Specification Mini-Language does not accept comma for percent value

2012-01-09 Thread Eric V. Smith

Eric V. Smith  added the comment:

Good point. I hadn't looked at the string closely enough. Closing.

--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

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



[issue13755] str.endswith and str.startswith do not take lists of strings

2012-01-10 Thread Eric V. Smith

Eric V. Smith  added the comment:

It seems like a set would make more sense than a tuple. And if tuples, why not 
lists?

Not that it matters much, since I doubt it's worth changing in either case. 
It's easy enough for the caller to convert.

--
nosy: +eric.smith

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



[issue13776] formatter_unicode.c still assumes ASCII

2012-01-12 Thread Eric V. Smith

Eric V. Smith  added the comment:

This is a duplicate of issue 13706.

--
nosy: +eric.smith
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed

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



[issue13706] non-ascii fill characters no longer work in formatting

2012-01-12 Thread Eric V. Smith

Eric V. Smith  added the comment:

Sorry for the off-the-cuff diagnosis. I had assumed this was the unintended 
result of the conversion, but of course I'm wrong.

I'd like to fix this.

--
nosy: +Jim.Jewett

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



[issue12185] Decimal documentation lists "first" and "second" arguments, should be "self" and "other"

2011-05-26 Thread Eric V. Smith

New submission from Eric V. Smith :

http://docs.python.org/library/decimal.html

In 9.4.2, "Decimal objects", some of the methods mention the first and second 
parameters, when really it should be "self" and the argument, usually named 
"other" and sometimes something more specific. These include:

compare_total
copy_sign
next_toward
quantize (argument is exp)
rotate
scaleb
shift

It looks this is left over from where the same-named functions are described in 
the "Context objects" section.

--
assignee: docs@python
components: Documentation
messages: 136947
nosy: docs@python, eric.smith
priority: normal
severity: normal
status: open
title: Decimal documentation lists "first" and "second" arguments, should be 
"self" and "other"
versions: Python 2.7

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



[issue12188] PEP 7, C style: add ++ policy and explanation

2011-05-26 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue12191] Shutil - add chown() in order to allow to use user and group name (and not only uid/gid)

2011-05-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

As a new feature, it can't be added to 2.7.

--
nosy: +eric.smith

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



[issue12185] Decimal documentation lists "first" and "second" arguments, should be "self" and "other"

2011-05-28 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm not talking about the method itself but rather the descriptive text. For 
example:

copy_sign(other)

Return a copy of the first operand with the sign set to be the same as the 
sign of the second operand. 

There is no second operand, unless you consider "self" the first and "other" 
the second. Which of course is true inside the method, but it reads oddly as a 
description of the method from the outside.

--

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



[issue12014] str.format parses replacement field incorrectly

2011-06-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

PEP 3101 defines format strings as intermingled character data and markup. 
Markup defines replacement fields and is delimited by braces. Only after markup 
is extracted does the PEP talk about interpreting the contents of the markup.

So, given "{0[a}b]}" the parser first parses out the character data and the 
markup. The first piece of markup is "{0[a}". That gives a syntax error because 
it's missing a right bracket.

I realize you'd like the parser to find the markup as the entire string, but 
that's not how I read the PEP.

--

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



[issue12014] str.format parses replacement field incorrectly

2011-06-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

The intermingling of character data and markup is far from irrelevant: that's 
exactly what str.format() does! I don't see how it can be irrelevant to a 
discussion of how the string is parsed.

Note that there are no restrictions, in general, on what's in a format 
specifier. Braces can be in format specifiers, if they make sense for that 
type. For example:

>>> from datetime import datetime
>>> format(datetime.now(), '{}%Y-%m-%d}{')
'{}2011-06-03}{'

It's definitely true that you can have valid format specifiers that cannot be 
represented in strings parsed by str.format(). The PEP talks about both format 
specifiers in the abstract (stand alone) and format specifiers contained in 
str.format() strings.

The current implementation of str.format() finds matched pairs of braces and 
call what's inside "markup", then parse that markup. This indeed restricts 
what's inside the markup. I believe the implementation is compliant with the 
PEP.

It's also true that other interpretations of the PEP are possible. I'm just not 
sure the benefit to be gained justifies changing all of the extant str.format() 
implementations, in addition to explaining the different behavior.

Many useful features for str.format() were rejected in order to keep the 
implementation and documentation simple.

I'm not saying change and improvement is impossible. I'm just not convinced 
it's worthwhile.

--

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



[issue12014] str.format parses replacement field incorrectly

2011-06-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

>From the PEP: "Format strings consist of intermingled character data and 
>markup."

--

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



[issue12014] str.format parses replacement field incorrectly

2011-06-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

"""
>>> d = {"{0}": "spam"}
>>> # a matched pair of braces. What's inside is considered markup.
... 
>>> "{0}".format(d)
"{'{0}': 'spam'}"
>>> # a matched pair of braces. Inside is a matched pair of braces, and what's 
>>> inside of that is not considered markup.
"""

I'm not sure what' you're getting at. "{0}" (which is indeed "markup") is 
replaced by str(d), which is "{'{0}': 'spam'}".

"""
... 
>>> "{0[{0}]}".format(d)
'spam'
>>> 
"""

Again, I'm not sure what you're getting at. The inner "{0}" is not interpreted 
(per the PEP). So the entire string is replaced by d['{0}'], or 'spam'.

Let me try to explain it again. str.format() parses the string, looking for 
matched sets of braces. In your last example above, the very first character 
'{' is matched to the very last character '}'. They match, in sense that all of 
the nested ones inside match. Once the markup is separated from the character 
data, the interpretation of what's inside the markup is then done. In this 
example, there is no character data.

I apologize if I'm explaining this poorly.

--

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



[issue12014] str.format parses replacement field incorrectly

2011-06-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

We're going to have to agree to disagree. I believe that "{0[}]}" is the markup 
"{0[}" followed by the character data "]}".

--

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



[issue12188] PEP 7, C style: add ++ policy and explanation

2011-06-07 Thread Eric V. Smith

Eric V. Smith  added the comment:

But don't you think we should put information like this somewhere, even if it's 
not in PEP 7? We've had a discussion about this particular issue (idiomatic 
pointer increments when appending to a buffer) at least twice, and there's also 
the recent "if (const == variable)" issue that feels similar to me.

It seems to me that recording these decisions somewhere has value, just so we 
don't have to revisit them.

--
status: pending -> open

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



[issue12342] characters with ord above 65535 fail to display in IDLE

2011-06-15 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue12450] Use the Grisu algorithms to convert floats to strings

2011-06-30 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

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



[issue12450] Use the Grisu algorithms to convert floats to strings

2011-06-30 Thread Eric V. Smith

Eric V. Smith  added the comment:

I see the problems as:

1. Given Python's other overhead, we'd need to profile to show an improvement 
in the speed of this conversion would make a noticeable impact on any import 
workload.

2. If we want to keep the shortest-float-repr property for all possible 
doubles, we'd need to use Grisu3 but still keep our existing code for the 
fallback cases. This is a big increase in the complexity of an already complex 
piece of code.

I'm not saying don't switch to Grisu2 or use Grisu3 with the fallback to 
existing code: maybe the speed improvements are worth it, maybe we can say we 
we can live with 99.5% shortest repr coverage, or maybe the complexity is worth 
it. I just want to record the issues here.

--

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



[issue12468] longjmp causes uninitialized stack frame

2011-07-01 Thread Eric V. Smith

Eric V. Smith  added the comment:

Do you have a python code snippet which triggers this?

--
nosy: +eric.smith

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



[issue12505] python interpreter not handle wildards properly

2011-07-06 Thread Eric V. Smith

Eric V. Smith  added the comment:

But what if you don't want the expansion done? I always invoke python from 
cygwin's bash shell, and sometimes I tell the shell not to expand the 
arguments, such as:

python \*
or
python '*'

I wouldn't want python (or rather the C runtime) to do the expansion in this 
case, and I don't see how it could know not to do it.

--
nosy: +eric.smith

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



[issue12505] python interpreter not handle wildards properly

2011-07-06 Thread Eric V. Smith

Eric V. Smith  added the comment:

Both of them work under cygwin. My point is that neither would work if the C 
runtime expanded command line arguments.

--

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



<    1   2   3   4   5   6   7   8   9   10   >