Steven Steven added the comment:
Kindly add a test for this issue
--
nosy: +stevensalbert
___
Python tracker
<https://bugs.python.org/issue21475>
___
___
Pytho
New submission from Steven Steven :
sue
--
messages: 315363
nosy: stevensalbert
priority: normal
severity: normal
status: open
title: Diethealth
___
Python tracker
<https://bugs.python.org/issue33
Steven Steven added the comment:
http://www.diethealthsupplements.com/
--
___
Python tracker
<https://bugs.python.org/issue33288>
___
___
Python-bugs-list mailin
New submission from Steven :
I have a package with a module called `commands.py`. This file is basically
three sub parsers and an entry point.
Here is one of my subparsers. It shows the current path of a config file, and
lets you update the path if you want.
#config sub-command
New submission from Steven:
Called subprocess.Popen("python_file.py", shell=True).wait(), which triggered a
call to `Base.metadata.create_all(engine)` inside `python_file.py`
This caused nothing after the `create_all(engine)` call to execute in
`python_file.py` But, if
Steven D'Aprano added the comment:
I agree that the rules regarding type and `__class__` and isinstance are
not clear or well documented.
We have:
https://docs.python.org/3/library/stdtypes.html#instance.__class__
https://docs.python.org/3/library/functions.html#isinstance
but ne
Steven D'Aprano added the comment:
On Fri, Dec 10, 2021 at 12:03:15AM +, Gabriele N Tornetta wrote:
> class Side(object):
> def __getattribute__(self, name):
> ValueError(name)
You forgot to actually *raise* the exception. That will just instantiate
the Value
Steven D'Aprano added the comment:
The plot thickens.
I was wrong to say that type() always and only looks at the "real" underlying
type of the instance. type() does look at __class__ as well. But only sometimes.
>>> class A:
... __class__ = int
...
>>
Steven D'Aprano added the comment:
Prompted by Guido's reopening of the ticket, I have given it some more thought,
and have softened my views. Jake if you're still around, perhaps there is more
to what you said than I initially thought, and I just needed fresh eyes to see
Steven D'Aprano added the comment:
> not complied with the PEP-8 formatting.
PEP 8 says:
"Some other good reasons to ignore a particular guideline:
3. Because the code in question predates the introduction of the guideline and
there is no other reason to be modifying that cod
Steven D'Aprano added the comment:
The function you use in exec is not a closure. The function:
def f():
return a
does not capture the top-level variable "a", it does a normal name lookup for
a. You can check this yourself by looking at f.__closure__ which you wi
Steven D'Aprano added the comment:
Here is the key phrase in the docs:
"If exec gets two separate objects as globals and locals, the code will be
executed as if it were embedded in a class definition."
https://docs.python.org/3/library/functions.html#exec
And sure enoug
Steven D'Aprano added the comment:
> I now want to define a closure with exec. I might want to do something like:
> exec("def f(): return a", globals(), locals())
That doesn't create a closure.
> I would expect f() to look for a in the locals().
I'm
Steven D'Aprano added the comment:
"Expected" is a strong word. It took me a lot of careful reading of the
documentation and experimentation to decide that, yes, I expect the
second case to fail when the first case succeeds.
Which reminds me of a common anecdote from math
Steven D'Aprano added the comment:
On Thu, Dec 23, 2021 at 12:15:29AM +, Eryk Sun wrote:
>
> Eryk Sun added the comment:
>
> > If exec gets two separate objects as globals and locals,
> > the code will be executed as if it were embedded in a
> >
Steven D'Aprano added the comment:
On Thu, Dec 23, 2021 at 05:47:33AM +, Eryk Sun wrote:
>
> Eryk Sun added the comment:
>
> > That's taken straight out of the documentation.
>
> Yes, but it's still a misleading comparison.
I asked how you wou
Steven D'Aprano added the comment:
Just use
if a == b == 1:
Comparisons can be chained arbitrarily.
https://docs.python.org/3/reference/expressions.html#comparisons
--
nosy: +steven.daprano
resolution: -> rejected
stage: -> resolved
status: ope
Steven D'Aprano added the comment:
float(x) performs rounding. Only if the value after rounding is out of range is
OverflowError raised.
M + 1, when correctly rounded to the nearest even float, gives
sys.float_info.max. Likewise for M+2, M+3 etc all the way to M+K where K equals
2
Steven D'Aprano added the comment:
The behaviour is correct and not a bug. Commas are not supported when
converting strings to float.
The allowed format for floats as strings is described in the docs:
https://docs.python.org/3/library/functions.html#float
By the way, the negative si
Steven D'Aprano added the comment:
Aside: for what it is worth, the British style with a middle dot is also not
supported: float('1·234') also raises ValueError.
--
___
Python tracker
<https://bugs.pyt
Steven D'Aprano added the comment:
> I still can not figure out why the first two elements are inconsistent
from the rest of the dictionary, and why they appear in the first place.
Hi Tobias,
This is a bug tracker for reporting bugs in Python, not a help desk to ask for
explanati
Steven D'Aprano added the comment:
Please try to provide a minimal reproducible example:
https://stackoverflow.com/help/minimal-reproducible-example
http://sscce.org/
At the very least, you need to provide three pieces of information:
1. What you tried.
2. What you expected to happen
Steven D'Aprano added the comment:
I think the existence of sys.getandroidapilevel is evidence that Android is
somewhat supported, even if it is not supported to the same degree that Linux
and Windows are.
https://docs.python.org/3/library/sys.html#sys.getandroidapilevel
See also:
New submission from Steven D'Aprano :
Do the print docs need to mention something so obvious?
Functions and methods which operate by side-effect typically don't mention that
they return None, see for example the docs for various builtin methods:
https://docs.python.org
Steven D'Aprano added the comment:
Sure, there will always be some users who will find certain things not
obvious. Sometimes I'm that user myself.
What did this user think print() returned? What precisely was their
question? Perhaps if I saw the conversation in context, I wou
Steven D'Aprano added the comment:
Serhiy is correct. The table is correct, \n can be found further down the
table, the first entry is backslash newline, as it says.
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: ope
New submission from Steven Wirsz :
Compiling source from github on January 6, 2022, detected via Libfuzzer &
UndefinedBehaviorSanitizer:
# ./fuzz_struct_unpack crash-a0d.txt
Running: crash-a0d.txt
/src/cpython3/Modules/_struct.c:509:28: runtime error: load of value 128, which
is n
Steven Wirsz added the comment:
Closing this report. I investigated the remaining issue and it looks like a
perfectly valid call to PyBool_FromLong:
/src/cpython3/Modules/_struct.c:509:28: runtime error: load of value 128, which
is not a valid value for type '_Bool'
stati
Steven D'Aprano added the comment:
> it returns IndexError (instead of "u") if used in a list comprehension
Works as expected inside a list comprehension:
>>> var = "u2"
>>> [var.strip()[0] for i in range(2)]
['u', 'u']
>
Steven D'Aprano added the comment:
Your functions test1 and test2 are irrelevant to the bug report. The driver
code using eval() to pick which function to call is unneeded. The business of
simulating a file is complexity for no purpose.
Those ignore, count, unique functions are
Steven D'Aprano added the comment:
Your module token.py "shadowed" the stdlib token.py, and prevented it from
being seen until you changed the name.
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: open -> closed
Steven D'Aprano added the comment:
Many docstrings are only 1 line without being "See base class." And many
docstrings are multiple lines while also referring the reader to see the parent
class for further details. So this DWIM heuristic to guess whether or not to
display
Steven D'Aprano added the comment:
It is better to raise each issue in its own ticket.
You seem to have three distinct issues here:
- The issue listed in the title, which I don't understand. A demonstration of
the issue would be helpful.
- The unrelated(?) issue of bad \N{} esca
Steven D'Aprano added the comment:
Hi mareklachbc,
What makes you think that this is a bug?
Since at least version 3.7, you will have seen this warning:
>>> import collections
>>> collections.Mapping
__main__:1: DeprecationWarning: Using or
Steven D'Aprano added the comment:
Did you look in setup.py in detect_modules() for the module's name to see what
was missing?
How do you know the curses dependencies have been installed? What dependencies
did you install?
--
nosy: +stev
Steven D'Aprano added the comment:
Dennis beat me to it in saying that tuples cannot be replaced by lists.
But I also wanted to say that it is *not true* that removing bracket symbols
would increase readability. Natural language allows parenthetical phrases --
which can be bracketed
Steven D'Aprano added the comment:
Please don't reopen this issue.
If you really want to take it to the Python-Ideas mailing list, you can:
https://mail.python.org/mailman3/lists/python-ideas.python.org/
or to Discuss:
https://discuss.python.org/c/ideas/6
--
status: open
Steven D'Aprano added the comment:
The difficulty is that frozenset may have been shadowed, or builtins
monkey-patched, so we cannot know what frozenset({1, 2, 3}) will return until
runtime.
Should we re-consider a frozenset display literal?
f{1, 2, 3}
works for me.
--
Steven D'Aprano added the comment:
Proposed on Python-Ideas.
https://mail.python.org/archives/list/python-id...@python.org/message/GRMNMWUQXG67PXXNZ4W7W27AQTCB6UQQ/
--
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
That's not always the case though.
>>> def f():
... return frozenset({1, 2, 3})
...
>>> a = f.__code__.co_consts[1]
>>> a
frozenset({1, 2, 3})
>>> b = f()
>>> assert a == b
>>>
Steven D'Aprano added the comment:
That's not a bug.
https://docs.python.org/3/library/pydoc.html
"If there is no docstring, pydoc tries to obtain a description from the block
of comment lines just above the definition of the class, function or method in
the source file, o
Steven D'Aprano added the comment:
As documented, this is not a bug.
"if two multiples are equally close, rounding is done toward the even choice"
https://docs.python.org/3/library/functions.html#round
This is also called "Banker's Rounding" or "Round h
Steven D'Aprano added the comment:
You say: "The documentation says ..." but don't tell us which documentation.
This documentation:
https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements
tells us that augmented assignment is assign
Steven D'Aprano added the comment:
I don't understand why math.ceildiv couldn't ducktype. There's no rule that
says it *must* convert arguments to float first, that's just a convention, and
we've broken it before.
>>> math.prod([Fraction(1, 3), 7])
Fra
Steven D'Aprano added the comment:
Decimal is a good question.
Why does floor division not do floor division on Decimal? The
documentation says
The integer division operator // behaves analogously, returning the
integer part of the true quotient (truncating towards zero) r
Steven D'Aprano added the comment:
If we can't change the default behaviour of copying functions, can we
add a specialised copy_function() function, for when we really need to
make a genuine copy?
--
___
Python tracker
<https://bu
Steven D'Aprano added the comment:
I'm sorry, I don't see why you think this will improve code readability. I also
expect it will be harder to teach than the current code.
open("file.img", "wb") just needs the user to learn about reading and writing
files
Steven D'Aprano added the comment:
True, but you did say it would be with the io module in your original
suggestion.
--
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
This is not a bug, Python is working correctly here. The interpreter is doing
exactly what you told it to do, and then raising a RecursionError before you
can crash the system.
You have a property instance.bar which returns instance.bar, which re
Steven D'Aprano added the comment:
Maybe you expected to do this:
class C:
def __init__(self):
self._value = 999
@property
def bar(self):
return self._value
obj = C()
obj.bar # returns 999
--
___
Python tr
Steven D'Aprano added the comment:
Replicated on Linux, Python 3.10.
It looks like mousewheel scrolling jumps by the wrong amount as it pages down
(or up), and consequently some lines never appear in the view area.
I ran a slightly modified version of the code that had 16 entries inste
Change by Steven D'Aprano :
--
Removed message: https://bugs.python.org/msg413566
___
Python tracker
<https://bugs.python.org/issue46803>
___
___
Pytho
Change by Steven D'Aprano :
--
Removed message: https://bugs.python.org/msg413567
___
Python tracker
<https://bugs.python.org/issue46803>
___
___
Pytho
Change by Steven D'Aprano :
--
Removed message: https://bugs.python.org/msg413568
___
Python tracker
<https://bugs.python.org/issue46803>
___
___
Pytho
Change by Steven D'Aprano :
--
nosy: -xiaox55066
___
Python tracker
<https://bugs.python.org/issue46803>
___
___
Python-bugs-list mailing list
Unsubscr
Change by Steven D'Aprano :
Removed file: https://bugs.python.org/file50635/6.jpeg
___
Python tracker
<https://bugs.python.org/issue46803>
___
___
Python-bugs-list m
Steven D'Aprano added the comment:
Works for me in Python 3.10.0 on Linux.
After running your code, I get shared_dict is a DictProxy:
>>> shared_dict
>>> list(shared_dict.items())
[('number', 0), ('text', 'Hello World')]
and shared_lo
Steven D'Aprano added the comment:
> Both arguments `aliased` and `terse` should be boolean instead of integer.
Why should they be strictly True/False booleans? I disagree strongly that they
should be. Any object that duck-types as a true or false value is sufficient.
Trea
New submission from Steven D'Aprano :
There is a long-standing tradition, going back to Python 1.x days before we had
dedicated True and False values, to use the lowercase "true" and "false" to
mean *any value that duck-types as True* and *any value that duck-type
Steven D'Aprano added the comment:
See #46883
--
___
Python tracker
<https://bugs.python.org/issue46882>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
Note also that this is mentioned here:
https://docs.python.org/3/library/stdtypes.html#boolean-values
"[True and False] are used to represent truth values (although other values can
also be considered false or true)."
although it is perha
Steven D'Aprano added the comment:
> The "spawn" method requires pickling the data and callable passed to
> the child proces, and that's not supported for lambda's.
Ah, today I learned something. Kyle, looks like you were right about it
being due to the lambd
Steven D'Aprano added the comment:
Oops, replying by email reopens the ticket. Back to pending you go!
--
status: open -> pending
___
Python tracker
<https://bugs.python.org
Steven D'Aprano added the comment:
> Personally I'd prefer a new exception `StackOverflow` to `MemoryError`
+1 on a new exception (presumably a subclass of MemoryError).
How about using OverflowedStack instead?
The situation is not quite as bad as you suggest. Googling for &q
New submission from Steven Vereecken:
The check for DB_RECNO seems to do the opposite of what it's supposed to do:
def append(self, value, txn=None):
if self.get_type() != db.DB_RECNO:
self.append = self.__append
return self.append(value, tx
Steven Bethard added the comment:
Sorry about being out of contact (I'm flying back and forth between the US and
the EU every 4-5 weeks right now), and thanks Terry for bringing this to my
attention.
Essentially, the API is:
* The argument to action= must be a callable that accepts at
Steven Bethard added the comment:
Can you submit some example code that shows this? I can't reproduce this with:
-- temp.py --
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--ng", action="store_true")
parser.ad
Steven Bethard added the comment:
Could you add a test to verify that custom actions are still getting the
converted values passed to their __call__? I suspect this may not be happening
under the current patch - if that's the case, you may also need to add
conversions in _get_values,
Steven Bethard added the comment:
Looks good to me too.
--
___
Python tracker
<http://bugs.python.org/issue10772>
___
___
Python-bugs-list mailing list
Unsub
Steven Bethard added the comment:
The ArgumentParser constructor is definitely only intended to be called with
keyword arguments, so it's definitely a documentation bug that it doesn't say
this. I haven't actually applied the patch, but the basic approach and wording
Steven Bethard added the comment:
I think http://bugs.python.org/issue12776, which delays type conversions on
defaults should solve this problem, right? If you agree, could you add your
code here as a test case to that issue and mark this as duplicate?
(And yes, I agree this is a bug
Steven Bethard added the comment:
I'd feel more comfortable with the argparse fix if it were simply calling
"os.get_terminal_size()". I recommend that you:
* Create a new issue called, say "add os.get_terminal_size()" proposing just
the single method.
* Add that iss
Steven Bethard added the comment:
As I understand it the current proposal is:
* Wrap each paragraph separately
* Don't wrap any lines indented by at least one additional space
This sounds like a useful formatter. I would probably call it
"PargraphWrappingFormatter" or some
Steven Bethard added the comment:
If you can make your patch relative to the cpython source tree, and add a
couple tests, it will be easier to review.
Thanks for working on this!
--
___
Python tracker
<http://bugs.python.org/issue9
Steven Bethard added the comment:
Your solution is actually the current recommended solution - mix together both
classes that you want to combine and pass your subclass as the parameter. This
should probably be documented somewhere (and tested more
Steven Bethard added the comment:
Modulo the comments already on the patch by others, this approach looks fine to
me.
--
___
Python tracker
<http://bugs.python.org/issue12
Steven Bethard added the comment:
Could you give some examples of bugs that you observed? Otherwise, this looks
like a duplicate of issue 9349.
The intention is that help=SUPPRESS should cause the given argument to not be
displayed in the help message. If there are cases where that'
Steven Bethard added the comment:
I agree that this is a bug in current argparse formatting.
It might be a little difficult to fix though because the current option
formatting handles arguments one at a time, and producing something like [arg1
[arg2]] requires some understanding of how
Steven Bethard added the comment:
%(prog)s is available in epilog:
-- temp.py --
import argparse
epilog = """\
Example usage:
%(prog)s option1 option2
"""
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHe
Steven Bethard added the comment:
Looks good to me.
--
___
Python tracker
<http://bugs.python.org/issue9938>
___
___
Python-bugs-list mailing list
Unsubscribe:
Steven Bethard added the comment:
I think Issue 12776, which delays type conversions on defaults, should solve
this problem, right? If you agree, could you add your code here as a test case
to that issue and mark this as duplicate?
--
___
Python
Steven Bethard added the comment:
I agree this is a bug. The patch needs to add unit tests that make sure
metavars with [] work as expected.
--
___
Python tracker
<http://bugs.python.org/issue11
Steven Bethard added the comment:
Looks good. A few minor comments (click "review" by the patch).
--
___
Python tracker
<http://bugs.python.o
New submission from Steven Bethard :
There is an undocumented value for add_argument's nargs parameter, REMAINDER,
which can be used to consume all the remaining arguments. This is commonly
useful for command line utilities that dispatch to other command line utilities.
Though undocum
Steven Bethard added the comment:
Closing then. Thanks for checking it again!
--
assignee: -> bethard
resolution: -> works for me
stage: -> committed/rejected
status: open -> closed
___
Python tracker
<http://bugs.python
Steven Bethard added the comment:
Eric's suggested doc fix looks good to me.
--
___
Python tracker
<http://bugs.python.org/issue13685>
___
___
Python-bugs-l
New submission from Steven D'Aprano :
Functions with docstrings which were created with partial are not run by
doctest.testmod().
See the test script, which prints:
Expected 1 failure from 2 tests, but got 0 from 0.
--
files: partial_doctest.py
messages: 142512
nosy: ste
Steven D'Aprano added the comment:
I'm not sure if this belongs here, or on the Google code project page, so I'll
add it in both places :)
Feature request: please change the NEW flag to something else. In five or six
years (give or take), the re module will be long forgotten
Steven D'Aprano added the comment:
Matthew Barnett wrote:
> Matthew Barnett added the comment:
>
> I think I need a show of hands.
>
> Should the default be old behaviour (like re) or new behaviour? (It might be
> old now, new later.)
>
> Should there be a NE
Steven D'Aprano added the comment:
Ezio Melotti wrote:
> Ezio Melotti added the comment:
>
> Also note that some behaviors are not "old" or "compatible", but just
> different. For example why inline flags should be the old (or new) behavior?
> Or
Steven D'Aprano added the comment:
Matthew Barnett wrote:
> So, VERSION0 and VERSION1, with "(?V0)" and "(?V1)" in the pattern?
Seems reasonable to me.
+1
--
___
Python tracker
<h
Steven Bethard added the comment:
This is closely related to issue 9338. The parser should know that your command
line requires at least the COMMAND argument, so it should stop parsing in time
for that. However, in the case of subcommands, even if we solved issue 9338,
you would still get
Changes by Steven Bethard :
--
nosy: +bethard
stage: -> needs patch
versions: +Python 2.7, Python 3.2 -Python 2.6
___
Python tracker
<http://bugs.python.org/iss
Steven Bethard added the comment:
A simpler approach might be to do this before your call to parse_args:
if len(sys.argv[0]) == 1:
parser.print_help()
Does that solve your problem?
--
___
Python tracker
<http://bugs.python.org/issue9
Steven Bethard added the comment:
Sorry, typo. Should have been len(sys.argv) == 1. Full script:
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument('--foo')
if len(sys.argv) == 1:
parser.print_help()
else:
print(parser.parse_args())
With t
Steven Bethard added the comment:
I see. When there are no arguments you basically want to replace the standard
argparse help entirely with your own message, with your own capitalization,
etc. What you're doing now looks like a pretty good approach for this, so I
guess I'm still
Steven Bethard added the comment:
Yeah, I guess the optional vs. positional isn't the best terminology now that
you can have required flag-based arguments. Did you have a word other than
"optional" that you'd prefer?
--
___
P
Steven Bethard added the comment:
I guess one possibility might be "flag arguments". It's not great, but I guess
it's more accurate.
--
___
Python tracker
<http://bu
Steven Bethard added the comment:
And I guess the bigger issue to think about is how to add this in a backwards
compatible way. I guess we could just add methods like
"set_positionals_group_name(name)" and then fiddle with
"self._positionals.title" in there. Not sure tha
Steven Bethard added the comment:
Looks like "usage" is almost always lowercase in the programs I tried (ssh,
svn, cat, etc.). So it probably wouldn't be a good idea to change the default.
Seems like both this and issue 9694 need a better way to customize the text in
argparse
1 - 100 of 1942 matches
Mail list logo