New submission from Madison May:
Currently the json lib only logs the string representation of the variable,
which does not always include type information.
I recently ran into a difficult to debug issue with code similar to the
following:
```
import json
import numpy as np
d = {'
New submission from Madison May:
I often find myself trying to access a file relative to the module I'm working
on. When this occurs, I'll often use something like the following:
```
os.path.abspath(os.path.join(os.path.dirname(__file__), "data/resource.pkl"))
```
I
Madison May added the comment:
I definitely agree that io shouldn't be special cased, as it's more about the
name shadowing issue that this specific example.
A simple docs addition would make me happy, to be honest.
--
___
Python trac
New submission from Madison May:
Naming a file `io.py` in the root directory of a project causes the following
error on 2.7:
AttributeError: 'module' object has no attribute 'BufferedIOBase'
Similar issues arise on 3.x., although the error message is a bit more usefu
Changes by Madison May :
--
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/issue21202>
___
___
Python-bugs-list mailing list
Unsubscribe:
Madison May added the comment:
There's currently an example of a cached property decorator implementation in
the wiki, although it doesn't leverage functools:
https://wiki.python.org/moin/PythonDecoratorLibrary#Cached_Properties
--
nosy: +m
Madison May added the comment:
+1 for simply deleting that bit
--
___
Python tracker
<http://bugs.python.org/issue20063>
___
___
Python-bugs-list mailin
New submission from Madison May:
Note item 6 of
http://docs.python.org/2.7/library/stdtypes.html#mutable-sequence-types is a
bit misleading.
It states: "The pop() method is only supported by the list and array types. The
optional argument i defaults to -1, so that by default the last
Madison May added the comment:
You have me convinced, Serhiy. I see the value in making the two functions
distinct.
For naming purposes, perhaps weighted_index() would be more descriptive.
--
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
> I think Storchaka's solution is more transparent and I agree with him on the
> point that the choice generator should be exposed.
Valid point -- transparency should be priority #1
--
___
Python tra
Madison May added the comment:
http://docs.python.org/3/tutorial/controlflow.html#arbitrary-argument-lists
http://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists
The above links do a so-so of explaining the splat operator, although I agree
that the docs for '*'
Madison May added the comment:
Serhiy, from a technical standpoint, your latest patch looks like a solid
solution. From an module design standpoint we still have a few options to
think through, though. What if random.weighted_choice_generator was moved to
random.choice_generator and
Madison May added the comment:
Simple and to the point. Sounds good to me...
--
___
Python tracker
<http://bugs.python.org/issue18800>
___
___
Python-bugs-list m
Madison May added the comment:
At Ezio suggestion, I've updated the patch to use
test.support.captured_stdout().
--
Added file: http://bugs.python.org/file31611/calendar_print_v2.diff
___
Python tracker
<http://bugs.python.org/is
Madison May added the comment:
Seems like a simple fix -- patch attached.
--
keywords: +patch
nosy: +madison.may
Added file: http://bugs.python.org/file31560/issue18893.diff
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
>How about adding a codecs.register like public API for 3.4+?
A codecs style register function seems like an excellent solution to me.
--
___
Python tracker
<http://bugs.python.org/issu
Madison May added the comment:
If nothing else, we should document the work around for this issue.
>>> import urllib.parse
>>> urllib.parse.uses_relative.append('redis')
>>> urllib.parse.uses_netloc.append('redis')
>>> urllib.parse.urlj
Madison May added the comment:
Just ran across a great blog post on the topic of weighted random generation
from Eli Bendersky for anyone interested:
http://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/
--
nosy: +eli.bendersky
Madison May added the comment:
> ...we can turn current functions in the random module into wrappers
> around generators from the distrib module.
Makes sense.
In light of Raymond's comments on code bloat in issue18844, perhaps this module
could be added to PyPi to see whether or
Madison May added the comment:
> What do R, SciPy, Fortran, Matlab or other statistical packages already do?
Numpy avoids recalculating the cumulative distribution by introducing a 'size'
argument to numpy.random.choice(). The cumulative distribution is calculated
once, then
Madison May added the comment:
I like the core idea of a family of random generators, but it feels like a new
module that's nearly identical to random introduces a lot of repeated code.
Perhaps adding an additional optional arg ('generator=False', for example) to
these function
Madison May added the comment:
> Use lru_cache isn't good because several choice generators can be used in a
> program and because it left large data in a cache long time after it was used.
Yeah, I just did a quick search of the stdlib and only found one instance of
lru_c
Changes by Madison May :
Added file: http://bugs.python.org/file31547/weighted_choice_v2.diff
___
Python tracker
<http://bugs.python.org/issue18844>
___
___
Python-bug
Changes by Madison May :
Removed file: http://bugs.python.org/file31546/weighted_choice_v2.diff
___
Python tracker
<http://bugs.python.org/issue18844>
___
___
Python-bug
Madison May added the comment:
[Raymond Hettinger]
> The sticking point is going to be that we don't want to recompute the
> cumulative weights for every call to weighted_choice.
> So there should probably be two functions:
> cw = make_cumulate_weights(weight_list)
> x
Madison May added the comment:
Whoops, my apologies.
--
___
Python tracker
<http://bugs.python.org/issue1>
___
___
Python-bugs-list mailing list
Unsubscribe:
Madison May added the comment:
Any chance this issue could be reopened? I ran across this bit of code today
when working on coverage for argparse. I'd like to again propose the removal
or modification of _get_args. I understand that it's there primarily to be
overridden, but e
New submission from Madison May:
Although the random module supports random sampling without replacement, there
is no support for random sampling with replacement. Efficient random sampling
with replacement is trivial using random.choice() (see below), but supporting
it as an optional
Madison May added the comment:
The patch LGTM as well.
ResourceWarning was silenced after applying patch when tested on my machine.
--
nosy: +madison.may
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
[Mark Dickinson]
> Both those seem like clear error conditions to me, though I think it would be
> fine if the second condition produced a ZeroDivisionError rather than a
> ValueError.
Yeah, in hindsight it makes sense that both of those conditions sho
Changes by Madison May :
--
components: +Library (Lib)
___
Python tracker
<http://bugs.python.org/issue18828>
___
___
Python-bugs-list mailing list
Unsubscribe:
Madison May added the comment:
The attached patch? :)
--
nosy: +madison.may
___
Python tracker
<http://bugs.python.org/issue18550>
___
___
Python-bugs-list mailin
Madison May added the comment:
It's obviously low priority, just thought I would mention it. I found it a bit
odd that "README" is used, though, since that means users will likely have to
select the program they want to use to open the file (in Windows, at least).
It might
Madison May added the comment:
"...to a string io object USING unittest.mock.patch()..."
--
___
Python tracker
<http://bugs.python.org/issue18856>
___
___
New submission from Madison May:
Just redirected stdout to a string io object unittest.mock.patch() to add basic
test coverage for calendar.py print functions (TextCalendary.prweek(),
TextCalendar.prmonth(), TextCalendar.pryear(), and format()).
--
components: Tests
files
New submission from Madison May:
Is there any reason (other than backwards compatibility) that the names of
README files are inconsistent?
README: 3 instances - root, /Mac, /Misc, /Tools
readme.txt: 2 instances - /PC, /PCbuild
README.txt: 1 instance - /Doc
--
assignee: docs@python
Madison May added the comment:
The docs page does mention, however, that Fraction inherits from
numbers.Rational, and links to that page
(http://docs.python.org/2/library/numbers.html#numbers.Rational). There the
properties 'numerator' and 'denominator' are clearly docu
Madison May added the comment:
I realize its probably quite early to begin putting a patch together, but
here's some preliminary code for anyone interested. It builds off of the
"common task" example in the docs and adds in validation for the weights list.
There are a few d
Madison May added the comment:
+1. I've found myself in need of this feature often enough to wonder why it's
not part of the stdlib.
--
nosy: +madison.may
___
Python tracker
<http://bugs.python.o
Madison May added the comment:
>From urllib.parse:
uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
'wais', 'file', 'https', 'shttp', 'mms',
Madison May added the comment:
Reversed doesn't make sense for all iterables.
>>> a = set([1, 2, 3])
>>> a = iter(a) # No error
>>> a = reversed(a) # Not typically desirable
The point is that not all iterables are necessarily ordered. And a reversed
functio
Madison May added the comment:
Or perhaps with an alternate wording: README_v4.diff
--
Added file: http://bugs.python.org/file31269/README_v4.diff
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
Good point, Éric.
It refers readers to the bug tracker, the Sphinx bug tracker, and
d...@python.org in the `Contributing` section, but a link to the devguide would
probably be more useful. I've tweaked the patch a bit to reflect this.
--
Added
Madison May added the comment:
Here's a patch that adds a short sentence to the README's `Documentation`
section that refers readers to the Doc/README.txt file.
--
nosy: +madison.may
Added file: http://bugs.python.org/file31267/READ
Madison May added the comment:
I ran into a similar issue (see #18700) with test_cgi.
``/home/mmay/cpython/Lib/test/test_cgi.py:276: ResourceWarning: unclosed file
<_io.BufferedRandom name=3>``
--
nosy: +madison.may
___
Python tracker
Madison May added the comment:
Good catch, Vajrasky. I'll close the issue and add my brief report to bug
#18394.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org
Changes by Madison May :
Added file: http://bugs.python.org/file31248/Issue18416_v2.patch
___
Python tracker
<http://bugs.python.org/issue18416>
___
___
Python-bugs-list m
Madison May added the comment:
Here's a minor revision to that patch removing an unnecessary
@skip_if_dont_write_bytecode decorator from the test I added to test_import.py.
No docs changes are included in the current patch -- I'm guessing this should
probably wait until we ha
Madison May added the comment:
> I'm currently leaning towards having sys.path_importer_cache store
> the actual directory name.
Exactly what I meant by "Creating a new entry in sys.path_importer_cache after
changing directories and importing a new module", but expressed
New submission from Madison May:
I'm currently running the tests on a 64-bit Ubuntu 13.04 laptop using the
default branch of python.
``/home/mmay/cpython/Lib/test/test_cgi.py:276: ResourceWarning: unclosed file
<_io.BufferedRandom name=3>``
--
components: Tests
messages:
Madison May added the comment:
I quickly ran the tests with each of the above edits to see what bits of the
test suite would break.
With option 1 (edits to PathFinder only):
``1 test failed:
test_importlib``
With option 2 (edits to FileFinder only):
``3 tests failed:
test_import
Madison May added the comment:
Nick, it was definitely a good thing to mention. I had to learn the "edit,
build, test" cycle the hard way my first time. It took me a good 15-20 minutes
to figure out why none of my edits seemed to change anything :)
Anyhow, here's how I se
Madison May added the comment:
Thanks for the heads up, Nick. I've worked with _bootstrap.py before, so I'm
familiar with the cycle.
--
___
Python tracker
<http://bugs.python.o
Madison May added the comment:
A few days ago I tried the change: ``self.path = path or _os.cwd()``, but the
problem didn't seem to resolve itself.
``./python -c "import blah; print(blah.__file__)`` still returned a relative
path on my system. The tie between FileFinder and th
Madison May added the comment:
Now with 100% more patch. Thanks for the catch, David.
--
keywords: +patch
Added file: http://bugs.python.org/file31157/ACKS_duplicates.patch
___
Python tracker
<http://bugs.python.org/issue18
New submission from Madison May:
The title says it all. I used collections.Counter to check for duplicates in
ACKS and cleaned up a few double entries.
--
assignee: docs@python
components: Documentation
messages: 194410
nosy: docs@python, madison.may
priority: normal
severity: normal
Madison May added the comment:
Yup, here are the relevant lines of the diff for PEP 3155:
@@ -568,7 +607,7 @@
func_repr(PyFunctionObject *op)
{
return PyUnicode_FromFormat("",
- op->func_name, op);
+ op->f
Madison May added the comment:
PathFinder or FileFinder? Changing PathFinder._path_importer_cache(cls, path)
seems to fix the issue.
See line 1302 in _bootstrap.py.
if path == '':
-path = '.'
+path = _os.getcwd()
$ touch blah.py; ./py
Madison May added the comment:
Yeah, that definitely qualifies as a good argument. I didn't consider the
legal issues that would create. Let's let this issue rest in peace, then.
--
___
Python tracker
<http://bugs.python.
Madison May added the comment:
This issue may have been dead for 3+ years, but perhaps it's time its brought
back to the surface. Aside from simple being convenient for general security
practices, a stdlib module for crypto routines would enable python to handle
encrypted zipfile
Madison May added the comment:
I agree -- it's not at all intuitive that the floor division returns a decimal
number of seconds, while float division raises an error. This should probably
be cleaned up.
In python 3.4, both float division and integer division return decimal number
Madison May added the comment:
Thanks, David. I like your changes -- sounds a lot cleaner and more explicit.
:)
--
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
No problem, Brett. Glad to hear you could get rid of those few last pesky
double quotes. I'm partial to the single quotes as well.
--
___
Python tracker
<http://bugs.python.org/is
Madison May added the comment:
Sounds good to me.
--
___
Python tracker
<http://bugs.python.org/issue18430>
___
___
Python-bugs-list mailing list
Unsubscribe:
Madison May added the comment:
*wouldn't
--
___
Python tracker
<http://bugs.python.org/issue18430>
___
___
Python-bugs-list mailing list
Unsubsc
Madison May added the comment:
Why would something like the following work?
#At the beginning of peek()
#keep track of prior offset
position = self.fileobj.tell()
#immediately before return statement
#restore previous fileobj offset
self.fileobj.seek(position)
--
nosy: +madison.may
Madison May added the comment:
Patch using all double quotes. Take your pick :)
--
Added file: http://bugs.python.org/file30894/all_double_quotes.patch
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
Patch using all single quotes for string literals, except for 3 cases of double
quoted strings that contain single quotes (I thought it was probably preferable
to escaping the single quotes).
--
keywords: +patch
nosy: +madison.may
Added file: http
Madison May added the comment:
Patch for 3.4 added. I tried to keep things short and sweet.
--
Added file: http://bugs.python.org/file30892/Issue18389_3-4.patch
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
Nope, definitely an error! Good catch, Xue.
--
nosy: +madison.may
___
Python tracker
<http://bugs.python.org/issue18403>
___
___
Madison May added the comment:
That could definitely be beneficial. I've attached a second patch with that
suggestion in mind. However, note that test_unittest is failing after adding
the isfile(start) check. I think its related to the large amount of mocking
that's ha
Madison May added the comment:
Whoops -- I forgot to actually upload the patch. Here it is.
--
keywords: +patch
Added file: http://bugs.python.org/file30833/relpath.patch
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
So the problem arises because a path to a file (not a path to a directory) is
passed as an argument to start. So the way I see it, we could go one of several
directions:
1) We could check for the presence of an extension in the start argument, and
truncate
Madison May added the comment:
I can imagine that would be incredibly frustrating -- it would drive me up the
wall as well.
Anyhow, glad to hear things looked good. I really appreciate your help guiding
me through this one.
--
___
Python tracker
Madison May added the comment:
Here's a preliminary attempt at a patch and a small set of test cases for
_get_sourcefile. I fixed one more spelling error in _get_sourcefile (bytcode
-> bytecode) and tweaked a bit of logic.
Instead of:
extension.lower()[-3:-1] != '.py'
Madison May added the comment:
Yet another _get_sourcefile() related bug to report. Line 453 should be:
source_path = bytcode_path[:-1]
instead of
source_path = bytcode_path[-1:]
--
___
Python tracker
<http://bugs.python.org/issue18
Madison May added the comment:
You might have to bear with me -- I'm a bit new to this. What's the protocol
for functions like _get_sourcepath() that require support files for testing?
I'll should probably have a couple .pyc's, .pyo's and .py files to use for
testin
Madison May added the comment:
I'd be glad to -- I'll get right to work =). On a related note, rpartition is
also misspelled in _get_sourcefile() on line 446.
--
___
Python tracker
<http://bugs.python.o
Madison May added the comment:
Here's a 5 character patch for the sake of completeness.
--
keywords: +patch
nosy: +madison.may
Added file: http://bugs.python.org/file30776/Issue18351.patch
___
Python tracker
<http://bugs.python.org/is
Madison May added the comment:
If the general consensus is that the APSG link should be removed, here's one
more patch for you.
--
Added file: http://bugs.python.org/file30775/apsg_removed.patch
___
Python tracker
<http://bugs.python.org/is
Changes by Madison May :
--
nosy: +madison.may
___
Python tracker
<http://bugs.python.org/issue18352>
___
___
Python-bugs-list mailing list
Unsubscribe:
Madison May added the comment:
Here's a potential patch for the issue, should we decide it's worth fixing.
All current tests pass with the update version of _splitnetloc(), and I've
added a test to test_urlparse to check that urls with '#' or '?' in the
Madison May added the comment:
My apologies -- that was an oversight on my part. Now that I look at the issue
again, it's plain that it most likely won't be an issue. Problems only arise
when you allow '#' to occur before '?' and then treat portion of the url
Madison May added the comment:
urllib.parse.urlsplit() in Python3.3 behaves the same way. Since urlsplit
takes an optional param "allow_fragments", I don't think it should be a high
priority issue.
The relevant code from Python3.3 is below, however:
if allow_fragments
Madison May added the comment:
So I've done a quick comparison of the two, and for the most part each entry is
an identical copy of the 2009 version. Some dated entries have been removed,
which I would consider a plus -- who realistically needs to know how to refer
to a 56K modems thes
Madison May added the comment:
I actually had a bit of a hard time even locating a copy of the 2009 version.
Thanks to the Wayback Machine, here's the 2009 version of the pdf for
reference:
http://web.archive.org/web/20121221004340/https://developer.apple.com/library/mac/document
Madison May added the comment:
Updated patch to link instead to http://help.apple.com/asg/mac.
Thanks for that catch, Dmi and Terry. I have to agree that its a much better
alternative.
--
Added file: http://bugs.python.org/file30457/apple_style_guide_v2.patch
Madison May added the comment:
The attached patch updates the urls on the Documenting and Doc Quality pages to
reference the new Apple Style Guide.
--
keywords: +patch
Added file: http://bugs.python.org/file30456/apple_style_guide.patch
___
Python
Changes by Madison May :
--
type: enhancement -> behavior
___
Python tracker
<http://bugs.python.org/issue18021>
___
___
Python-bugs-list mailing list
Unsubscri
New submission from Madison May:
The links at http://docs.python.org/devguide/documenting.html#building-doc and
http://docs.python.org/devguide/docquality.html to
http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf
lead to a "Pag
90 matches
Mail list logo