On Mon, Jun 29, 2020 at 12:34 PM Nathaniel Smith wrote:
> On Mon, Jun 29, 2020 at 2:31 AM Steve Holden wrote:
> > The commit message used, however, reveals implementation details of the
> change which are irrelevant to the stated aim, which is making the
> documentation clear and concise. Use
From:
https://github.com/python/peps/commit/0c6427dcec1e98ca0bd46a876a7219ee4a9347f4
> Instead of requiring that comments be written in Strunk & White Standard
English, require instead that English-language comments be clear and easily
understandable by other English speakers. This accomplishes
When dealing with C extensions from Python there are circumstances
where a function is called and we get an OSError(errno) exception
without knowing what exactly went wrong internally. This is especially
not obvious on Windows, where multiple MSDN APIs may be invoked within
the same C function and
On Sun, Mar 24, 2019 at 2:29 PM Anders Hovmöller wrote:
>
> Have you checked how much overhead the two functions have? That seems like an
> obvious way this proposal could go south.
Without patch:
$ ./python -m timeit -s "import os" "os.times()"
50 loops, best of 5: 546 nsec per
It turns out we could use resource.getrusage() which provides micro
seconds (tested on Linux and macOS):
import os, resource
for x in range(1000): # warm up
pass
for x in range(5):
a = os.times()
b = resource.getrusage(resource.RUSAGE_SELF)
On Wed, Mar 20, 2019 at 11:19 PM eryk sun wrote:
>
> On 3/18/19, Giampaolo Rodola' wrote:
> >
> > I've been having these 2 implemented in psutil for a long time. On
> > POSIX these are convenience functions using os.kill() + SIGSTOP /
> > SIGCONT (the same as CTRL+Z
Hello,
I've been having these 2 implemented in psutil for a long time. On
POSIX these are convenience functions using os.kill() + SIGSTOP /
SIGCONT (the same as CTRL+Z / "fg"). On Windows they use undocumented
NtSuspendProcess and NtResumeProcess Windows APIs available since XP.
The same approach
Sorry in advance if this has been proposed in the past but I couldn't find
anything on python-ideas:
>>> l = []
>>> l.pop(default=1)
1
FWIW my use case consists in reading entries from /proc/diskstats where
lines can have a variable number of fields depending on the kernel version:
On Thu, Sep 13, 2018 at 12:51 PM Oleg Broytman wrote:
> 2. I was sure it was trolling on the trail of
>https://bugs.python.org/issue34605
Wow! I find it a bit excessive that #34605 was not discussed first and got
checked in so quickly. I hope there won't be similar initiatives about
terms
On Thu, Sep 13, 2018 at 10:38 AM Samantha Quan wrote:
>
> First, I'd like to express how grateful I am to see more and more technical
> communities embrace diversity and inclusivity, particularly big tech
> communities like Python, Redis, and Django.
>
> In the spirit of the big recent
On Tue, Jul 24, 2018 at 1:57 AM Stefan Behnel wrote:
>
> David Mertz schrieb am 23.07.2018 um 16:12:
> > The need addressed by PEP 505 is real; it's also MUCH more niche and
> > uncommon than something that would merit new syntax. Moreover, the actual
> > legitimate purpose served by the PEP 505
On Tue, Jul 24, 2018 at 11:50 AM Steven D'Aprano wrote:
>
> On Tue, Jul 24, 2018 at 12:05:14AM +0200, Giampaolo Rodola' wrote:
>
> > This:
> >
> > v = a?.b
> >
> > ...*implicitly* checks if value is not None [and continues execution].
>
> Do you
On Tue, Jul 24, 2018 at 2:22 AM MRAB wrote:
> >> > It
> >> > does so by introducing a brand new operator ("?") which can be spelled
> >> > in two forms ("a?.b" and "a?[b]") by using two adjacent symbols not
> >> > interrupted by any space, which is an absolute first in the Python
> >> > syntax
>
On Mon, Jul 23, 2018 at 6:53 PM Steven D'Aprano wrote:
>
> On Mon, Jul 23, 2018 at 02:04:17PM +0200, Giampaolo Rodola' wrote:
> > "a?.b" does two and that's a fundamental difference (explicitness).
>
> How is "two things" less explicit than "one thing
On Mon, Jul 23, 2018 at 11:52 AM Steve Dower wrote:
> I'm borderline on ?[] right now. Honestly, I think it works best if it
> also silently handles LookupError (e.g. for traversing a loaded JSON
> dict), but then it's inconsistent with ?. which I think works best if it
> handles None but allows
On Mon, Jul 23, 2018 at 3:12 AM Steven D'Aprano wrote:
> > ? has no spaces, it's literally "variable names interrupted by
> > question marks" and evaluation can stop at any time while scanning the
> > line from left to right.
>
> Just like ordinary attribute access.
>
> This is the point I was
On Mon, Jul 23, 2018 at 12:08 AM Chris Angelico wrote:
>
> On Mon, Jul 23, 2018 at 7:51 AM, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
> >>
> >> On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola'
> >> wrote:
On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
>
> On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
> >>
> >> On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola'
> >> wrote:
>
On Sun, Jul 22, 2018 at 11:51 PM Giampaolo Rodola' wrote:
>
> On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
> >
> > On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola'
> > wrote:
> > > On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
> > &g
On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
>
> On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
> > I find it less explicit mainly because it does 3 things at once: check
> > if attribute
On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
>
> On Sun, Jul 22, 2018 at 11:35 PM, Giampaolo Rodola'
> wrote:
> > On Sun, Jul 22, 2018 at 2:10 PM Steven D'Aprano wrote:
> >>
> >> On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
>
On Sun, Jul 22, 2018 at 2:10 PM Steven D'Aprano wrote:
>
> On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 3:55 AM Steven D'Aprano wrote:
> [...]
> > > I don't think that &q
On Sun, Jul 22, 2018 at 12:26 PM Paul Moore wrote:
> On 22 July 2018 at 11:13, Giampaolo Rodola' wrote:
> > - "a?[2] ?? 3" means "index 2 of list a is picked up if a is not None,
> else
> > use 3"
>
> Actually, doesn't it mean
>
> if a is not
On Sun, Jul 22, 2018 at 3:55 AM Steven D'Aprano wrote:
> Indeed we do. But we also say:
>
> - we say "+" instead of "add"
> - we say "//" instead of "floor division"
> - we say "**" instead of "exponentiation"
> - we say "&" instead of "bitwise AND"
> - we say "f( ... )" instead of "call f with
On Thu, Jul 19, 2018 at 3:39 PM Steven D'Aprano wrote:
> Tens of thousands of non-English speakers have had to learn the meaning
> of what might as well be meaningless, random sets of symbols (to them)
> like "class", "import", "while" and "True". If they can do so, perhaps
> we English-speakers
On Thu, Jul 19, 2018 at 11:22 AM Antoine Pitrou wrote:
>
> On Thu, 19 Jul 2018 19:11:33 +1000
> Chris Angelico wrote:
>
> > On Thu, Jul 19, 2018 at 4:06 PM, Greg Ewing
> > wrote:
> > > Chris Angelico wrote:
> > >>
> > >> I'd love to hear an explanation of WHY this doesn't look like Python
> >
On Thu, Jul 19, 2018 at 2:06 AM Chris Angelico wrote:
> > With all due respect (and I am sorry for being “vocal” about a PEP once
> > again) I find this simply ugly. To me this basically doesn’t look like
> > python anymore, so a strong -1 from me.
>
> I'd love to hear an explanation of WHY this
On Wed, Jul 18, 2018 at 7:46 PM Steve Dower wrote:
>
> Possibly this is exactly the wrong time to propose the next big syntax
> change, since we currently have nobody to declare on it, but since we're
> likely to argue for a while anyway it probably can't hurt (and maybe
> this will become the
Historically this has always been achieved by using:
_default = object()
def fun(arg=_default):
if arg is not _default:
...which does its job just fine. If you need something like this you're
typically a medium/advanced Python user so you either already know about it
or
On Sat, Jun 2, 2018 at 2:21 PM, Pål Grønås Drange
wrote:
> Elevator pitch:
>
> (2.5h - 14min + 9300ms).total_seconds()
> # 8169.3
>
> from datetime import datetime as dt
> start = dt.now()
> end = dt.now()
> (end-start) < 5s
> # True
>
>
> chrono::duration:
>
> In C++ 14 the
Whops, I hit "send" too soon. Sorry about the messed up message.
On Tue, May 29, 2018 at 10:56 AM, Giampaolo Rodola'
wrote:
> Hello,
> I've been working on a patch which speeds up shutil.copy* operations for
> all 3 major platforms (Linux, Windows, OSX):
> https://bugs
Hello,
I've been working on a patch which speeds up shutil.copy* operations for
all 3 major platforms (Linux, Windows, OSX):
https://bugs.python.org/issue33671
Since the speedup is quite consistent I'd love to see this merged in, but
considering shutil.copy* is quite crucial I wanted to hear other
...as in (not tested):
def _rchown(dir, user, group):
for root, dirs, files in os.walk(dir, topdown=False):
for name in files:
chown(os.path.join(root, name), user, group)
def chown(path, user=None, group=None, recursive=False):
if recursive
On Tue, May 8, 2018 at 2:00 PM, David Mertz wrote:
> I like the idea. I think an argument to os.walk() is the simplest option
> for most users. But per some comments, "hidden" is actually more subtle
> than the filesystem bit sometimes. I.e. dot-files, ~ suffix, maybe .bak,
>
On Fri, 13 Apr 2018 at 03:47, M.-A. Lemburg wrote:
> I think moving data out of pyc files is going in a wrong direction:
> more stat calls means slower import and slower startup time.
>
> Trying to make pycs smaller also isn't really worth it (they
> compress quite well).
>
>
On Mon, Mar 26, 2018 at 10:35 AM, Roberto Martínez <
robertomartin...@gmail.com> wrote:
> Hi,
>
> sometimes I need to use contextlib.close but over methods with a different
> name, for example stop(), halt(), etc. For those cases I have to write my
> own contextlib.close specialized version with
On Fri, Jan 19, 2018 at 5:23 PM, Paul Moore wrote:
> Another common approach is to not ship tests as part of your (runtime)
> package at all - they are in the sdist but not the wheels nor are they
> deployed with "setup.py install". In my experience, this is the usual
>
On Thu, Oct 19, 2017 at 10:05 AM, Stephan Houben
wrote:
> Hi Steve,
>
> 2017-10-19 1:59 GMT+02:00 Steven D'Aprano :
>
>> On Wed, Oct 18, 2017 at 02:51:37PM +0200, Stefan Krah wrote:
>>
>> > $ softlimit -m 10 python3
>> [...]
>> > MemoryError
>>
On Tue, Sep 5, 2017 at 12:59 PM, Nathaniel Smith <n...@pobox.com> wrote:
> On Mon, Sep 4, 2017 at 8:59 PM, Giampaolo Rodola' <g.rod...@gmail.com>
> wrote:
> > Recently os.cpu_count() on Windows has been fixed in order to take
> process
> > groups into acc
Recently os.cpu_count() on Windows has been fixed in order to take process
groups into account and return the number of all available CPUs:
http://bugs.python.org/issue30581
This made me realize that os.cpu_count() does not return the number of
*usable* CPUs, which could possibly represent a
On Thu, Jul 20, 2017 at 3:35 AM, Alexander Belopolsky <
alexander.belopol...@gmail.com> wrote:
> On Wed, Jul 19, 2017 at 9:08 PM, Guido van Rossum
> wrote:
> > The proposal in your email seems incomplete
>
> The proposal does not say anything about type((x=1, y=2)). I assume
>
On Tue, Jul 25, 2017 at 9:30 PM, MRAB <pyt...@mrabarnett.plus.com> wrote:
> On 2017-07-25 19:48, Giampaolo Rodola' wrote:
>
>>
>> On Tue, Jul 25, 2017 at 7:49 PM, MRAB <pyt...@mrabarnett.plus.com
>> <mailto:pyt...@mrabarnett.plus.com>> wrote:
>>
On Thu, Jul 20, 2017 at 2:14 AM, Giampaolo Rodola' <g.rod...@gmail.com>
wrote
>
> In case of one module scripts it's not uncommon to add a leading
> underscore which makes __repr__ uglier.
>
Actually forget about this: __repr__ is dictated by the first argument. =)
--
On Tue, Jul 18, 2017 at 6:31 AM, Guido van Rossum wrote:
> On Mon, Jul 17, 2017 at 6:25 PM, Eric Snow
> wrote:
>
>> On Mon, Jul 17, 2017 at 6:01 PM, Ethan Furman wrote:
>> > Guido has decreed that namedtuple shall be
On Wed, Jul 19, 2017 at 3:27 AM, Steven D'Aprano
wrote:
> On Tue, Jul 18, 2017 at 06:16:26PM -0400, Jim J. Jewett wrote:
> > Then constructing a specific instance from the arguments used to
> > create it could be as simple as keeping a reference to the temporary
> > created
On Thu, Jun 1, 2017 at 8:47 AM, Serhiy Storchaka
wrote:
> What you are think about adding Unicode aliases for some mathematic names
> in the math module? ;-)
>
> math.π = math.pi
> math.τ = math.tau
> math.Γ = math.gamma
> math.ℯ = math.e
>
> Unfortunately we can't use ∞, ∑
Some years ago I started working on a patch for the socket module which
added a couple of utility functions for being able to easily create a
server socket, with the addition of being able to accept both IPv4 and IPv6
connections (as a single socket):
https://bugs.python.org/issue17561
Given that
I don't know if this is related (regarding functions registered in C) but
one problem I often have is to always execute exit functions. I have come
up with this:
http://grodola.blogspot.com/2016/02/how-to-always-execute-exit-functions-in-py.html
On Fri, Jan 20, 2017 at 1:46 PM, Thomas Kluyver
On Wed, Dec 21, 2016 at 1:50 AM, Thane Brimhall
wrote:
> I use cProfile a lot, and would like to suggest three backwards-compatible
> improvements to the API.
>
> 1: When using cProfile on a specific piece of code I often use the
> enable() and disable() methods. It
Long ago I posted a patch for this (decorator + context manager) but I
bumped into a weird error I wasn't able to fix (see last comment):
http://bugs.python.org/issue9285
On Wed, Nov 2, 2016 at 10:45 PM, Tim Mitchell
wrote:
> Hi Ben,
>
> Mostly I just print to
On Fri, Oct 7, 2016 at 6:52 PM, Yury Selivanov
wrote:
> On 2016-10-07 11:16 AM, Guido van Rossum wrote:
>
> Maybe a simpler approach would be to write a linter that checks for a
>> known list of common blocking functions, and anything that calls those
>> automatically
Independently from what the proposed solution is, I think you raised a very
valid concern: the DRY principle.
Right now the stdlib has tons of client network libraries which do not
support the new async model.
As such, library vendors will have to rewrite them by using the new syntax
and provide
52 matches
Mail list logo