Ram Rachum added the comment:
Hi Vinay,
Since it's been a couple of years since I opened this ticket, I can't tell you
the case in which I wanted to know the full module name of a logger. But it's
probably been a logger from a third-party library. Since I can't force a
third-party library
New submission from Krishna Ram Prakash R :
By passing a malformed string as input to marshal.loads() an attacker can
trigger a null pointer dereference resulting in DoS.
This happens because when a Python object is unmarshalled by reference, it is
assumed that the target object is fully
To: Steven D'Aprano
From: "Stefan Ram"
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>It has been a long, long time since Python has been a "simple" language
>suitable for rank beginners, if it ever was. Python is not Scr
To: Stefan Ram
From: r...@zedat.fu-berlin.de (Stefan Ram)
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Still, one must not forget that learning Python encompasses
>all the hard work it takes to learn how to program in every
>language.
"Beginner", however, is a very
To: Richard Damon
From: "Stefan Ram"
To: Richard Damon
From: r...@zedat.fu-berlin.de (Stefan Ram)
Richard Damon writes:
>Now, if I have a parser that doesn't use the locale, but some other rule
>base than I just need to provide it with the right rules, which is
>basi
To: Stefan Ram
From: "Stefan Ram"
To: Stefan Ram
From: r...@zedat.fu-berlin.de (Stefan Ram)
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>def f():
>def g():
>g.x += 1
>return g.x
>g.x = 0
>return g
Or, "for all g to sha
To: Steven D'Aprano
From: "Stefan Ram"
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>def f():
>static x = 0
>def g():
>x += 1
>return x
>return g
What one can do today:
main.py
def g():
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>It has been a long, long time since Python has been a "simple" language
>suitable for rank beginners, if it ever was. Python is not Scratch.
Python is simpler insofar as you can write o
To: Richard Damon
From: r...@zedat.fu-berlin.de (Stefan Ram)
Richard Damon writes:
>Now, if I have a parser that doesn't use the locale, but some other rule
>base than I just need to provide it with the right rules, which is
>basically just defining the right locale.
Here's an
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>def f():
>static x = 0
>def g():
>x += 1
>return x
>return g
What one can do today:
main.py
def g():
g.x += 1
return g.x
g.x = 0
print( g() )
To: Stefan Ram
From: r...@zedat.fu-berlin.de (Stefan Ram)
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>def f():
>def g():
>g.x += 1
>return g.x
>g.x = 0
>return g
Or, "for all g to share the same x":
main.py
def f():
Cai Gengyang writes:
Statement 0:
>count = 0
Statement 1:
>if count < 5:
> print "Hello, I am an if statement and count is", count
Statement 2:
>while count < 10:
> print "Hello, I am a while and count is", count
> count += 1
There are three statements
Ram) (Stefan Ram)
Greg Tibbet <gtibbe...@msn.com> writes:
>I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
>of Java and trying to learn this new-fangled Python language!
Which actually is older than Java.
>def ellipse(self, xy, fill=None, outline=None):
&
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Then you can use pickle or custom methods to save and
>restore the object, or get the state from an iterator
>and create a new iterator with that state later.
One does not always have to write a custom class,
for example:
main.py
impo
Greg Tibbet writes:
>I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
>of Java and trying to learn this new-fangled Python language!
Which actually is older than Java.
>def ellipse(self, xy, fill=None, outline=None):
>"""Draw an ellipse."""
>
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Then you can use pickle or custom methods to save and
>restore the object, or get the state from an iterator
>and create a new iterator with that state later.
One does not always have to write a custom class,
for example:
main.py
impo
Greg Tibbet writes:
>I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
>of Java and trying to learn this new-fangled Python language!
Which actually is older than Java.
>def ellipse(self, xy, fill=None, outline=None):
>"""Draw an ellipse."""
>
New submission from Ram Rachum:
LogRecord currently supplies `module` that you can show in your messages, but
it's just the name of the module without the path. It'll be nice to have
`full_module_name` that has the qualified name (e.g. foo.bar.baz instead of
baz.)
Usually it's the logger's
Changes by Ram Rachum <r...@rachum.com>:
--
type: -> behavior
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28953>
___
___
New submission from Ram Rachum:
I had this error come up in my code, and because it doesn't use `raise ...
from` I thought that the second error was unexpected, while in fact it wasn't.
This patch should fix that.
--
components: Library (Lib)
files: 1.patch
keywords: patch
messages
Changes by Ram Rachum <r...@rachum.com>:
--
versions: +Python 3.7 -Python 3.6
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
New submission from Ram Rachum:
I have a a PurePath object like so:
path = PurePath('/home/my awesome user/file.txt')
I'm SSHing into a server and I want to remove the file. So I have to do this:
ssh_client.run(f'/bin/rm {shlex.quote(str(path))}')
Which is really long and ugly
Ram Rachum added the comment:
I understand now, you're completely right. This change would break the entire
world :)
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Ram Rachum added the comment:
"This will break any code that pass str(path) to API that doesn't support
pathlib."
I don't understand. Can you give a concrete example of code it would break?
--
___
Python tracker <rep...@bugs.pyth
New submission from Ram Rachum:
I have a a PurePath object like so:
path = PurePath('/home/my awesome user/file.txt')
I'm SSHing into a server and I want to remove the file. So I have to do this:
ssh_client.run(f'/bin/rm {shlex.quote(str(path))}')
Which is really long and ugly
Changes by Ram Rachum <r...@rachum.com>:
--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Make the `cwd` argument to `subprocess.Popen` accept a `PathLike`
versions: Python 3.7
___
Python tracke
Changes by Ram Rachum <r...@rachum.com>:
--
type: -> enhancement
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28624>
___
___
New submission from Ram Rachum:
Currently it complains that you haven't fed it a string-like object.
--
components: Library (Lib)
messages: 280133
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Let `shlex.quote` accept a `PathLike` object
type: enhancement
versions
Changes by Ram Rachum <r...@rachum.com>:
--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Support creating hardlink using `pathlib`
type: enhancement
versions: Python 3.7
___
Python tracke
Ram Rachum added the comment:
Thanks.
--
resolution: -> wont fix
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Ram Rachum added the comment:
I mean that `/foo` is one of the parent directories.
"there are plenty of options ..." Can you please spell them out precisely? The
full line of code.
--
___
Python tracker <rep...@bugs.pyth
New submission from Ram Rachum:
Today I had to check whether a path object started with `/foo`. The nicest way
I could think of was `str(p).startswith('/foo')`. What do you think about
implementing `p.startswith('/foo')`?
--
components: Library (Lib)
messages: 279699
nosy: cool-RR
Ram Rachum added the comment:
Thanks for the quick fix Vinay!
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28335>
___
___
Pyth
Ram Rachum added the comment:
Thanks for the patch sreyas! Maybe we should also take this opportunity to
remove the string formatting from the exception that shows the name of the
original exception? Because when you think about it, it's just a poor man's
`raise from
Ram Rachum added the comment:
You're right Vinay: I missed that first traceback because I wasn't running code
in the console, I was running it with a debugger. (I'll ask my debugger vendor
to maybe include these extra tracebacks.)
But in any case, I think that the correct way to raise would
Ram Rachum added the comment:
I now see similar raises that could use a `from` in other places in this
module, so I'd suggest going over the module and putting `from`s all over the
place.
--
___
Python tracker <rep...@bugs.python.org>
New submission from Ram Rachum:
In `logging.config.DictConfigurator.configure`, there are exceptions that are
caught and then replaced with `ValueError` exceptions. I think you should use
the `raise x from y` syntax so that the original tracebacks will be preserved.
(I'm debugging
New submission from Ram Rachum:
Both `WeakKeyDictionary` and `WeakValueDictionary` have opaque `__repr__`
methods:
>>> x = weakref.WeakKeyDictionary({object: 2, type: 4,})
>>> x
>>> dict(x)
{: 4, : 2}
This makes it annoying to view them at a glance. Is there a re
New submission from Ram Rachum:
I had a code that would freeze, and after debugging I realized that a bug in my
code caused `shlex.split(None)` to be called, which puts Python in an infinite
loop.
We probably want to do an `if not isinstance(s, ...): raise TypeError('Bla
bla')` at the start
New submission from Ram Vallury:
'module' object has no attribute 'SIGALRM'
SIGALRM is not identified in windows, python 2.7.
There is no explicit mention of this in documentation as well.
===
$ python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit
(Intel
Ram Vallury added the comment:
added space before word portnumber. column space adjusted
--
Added file: http://bugs.python.org/file44055/smtpd_doc_updated_3.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Ram Rachum added the comment:
I meant the mathematical definition.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27181>
___
___
Ram Rachum added the comment:
Also... I like the detailed docstrings with the real-life examples! That stuff
helps when coding and using an unfamiliar function (since I see the docs in a
panel of my IDE), so I wish I'd see more detailed docstrings like these ones in
the standard library
Ram Rachum added the comment:
Thanks for the patch Steven! I won't comment about the code because I don't
know enough about these algorithms, but I'm thinking, since you also did a
refactoring of the statistics module, maybe these should be two separate
patches/commits so it'll be easy to see
Ram Vallury added the comment:
Submitting patch 2 for smtpd doc changes
--
Added file: http://bugs.python.org/file44047/smtpd_doc_updated_2.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Ram Vallury added the comment:
Updated the documentation of smtpd.
https://docs.python.org/3/library/smtpd.html#smtpserver-objects
* this is my first patch, please revert back to me or make learn if I do any
mistake*
--
keywords: +patch
nosy: +rvallury
Added file: http
Ram Rachum added the comment:
Okay, but consider that if there are no tests, this code will never be run
during testing. Consider that if there's a bug in that code that causes an
exception to be raised (unlikely, I know, but maybe from the call to
getLevelName) it won't be discovered until
Ram Rachum added the comment:
If you want, I can implement them.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27650>
___
___
Ram Rachum added the comment:
Vinay: Looks good to me. What do you think about adding tests?
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Ram Rachum added the comment:
Well, I guess we had a fun week exchanging a couple thousand words about a
two-line change to the docs that's now never going to happen ;)
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.p
Ram Rachum added the comment:
Hmm. What do you think about merging 3.patch now, and then possibly adding more
information later? (Or asking the people who are designing the complex behvior
you describe to write those docs.)
--
___
Python tracker
New submission from Ram Rachum:
A while ago I was debugging through code that uses the `logging` module, and I
was looking at `Logger` objects and possibly other kinds of objects (maybe
handlers? It was a while ago.)
I was frustrated because I was trying to figure out what a particular logger
Ram Rachum added the comment:
Hi David,
I attached a patch that follows your instructions, but to be honest, if I
wasn't the person writing this patch and I wanted to find the information "Does
Python do any optimization besides dumping asserts when I do -O?" I'm not sure
I
Ram Rachum added the comment:
I uploaded a new patch.
I added another thing: Mentioning explicitly that no other optimizations are
currently being made. I think this is important because it's often the question
that the user is asking themselves. (At least my boss and team members have
asked
Ram Rachum added the comment:
I'm sorry everyone, for being unpleasant on this thread. Rereading the thread
from the beginning, I think I misunderstood Brett's message and immediately saw
it as someone trying to block my efforts rather than just answering the
question I asked.
Anyway, I
Ram Rachum added the comment:
Thanks for your understanding David.
I'll submit a patch for this issue soon.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Ram Rachum added the comment:
Yes, my comment was antagonistic. I'm baffled that the first response to
someone who wants to contribute to Python is an esoteric argument against the
contribution. I understand that sometimes not all contributions can be accepted
because they break existing
Ram Rachum added the comment:
So... The reasoning is that if someone adds optimizations to Python's `-O` mode
(Something that hasn't happened in the last decade or two, right?) we want to
save them from going to the trouble of writing two or three sentences in the
docs describing
New submission from Ram Rachum:
I wanted to ensure that the `-O` flag doesn't really do anything more than
remove assert statement and make `__debug__` equal `False`. But the
documentation for `-O` doesn't cover it:
https://docs.python.org/3/using/cmdline.html#cmdoption-O
https
New submission from Ram Rachum:
I saw these new interesting classes in the `traceback` docs, but if I were
shown an example of how they are used, I might get inspired to use them in my
own code.
--
assignee: docs@python
components: Documentation
messages: 271072
nosy: cool-RR, docs
New submission from Ram Rachum:
My mistake
--
resolution: -> not a bug
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by Ram Rachum <r...@rachum.com>:
--
assignee: docs@python
components: Documentation
nosy: cool-RR, docs@python
priority: normal
severity: normal
status: open
title: docs for `gc.get_referrers` should explain the result format (i.e. what
keys in the dict mean)
versions:
Ram Rachum added the comment:
And of course, if the goal of the `statistics` module is to be comprehensive,
one should ask himself what should be the difference between this new module
and a mature statistics module like `scipy.stats`, and whether we should try to
copy the features of off
Ram Rachum added the comment:
To complicate things further...
I implemented a geometric mean on my own, and then I figured out what I really
want is a *weighted* geometric mean, so I implemented that for myself. If you'd
want to include that, that'll be cool. Actually I'm not sure if the goal
Changes by Ram Rachum <r...@rachum.com>:
--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Add geometric mean to `statistics` module
type: enhancement
versions: Python 3.6
___
Python tracke
Changes by Ram Rachum <r...@rachum.com>:
--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement pathlib.Path.link (Using os.link)
versions: Python 3.6
___
Python tracker <rep...@bugs.p
Ram Rachum added the comment:
Agreed on keywords-only.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26128>
___
___
Python-bugs-
New submission from Ram Rachum:
Right now when you want to use `subprocess.STARTUPINFO`, you need to do
something like this:
si = subprocess.STARTUPINFO()
si.dwFlags = subprocess.STARTF_USESTDHANDLES
subprocess.Popen(['whatever'], startupinfo=si)
It would be much nicer to do
Ram Rachum added the comment:
Here's an alternate idea I thought of now. Maybe `path.path` should be a
pointer to the same `Path` object, so every function will do this:
str(arg.path) if hasattr(arg, 'path') else arg
What I like about this is that it avoids having the path argument
Ram Rachum added the comment:
I thought about it some more, and personally I'd prefer each function to do
`str(path)` internally rather than `if hasattr(p, 'path'): p = p.path`. Even if
it means we'll have to deal with "where did that file named '' come from?!" errors. I think i
New submission from Ram Rachum:
Today I spent 30 minutes because of weird behavior of `finally` when it has a
`break` statement inside of it. (The behavior is that the exception gets
suppressed, which I found unexpected.) I think this behavior should be
documented.
Example:
c
Ram Rachum added the comment:
Right, so it might be garbage-collecting the items before the futures are done
being created, so the whole list wouldn't need to be saved in memory. I
understand now.
--
___
Python tracker rep...@bugs.python.org
http
Ram Rachum added the comment:
I'm seeing a similar problem with `move_to_end` and its `last` keyword argument.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24394
Ram Rachum added the comment:
A problem I just realized with Brian's 2-line implementation of `filter`: It
doesn't work for iterables which aren't sequences, since it attempts to exhaust
the iterable twice. So if you have a non-sequence you'll have to make it into a
sequence first
New submission from Ram Rachum:
Python 3.5.0b2 (v3.5.0b2:7a088af5615b, May 31 2015, 06:22:19) [MSC v.1900 64
bit (AMD64)] on win32
Type help, copyright, credits or license for more information.
import collections
Changes by Ram Rachum r...@rachum.com:
--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement `http.client.HTTPMessage.__repr__` to make debugging easier
type: enhancement
versions: Python 3.5
Ram Rachum added the comment:
Regarding a unified `__repr__`: Sounds good. What I needed is to know whether
there are any headers in there or not. So the number of headers, or the first
2-3, would have solved my problem.
--
___
Python tracker rep
Ram Rachum added the comment:
Raymond: Thank you. So the discussion is back on adding a recipe to the docs.
Brian: When I said possible issues, I followed that with a couple of issues
with the example I uploaded (filter_example.py).
--
___
Python
New submission from Ram Rachum:
I was trying to read this page:
https://www.python.org/dev/peps/pep-0492/#acceptance
On my mobile. (Nexus 5, chrome.) But when scrolling down the page, the browser
sometimes scrolls up to the top of the page. This makes reading very annoying
because I have
Ram Rachum added the comment:
Looks like this a recipe in the docs is where this ticket is headed.
I took my original example for `Executor.filter` and changed it using Brian's
suggestion so now it uses `Executor.map`. Please check it out. If someone other
than me feels comfortable in putting
Ram Rachum added the comment:
Okay, let me understand what the opinions of people are about this feature.
Ram Rachum: +1
Antoine Pitrou: -1
Nick Coghlan: Is that a +1 or a +0?
Ethan and Paul, you've participated but I didn't get your opinion on whether
you want to see this feature go
Ram Rachum added the comment:
Patch with documentation attached. (I don't know how to concatenate patches, so
2.patch contains only the documentation, while 1.patch has the implementation
and the tests (but Ethan's patch is better.))
Brian, regarding your simpler implementation based
Ram Rachum added the comment:
Also, I notice Python 3.5 feature freeze is a bit over a week away, and I hope
we can get that in so it could go in Python 3.5. (Assuming it goes in at all.)
--
___
Python tracker rep...@bugs.python.org
http
New submission from Ram Rachum:
`Executor.filter` is to `filter` what `Executor.map` is to `map`.
See Python-ideas thread:
https://groups.google.com/forum/#!topic/python-ideas/EBOC5YCWPyo
Patch attached. I don't know how to run the Python test suite (I'm guessing it
involves building Python
Ram Rachum added the comment:
Looking forward to your patch Ofer! Thanks for working on this!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18162
Ram Rachum added the comment:
ztane: I don't think so. You're taking attention away from the and
keyword-only arguments, where in fact this is the piece of information that's
likely to save the user the most time, so therefore it should get more
attention
Hello,
I already have a script that plots a polygon. But now I'm trying to script
a python class that would enable me to import the previous plot , make
instances and control it too(like specifying parameters like spacing , width,
height or the like). My approach was, to create a new
Ram Rachum added the comment:
Hi everyone,
Just wanted to follow up here that I've created my own dedicated bag class.
Documentation: https://combi.readthedocs.org/en/stable/bags.html
Install using `pip install combi`
It's packed with features. There are a ton of arithmetic operations
Ram Rachum added the comment:
Thanks for the fix Ethan. Will you also push this to the backport on PyPI?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
Ram Rachum added the comment:
Thanks!
Two questions:
1. Is there a GitHub repo for enum34? Couldn't find a link to it on the PyPI
page.
2. Aren't 'name' and 'value' already included in `added_behavior`?
--
___
Python tracker rep
Ram Rachum added the comment:
Also, aren't you excluding a lot of important magic methods from that `dir`?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
New submission from Ram Rachum:
The builtin `property` lets you specify a `doc` argument for your properties,
which is great because then it shows up in `help`. So I figured that when I'm
writing my own descriptor, I could set `__doc__` on it and have `help` use it.
Not so, `help` ignores
New submission from Ram Rachum:
When programming, I just got this exception:
builtins.TypeError: my_func() takes 1 positional argument but 2 were given
After a couple of minutes of investigation I figured out that the problem is
that the function has a `*` in its signature, so arguments
Ram Rachum added the comment:
(I should note that I see this suggestion as low-priority, because it's very
specific, so I'll completely understand if it's deemed to not be worth the
added complexity.)
--
___
Python tracker rep...@bugs.python.org
Ram Rachum added the comment:
I agree with Brett. Making old functions support `Path` sounds trivial to me,
and I don't think there are any backward compatibility issues. Having to do
str(path) every time you call a function is ugly. So I think that all stdlib
functions that currently take
Ram Rachum added the comment:
Fine, so you add an `if isinstance...` in front of it and you're done.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22570
Ram Rachum added the comment:
Georg: You're right, I forgot about C modules which make this not as trivial as
I thought.
As for Python modules: If there's general agreement that this is a feature we
want, I'll be happy to make a patch for the `zipfile` module to accept `Path`
arguments
Ram Rachum added the comment:
Ethan: I'm very confused by your example. `huh` isn't even a method, why would
it be included? Or are you saying if it was a method? I'm really not sure
what your example is adding over mine, given that it's 10 times longer and more
complex. I'm not sure why
Ram Rachum added the comment:
Mark, I prefer to leave this to someone else.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18043
___
___
Python
Ram Rachum added the comment:
I don't really understand the refactoring. For example why is `len(self) =
len(other)` needed? For which case? Note that `len` would also catch keys with
`0` value which shouldn't have an effect.
--
___
Python tracker
101 - 200 of 444 matches
Mail list logo