[issue9944] Typo in doc for itertools recipe of consume

2010-09-24 Thread Jon Clements

New submission from Jon Clements :

Very low priority.

def consume(iterator, n):
"Advance the iterator n-steps ahead. If n is none, consume entirely."
# Use functions that consume iterators at C speed.
if n is None:
# feed the entire iterator into a zero-length deque
collections.deque(iterator, maxlen=0)
else:
# advance to the emtpy slice starting at position n
next(islice(iterator, n, n), None)

Hardly a show stoppper, and not me worth submitting a patch, but "emtpy" should 
be "empty". Just thought I'd make note of it before I forgot.

--
assignee: d...@python
components: Documentation
messages: 117339
nosy: d...@python, joncle
priority: normal
severity: normal
status: open
title: Typo in doc for itertools recipe of consume
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue8185] re.findall()

2010-03-20 Thread Jon Clements

Jon Clements  added the comment:

Seems consistent to me:

.match, .search and .finditer return a MatchObject whose .group() return the 
*entire matched string*. If you use .group(1) you'll get similar results to 
.findall() which returns a list of (possibly of tuples) of the captured 
groupings.

This is the findall equivalent (using a non-capturing group):

>>> re.findall('a(?:b)?', 'ab')
['ab']

--
nosy: +joncle

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



[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements

New submission from Jon Clements :

I'm not a numeric expert but I was looking at a post on S/O which related to 
converting a Fraction to a certain amount of decimal places. I've had a hunt on 
the tracker but couldn't find anything relevant, but if I've missed it, I 
apologise.

# F=Fraction, D=Decimal classes

If I try num = D( F(5, 7) )

I get: TypeError: Cannot convert Fraction(5, 7) to Decimal

So I do:

>>> D(f.numerator) / D(f.denominator)
Decimal('0.7142857142857142857142857143')

Which I think is the correct result?

I guess my question is - should Decimal do this implicitly for Fraction?

--
components: Library (Lib)
messages: 163397
nosy: joncle
priority: normal
severity: normal
status: open
title: Decimal accepting Fraction
type: enhancement

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



[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements

Jon Clements  added the comment:

Mark - I bow to your superiour knowledge here. However, would not a classmethod 
of .from_fraction be welcome?

ie, I could write:

d = D.from_fraction(5, 7)

Then the documents labour the point about what you've mentioned?

Just an idea, but fully realise you're the man best suited to decide, so I'll 
be happy with whatever you say.

--

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



[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements

Jon Clements  added the comment:

Not sure what's going on with my machine today: keep sending things to early.

I meant:

D.from_fraction(F)

where if F is not of type Fraction, then the args are used to construct a 
Fraction - so can use an existing or create one.

--

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



[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements

Jon Clements  added the comment:

The more I think about this - the shades of grey kick in.

D.from_fraction(F or creatable F) 

Then it would be 'reasonable to assume' for a F.to_decimal() to exist.

Possibly with an optional context argument.

Then, what happens if I do D('2.45') * F(24 / 19)...

I'll leave it to the experts, but have noticed Raymond has ideas for this, but 
not yet commented?

--

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



[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2013-10-23 Thread Jon Clements

Changes by Jon Clements :


--
nosy: +joncle

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



[issue18925] select.poll.modify is not documented

2013-12-07 Thread Jon Clements

Jon Clements added the comment:

Was looking up epoll.modify and noticed in the docs it's listed as "
Modify a register file descriptor." - I believe that should be "Modify a 
registered file descriptor"...

--
nosy: +joncle

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



[issue23864] issubclass without registration only works for "one-trick pony" collections ABCs.

2015-04-04 Thread Jon Clements

Changes by Jon Clements :


--
nosy: +joncle

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



[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2015-05-10 Thread Jon Clements

Changes by Jon Clements :


--
nosy: +joncle

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