Ethan Furman added the comment:
Testing the patch...
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
___
___
Python-bugs-list mailing list
Ethan Furman added the comment:
In going through the tests I have found an edge-case that I am unsure of how to
handle:
Counter(a=1) Counter(a=1, b=1)
On the one hand, they both have the same value for 'a'; on the other hand, the
second counter has more elements...
So should the result
Changes by Ethan Furman et...@stoneleaf.us:
--
stage: test needed - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
Ethan Furman added the comment:
I am not a mathematician -- feel free to include the answer with your hints. ;)
If my analogy is correct, this situation is similar to
{1} {1, 2}
Which is True. Can someone verify that I am correct
Ethan Furman added the comment:
New patch attached.
--
Added file: http://bugs.python.org/file36794/issue22515.stoneleaf.patch.01
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
Ethan Furman added the comment:
I, myself, wrote:
-
At least, it will until we fix that bug. ;)
Happily, reading the whole documentation revealed that non-integer values are
allowed, so it's not a bug. :)
--
___
Python tracker
Ethan Furman added the comment:
Ignore that last comment -- I don't know what I did yesterday, but unary minus
is working as expected today. :/
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22533
Ethan Furman added the comment:
Curiousity question: What happens if you try to sort a list of partially
ordered Counters?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
Ethan Furman added the comment:
If it is so specialized as to only be needed in complex combinatorial
calculations, does it belong in the general-purpose part of the language?
After all, we have the math and cmath modules for more specialized arithmetic
operations
Ethan Furman added the comment:
-- s1 = set([1])
-- s2 = set([1, 2])
-- s3 = set([1, 2, 3])
-- s4 = set([2])
-- s5 = set([2, 3])
-- s6 = set([3])
-- l = [s1, s2, s3, s4, s5, s6]
-- sorted(l)
[{1}, {2}, {1, 2}, {3}, {2, 3}, {1, 2, 3}]
-- s1 s4
False
-- s4 s2
True
-- s1 s2
True
-- s4 s6
Ethan Furman added the comment:
I'll go with +0.5. :)
If this goes in, I think a missing key in either Counter should default to 0
for purposes of the ordering.
--
stage: - test needed
___
Python tracker rep...@bugs.python.org
http
Ethan Furman added the comment:
That does seem odd -- how can you have 'b' of something?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
Ethan Furman added the comment:
I have to disagree. The intent is clearly expressed in the docs [1]. However,
if I have a need to deal with partial amounts (say, 2.5 apples because I gave
half of one to my horse ;), Counter will still work with that:
-- treats = Counter({'carrots':12
Ethan Furman added the comment:
[1] https://docs.python.org/3/library/collections.html#collections.Counter
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
New submission from Ethan Furman:
According to the docs [1]:
Counter objects have a dictionary interface except that they return a
zero count for missing items instead of raising a KeyError
Which a simple test confirms:
-- Counter()['b']
0
However, if the key is present but set to zero
Ethan Furman added the comment:
Exactly what operation is unary minus supposed to be? It seems to act like
absolute value.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22533
New submission from Ethan Furman:
First, the behavior for pwd.struct_passwd:
-
-- pwd.getpwuid(1000)
pwd.struct_passwd(pw_name='ethan', pw_passwd='x', pw_uid=1000, pw_gid=1000,
pw_gecos='Ethan Furman,,,', pw_dir='/home/ethan', pw_shell='/bin/bash
Ethan Furman added the comment:
Test added.
--
keywords: +patch
stage: - needs patch
Added file: http://bugs.python.org/file36752/issue22513.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22513
Ethan Furman added the comment:
Thanks, Serhiy.
--
resolution: - not a bug
stage: needs patch - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22513
Ethan Furman added the comment:
What would be the result of
Counter({'a':1, 'b':2}) Counter({'a':2, 'b':1})
?
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22515
Ethan Furman added the comment:
set's don't have values, and you are wanting to implement the partial ordering
based on the values. (side-note: how does partial-ordering work for sets?)
That is, one counter will be considered smaller-or-equal to another if for any
item in the first counter
Ethan Furman added the comment:
That is certainly a better definition. If you carefully reread your original
post you will see that you wrote something different ('any' instead of
'every'). Also, your OP uses '__lt__' but talks about 'less-than-or-equal --
somewhat confusing
Ethan Furman added the comment:
I think the final call is Raymond's (whether to accept the patch), but go
ahead. Worst case scenario is you'll have your own thoroughly tested
PartiallyOrderedCounter you can use in your own code. :)
--
nosy: +rhettinger
type: - enhancement
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22504
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
___
Python-bugs-list
Ethan Furman added the comment:
Enums have a definition order to aid in the use-case of auto-numbering, and to
make displays consistent. However, the basic Enum type is unordered.
If you need/want your particular enum type to be ordered, mix-in the ordered
magic methods.
--
assignee
Ethan Furman added the comment:
Yes, we're sure. ;)
Enums have a definition order to aid in the use-case of auto-numbering, and to
make displays consistent. However, the basic Enum type is unordered.
I do not see a serial number as being an intrinsic property of an enum --
outside of auto
Changes by Ethan Furman et...@stoneleaf.us:
--
stage: - test needed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
___
Python-bugs-list
Ethan Furman added the comment:
More just a note to myself to research this further, to see exactly what does
and does not get inherited. Any tests added will likely be more comprehensive
than your example.
--
___
Python tracker rep
Ethan Furman added the comment:
http://hg.python.org/cpython/rev/4135f3929b35
http://hg.python.org/cpython/rev/cdd412347827
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http
Changes by Ethan Furman et...@stoneleaf.us:
--
assignee: ethan.furman - docs@python
nosy: +docs@python
resolution: - fixed
stage: - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21738
Ethan Furman added the comment:
You could do the same kind of check in __new__, but consider this:
class StrValues(MultiValueEnum):
one = ('One'
'one',
'1')
two = ('two',
'Two',
'2')
In this scenario the 'Oneone' mistake would still
Ethan Furman added the comment:
My apologies for the confusion, and thanks for tracking it down.
I'll get the patch in, but I'm curious how you actually use these Enums? Is
this a way to easily handle multiple aliases?
--
___
Python tracker rep
Ethan Furman added the comment:
Right. We can still use the alias machinery to accomplish this task for us,
and avoid the metaclass hacking:
-- python2 sample code
# -*- coding: utf-8 -*-
from enum import Enum
class MultiValueEnum(Enum):
def __new__
Ethan Furman added the comment:
Can you give an example of the code you were having problems with?
--
assignee: - ethan.furman
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22339
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +barry, eli.bendersky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22339
___
___
Python-bugs
Ethan Furman added the comment:
This is not a regression. json only deals with standard types (int, str,
etc.), and Enum is not a standard type.
Enum was introduced in 3.4, so corresponding changes were made to json to
support int and float subclasses, of which IntEnum is one.
In other
Ethan Furman added the comment:
One argument against fixing: If we do fix in 2.7.9 then any program targeting
it will be unable to target 3.0-3.3, as those versions do not have the fix from
3.4.
--
___
Python tracker rep...@bugs.python.org
http
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22121
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22122
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22123
___
___
Python-bugs-list
Ethan Furman added the comment:
We should be able to add enough smarts to handle both cases.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22121
Ethan Furman added the comment:
Thank you for your efforts, Amitava. Please also sign a Contributor's License
Agreement so we can actually use your code. :)
http://www.python.org/psf/contrib/
--
___
Python tracker rep...@bugs.python.org
http
Ethan Furman added the comment:
Should this patch also go into the 3.3 branch? It only went into 3.4.
If yes, how should I go about doing that?
--
assignee: - ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18780
Ethan Furman added the comment:
Cool, leaving it closed.
--
versions: -Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18780
Ethan Furman added the comment:
Yes, that test should pass when this issue is resolved.
I can't tell from your comment what you are trying to do to resolve it, but the
course of action I had in mind was to have the `type` meta-class make a final
examination of the type it was creating
Ethan Furman added the comment:
Common, no. And if the docs were silent on the matter that would be okay, but
unfortunately the docs declare that it is not possible, which is just plain
wrong.
Patch also mentions _value_ as that is the supported interface when customizing
__new__ methods
Ethan Furman added the comment:
Left comments in reitvald about modifying the Enum used -- let me know if you
have any questions about that.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21793
Ethan Furman added the comment:
Right, I had copied that code from test_pydoc which is where 'print_diffs' is
defined.
A comment there says to use the now-included functionality in unittest, and
some digging in the docs revealed that assertEqual uses diffs by default.
--
assignee
New submission from Ethan Furman:
Replacing __new__ in an Enum subclass is not possible /in the subclass
definition/, but is easily replaced via monkey-patching after the class has
been defined.
Docs need to be updated to reflect this.
--
assignee: ethan.furman
messages: 220372
nosy
Ethan Furman added the comment:
That is certainly nicer than the current idiom:
Animal = Enum('Animal', zip('ant bee cat dog'.split(), range(4)))
--
assignee: - ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Ethan Furman added the comment:
Playing devil's advocate:
The issue is not so much the keystrokes saved as the improvement in reading and
understanding what was intended. If you are happy with starting at 1 the idiom
is easy to both write, read, and understand; but if you want some other
Ethan Furman added the comment:
I think something like the following, taken from
http://bugs.python.org/issue19030#msg199920, shoud do the trick for something
to test against:
class Meta(type):
def __getattr__(self, name):
if name == 'ham':
return 'spam
Ethan Furman added the comment:
Good work.
This bug was fixed in 3.4 with the inclusion of enum.
It would definitely be good to fix in 2.7 as well.
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21561
Ethan Furman added the comment:
The problem will affect anything that uses the same mechanism as enum. It also
affects (not verified) all versions of python up to 3.4 where it was fixed
because enum exposed it.
Besides which, I did not think a bug had to affect stdlib code in order
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2506
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19979
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17352
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18334
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17421
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17422
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17044
___
___
Python-bugs-list
Ethan Furman added the comment:
Terry remarked:
---
I am puzzled by the opening statement there that
from enum import Enum # I added this as necessary
class Season(Enum):
SPRING = Season()
works beautifully at top level as it indeed raises
NameError: name 'Season
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21469
___
___
Python-bugs-list
Ethan Furman added the comment:
Ah, so when you (Adam) said extraction works fine, what you meant was
extraction works fine *in other programs*. Okay.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6839
Ethan Furman added the comment:
Adam Polkasnik said:
Extraction works fine, the issue was that raise() was creating an exception,
and
stopping the whole extraction process.
That doesn't make sense. If an exception was stopping the whole extraction
process
Ethan Furman added the comment:
Actually, I haven't had this issue in quite a while now, so closing.
Thanks for taking a look at it, Jesús.
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20094
Ethan Furman added the comment:
Adam, please stop deleting the files. It makes for a lot of noise to those on
the nosy list, and is unnecessary.
Just make sure you increment the version number on the files you upload and it
will be fine.
Thanks
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6839
___
___
Python-bugs-list
Ethan Furman added the comment:
Yay, 'resolved' !
--
stage: patch review - resolved
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
Ethan Furman added the comment:
Looks good to me.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21068
___
___
Python-bugs-list mailing list
Ethan Furman added the comment:
Sounds good to me.
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20421
___
___
Python-bugs
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10769
___
___
Python-bugs-list
Ethan Furman added the comment:
Downside to this patch (stoneleaf.01) is that custom AttributeErrors raised in
__getattr__ are overridden, which is a pretty severe regression.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Changes by Ethan Furman et...@stoneleaf.us:
Removed file: http://bugs.python.org/file34648/issue1615.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1615
Changes by Ethan Furman et...@stoneleaf.us:
--
Removed message: http://bugs.python.org/msg215091
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1615
Ethan Furman added the comment:
Downside to this patch (stoneleaf.02) is that custom AttributeErrors raised in
__getattr__ are overridden, which is a pretty severe regression.
(Removed, renamed, and reloaded patch.)
--
Added file: http://bugs.python.org/file34657/issue1615.stoneleaf
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
___
Python-bugs-list
Ethan Furman added the comment:
Results from the first two tests in my test script:
--
'WithOut' object has no attribute 'not_here'
looking up not_here
looking up huh
'With' object has no attribute 'not_here'
--
stage: test needed - patch
Changes by Ethan Furman et...@stoneleaf.us:
Removed file: http://bugs.python.org/file34647/issue1615.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1615
Changes by Ethan Furman et...@stoneleaf.us:
Added file: http://bugs.python.org/file34648/issue1615.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1615
Ethan Furman added the comment:
PEP 461 has been accepted. I'll look over the code soon.
--
assignee: - ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20284
Ethan Furman added the comment:
Mostly new patch against 3.5
--
Added file: http://bugs.python.org/file34634/issue8297.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21068
___
___
Python-bugs-list
Ethan Furman added the comment:
Final status:
3.4 - DeprecationWarning
3.5 - TypeError
--
resolution: - fixed
stage: commit review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Changes by Ethan Furman et...@stoneleaf.us:
--
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
___
Python
Ethan Furman added the comment:
ysj.ray: Your patch looks good. I had to make some changes since we're now at
3.5.
Before I can use your code, though, you need to sign the CLA [1].
Thanks.
[1] https://www.python.org/psf/contrib/contrib-form
Changes by Ethan Furman et...@stoneleaf.us:
--
stage: needs patch - test needed
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1615
Ethan Furman added the comment:
No, apparently I am incapable of spelling pseudo correctly. I'll fix that
along with the better error message:
%x format: an integer is required, not float
(variable, obviously ;)
--
___
Python tracker rep
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20145
___
___
Python-bugs-list
Ethan Furman added the comment:
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
-- bytes(5)
'5'
-- bytearray(5)
bytearray(b'\x00\x00\x00\x00\x00
Ethan Furman added the comment:
I'm inclined to leave it open while I do the suggested research.
Thanks for the tips, Terry, and the numbers, Josh.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20895
New submission from Ethan Furman:
`bytes` is a list of integers. Passing a single integer to `bytes()`, as in:
-- bytes(7)
b'\x00\x00\x00\x00\x00\x00\x00'
results in a bytes object containing that many zeroes.
I propose that this behavior be deprecated for eventual removal, and a class
Ethan Furman added the comment:
If no one else has gotten to this in the next six months or so, I will. :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
New submission from Ethan Furman:
Two minor code changes addressing the more pythonic comments. Major doc
enhancement addressing the functional API. Not sure about the markup as I can
no longer create the docs on my system.
--
assignee: larry
messages: 212670
nosy: ethan.furman
Ethan Furman added the comment:
For the past couple weeks everytime I try I get:
sphinx-build -b html -d build/doctrees -D latex_paper_size= . build/html
make: sphinx-build: Command not found
make: *** [build] Error 127
--
___
Python tracker rep
Ethan Furman added the comment:
Ah, thanks! Docs are built, fixed, and built again.
Larry, the two cherries to pick for this are:
b637064cc696: bulk of doc changes
54ab95407288: fixes for ReST markup
Thanks.
--
___
Python tracker rep
Ethan Furman added the comment:
Thanks, Larry. I'll have one more patch which will be much better comments in
the code, and a small doc enhancement. When it's ready should I reopen this
issue or create a new one?
--
___
Python tracker rep
Changes by Ethan Furman et...@stoneleaf.us:
Added file: http://bugs.python.org/file34185/issue20653.stoneleaf.03.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20653
Changes by Ethan Furman et...@stoneleaf.us:
Added file: http://bugs.python.org/file34191/issue20653.stoneleaf.04.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20653
1301 - 1400 of 1854 matches
Mail list logo