Am 03.10.2018 um 20:46 schrieb Anders
Hovmöller:
Chris' problem isn't an actual problem though. Its just a few sentences in a PEP. It might be a problem for other python implementations but I'm gonna put say 100 dollars on that it's not actua
should not be
dismissed.
Wolfram
_______
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
ay be driven by the choice of names and history: yes,
a frozen dict sounds like a regular dict that has been altered
(specifically frozen) -- but if we called them "hash_table" and
"mutable_has_table", then your intuition may be different :-)
As for subclassing or not, for most Pyth
le" and
> "mutable_has_table", then your intuition may be different :-)
>
> As for subclassing or not, for most Python code is makes no difference --
> polymorphism is not achieved through subclassing. and the "Pythonic" way to
> test for type is through
On Thu, Oct 11, 2018 at 3:35 PM, Steven D'Aprano
wrote:
> On Thu, Oct 11, 2018 at 12:34:13PM -0700, Chris Barker via Python-ideas
> wrote:
>
> > I don't care what is or isn't a subclass of what -- I don't think that's
> a
> > Pythonic questio
t;
> One could also imagine that isinstance and issubclass taking a keyword
>> argument for the logical operator. Maybe just something as simple as
>> "isinstance(foo, (a, b), all=True)"
>>
>
> Does AND even make sense for isinstance/issubclass?
>
> Cheers,
&g
brary?
>
I'm not (currently) a fan of design by contract, and don't expect I'll end
up using it, whether or not we get a nifty standard library for it
That being said -- this is analogous to why PEP 484 -- Type Hints was
adopted, even though the syntax changes in Python had long
on use case.
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
___
gency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
___
Python-ideas mailing list
[email protected]
h
apher
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
_______
Python-ideas mailing list
Python-id
e if we could tell the
> interpreter "don't evaluate expensive_function(...) unless you really
> need it".
>
> Other languages have this -- I believe it is called "Call By Need" or
> "Call By Name", depending on the precise details of how it works. I ca
necessary to avoid having to try parsing every
> string value as a date time (and to specify precision: "2018" is not the
> same as "2018 00:00:01")
>
> On Friday, November 2, 2018, Chris Barker via Python-ideas <
> [email protected]> wrote:
>
how about Windows and Mac users? Do those platforms provide a sha256
> checksum utility?
>
> (Maybe we should provide both hashes.)
macOS has a shasum tool that does the same thing:
$ shasum -a 256 __init__.py
8db2fe0b21deec50d134895a6d5cfbb5300b23922bf2d9bb5b4b63ac40c6a22e __init__.py
Ther
ly
assume that HTTPS downloads are reliable enough and don’t verify checksums
unless I do the download in an automation pipeline.
Ronald
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code o
s a function and maps it onto a interable, returning a new
iterable. So a map object is an iterable -- what's under the hood being
used to create it is (and should remain) opaque.
Back in the day, Python was "all about sequences" -- so map() took a
sequence and returned a sequence
On Sun, Dec 9, 2018 at 10:32 PM Ronald Oussoren via Python-ideas <
[email protected]> wrote:
> BTW. I wonder how many actually verify these checksums,
>
Hardly anyone -- most of us verify the download by trying to use it :-)
Which doesn't mean that we shouldn't
topher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
___
Python-ideas ma
In a project of mine, I have used the gettext module from Python Standard
Library. I have found that several tools could be used to generate the Machine
Object (mo) file from the source Portable Object (one): pybabel (
http://babel.pocoo.org/en/latest/ ), msgfmt.py from Python tools or the
ry users choose according to their own use case.
Serge
_______
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
Le 18/12/2018 à 23:09, Barry Scott a écrit :
On 18 Dec 2018, at 09:10, Serge Ballesta via Python-ideas
mailto:[email protected]>> wrote:
In a project of mine, I have used the gettext module from Python
Standard Library. I have found that several tools could be used to
genera
low to implement the new feature with minimal refactoring
for the gettext module.
Le 18/12/2018 à 10:10, Serge Ballesta via Python-ideas a écrit :
In a project of mine, I have used the gettext module from Python
Standard Library. I have found that several tools could be used to
generate the Mach
ber of ways one
might want to proceed with/without an error, and the current except,
finally, else options cover them all in a clearly defined way.
-CHB
>
> ~Amber
> ___
> Python-ideas mailing list
> [email protected]
> https:/
� a_list[i] += 1
��� etc()
I realize this could be accomplished with context managers, but that seems like
overkill to simply throw away the exception, and would increase the overall
required code length.
Thanks for your input!
Alex
signature.asc
Description: OpenPGP digital signature
> or "inconsistencies between os.path.join and str.join" ?
>
well, if we're talking about moving forward, then the Path object is
probably the "right" way to join paths anyway :-)
a_path / "a_dir" / "a_filename"
But to the core language issue -- I start
about composable, re-usable general
> purpose components more than special cases.
>
> --
> Steve
> _______
> Python-ideas mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.or
ify = lambda it: type(it)(map(str, it))
>
> Done! Does that really need to be in the STDLIB?
>
> On Tue, Jan 29, 2019, 7:11 PM Alex Shafer via Python-ideas
>
>> 1) I'm in favor of adding a stringify method to all collections
>>
>> 2) strings are special and worthy
tringify() that "could be useful." Python gives us easy composition to
> create each of them. It's not PHP, after all.
>
> On Tue, Jan 29, 2019 at 8:52 PM Alex Shafer wrote:
>
>> That would be strongly preferred to duplication across hundreds of use cases
>>
-
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
_____
le:
a_numpy_array * 5
multiplies every item in the array by 5
In pure Python, you would do something like:
[ i * 5 for i in a_regular_list]
You can imagine that for more complex expressions the "vectorized" approach
can make for much clearer and easier to parse code. Also much fast
anyone be opposed to the creation of a #python-ideas
on a large IRC network? I'd hope discussions there can have the same weight,
merit, community involvement, and potential for PEP-tracking ideas.
I think accommodating different people's best communication modes is essential
to the
rator
is a good idea in the first place).
Ronald
_______
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
enough reason for
> not using @ as an elementwise application operator (ignoring if having an
> such an operator is a good idea in the first place).
>
> Co-opting operators is pretty common in Python. For example, the
> `.__div__()` operator spelled '/' is most often
hilip Bergen*
P: +1(415)200-7340
*"Without data you are just another person with an opinion" -- W. Edwards
Deming*
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http:/
nalysis that somehow that is optimum for readability.
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
chris.bar...@
Feb 21, 2019 at 3:20 PM wrote:
> Send Python-ideas mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.python.org/mailman/listinfo/python-ideas
> or, via email, send a message with subje
xandre Dubois
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel
antivirus Avast.
https://www.avast.com/antivirus
_______
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo
ite
> important, especially when you consider that PEP8 only really has force
> for the standard library.
>
Huh? in the case of the stdlib, the "team" is the python core devs -- they
could decide to increase the line length if they want (though I imagine if
they did, they's
Dear python enthusiasts,
Writing python decorators is indeed quite a tideous process, in particular when
you wish to add arguments, and in particular in two cases : all optional
arguments, and one mandatory argument. Indeed in these two cases there is a
need to disambiguate between no
ult) and therefore to use something like
Signature.bind().
For this reason I proposed a replacement in `makefun`:
https://smarie.github.io/python-makefun/#signature-preserving-function-wrappers
--
Now bridging the gap. Of course a very interesting use cases for decorators is
to create decorator
2019 14:53
À : Steven D'Aprano ; [email protected]; David Mertz
Objet : RE: [Python-ideas] Problems (and solutions?) in writing decorators
David, Steven,
Thanks for your interest !
As you probably know, decorators and function wrappers are *completely
different concepts*. A decorat
ations “For this to
be used in this way, it is a requirement that the decorator arguments be
supplied as keyword arguments. If using Python 3, the requirement to use
keyword only arguments can again be enforced using the keyword only argument
syntax.”
* Finally, but this is just a comment:
Just in case I'm not the only one that had a hard time finding the latest
version of this PEP, here it is in the PEPS Repo:
https://github.com/python/peps/blob/master/pep-0584.rst
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R
ds
Sylvain
De : David Mertz
Envoyé : mardi 12 mars 2019 19:15
À : Sylvain MARIE
Cc : Steven D'Aprano ; python-ideas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators
[External email: Use caution with links and attachments]
One of
2019 04:56
À : Sylvain MARIE
Cc : David Mertz ; python-ideas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators
[External email: Use caution with links and attachments]
____
Sylvain MARIE via Python-ideas writes:
> I totally und
ustomed with the long history of this
language, is very strange that an operator such as @ (the decorator one, not
the other one) is completely not detectable by code, while there are so many
hooks available in python for all other operators (+, -, etc.).
Eventually that’s obviously your call, I’m
> incomplete ordering, which makes the comparison operators completely
>> appropriate. Adding new syntax for something that doesn't need it is
>> the thing likely to cause confusion.
>
>
> Indeed it would work the same way as set comparison does, if you interpret a
&
the comparison operators completely
>>>> appropriate. Adding new syntax for something that doesn't need it is
>>>> the thing likely to cause confusion.
>>>
>>>
>>> Indeed it would work the same way as set comparison does, if you interpr
, but knew the data binding model of python
> was incompatible from p.
>
> This got me thinking. I didnt actually need to overload assignment per-say,
> data binding could stay just how it was, but if there was a magic method that
> worked similar to how __get__ works for descriptor
read on; otherwise, you can skip the rest of this
message.
---
First, why is there even a problem? Because Python doesn't even have
"variables" in the same sense that languages like C++ that allow assignment
overloading do.
In C++, a variable is an "lvalue", a location wi
ging them today either, but maybe you could make a case otherwise.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list
On Jun 19, 2019, at 16:57, Chris Angelico wrote:
>
> On Thu, Jun 20, 2019 at 8:14 AM Andrew Barnert via Python-ideas
> wrote:
>> … x = y would mean this:
>>
>>try:
>>xval = globals()['x']
>>result = xval.__iassig
On Jun 19, 2019, at 17:25, Andrew Barnert wrote:
>
> At least with CPython, I’m 99% sure…
I forgot that I have Pythonista on my phone so I can check it instead of
guessing. Make that 100% sure. :)
___
Python-ideas mailing list -- python
ould have just signaled it instead, which is safer and
easier to manage, especially from Python.
Either way, there’s no way to safely clean up after it. (Deleting the threading
library’s own reference to its Thread object doesn’t solve that.)
And if your program regularly needs to terminate threa
e a patch.
That’s hardly something to feel bad about!
> Thinking about things the right way around, I dug in to the interpreter an
> hacked something up to add an assignment overload dunder method. A diff
> against python 3.7 can be found here:
> https://gis
If you worked out a more realistic example and demonstrated that with your
patch, it might feel a lot less disconcerting.
I feel even less convinced by your other potential uses, but again, if one of
them were actually worked out, it might be quite different..
> It's not like python python d
cs.
Finally, it would be nice to see each example compared to the best way to do
the same thing (presumably with iterable unpacking) in current Python, to see
how much It actually improves readability. The only equivalents given by the OP
are a case where you can just use an if statement (which
a "rpartial" function, and the second by
> using ellipsis ... as a placeholder, or a named constant in the
> functools module.
I’m pretty sure there are multiple improved-partial projects on PyPI. Maybe
just picking out one and adding a link to it from the functools docs is
sufficien
ave an assert statement as an example. I’m not quite sure
>> what it’s supposed to do there (does it skip the assert? if so, how is that
>> different from asserting True anyway?), and even less sure how to extend
>> that idea to all statements that use an expression anywhere. Is
oblem as with most other syntactic locations where an
expression can go, like the assignment example I gave earlier.
Anyway, I think we need to make this more concrete. Python semantics aren't
defined in terms of syntax rewriting rules, so trying to discuss this
suggestion as if it were a synt
In a language like Perl, where there’s little consistency in syntax and flow
control is scattered all over the place, this would be great. You can write the
code in the same order as the sentence you’re thinking in your native language.
In fact, Perl added postfix conditionals back in versio
On Jun 25, 2019, at 14:00, nate lust wrote:
>
> This message is related to two previous threads, but was a sufficiently
> evolved to warrant a new topic.
>
> I am proposing that two new magic methods be added to python that will
> control assignment and loading of class
er function that can do anything.
No, + does mean add. But Python doesn’t know what it means to add two Fraction
or Decimal or ndarray objects, so if you’re the one writing that class, you
have to tell it. It still means add—unless you lie to your readers.
And you can always lie to your readers
tus,
or referencing f->eggs in code that doesn't even run… so let's not worry about
bulletproofing it.) ___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists
sing that variable will trigger another call to
__getself__. I assume Nate is working on an answer to that along with all the
other points that have been raised.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python
ehavior, so you can write a scanf
function that knows that “%.1f” has to “unprintf” into a double. But Python
format specifier “.1” tells you nothing about the type—it can be passed a
float, a str, an instance of some arbitrary user-defined type… so what type can
tell you how to “unformat” it?
s closure, global, and
dynamic sets, and even non-symbol sets like to generalized-variables. The fact
that Python’s namespaces are object-oriented, and Python makes it very easy to
replace or hook class instance namespaces, a bit harder to replace or hook
global namespaces, and very hard to
no matter where from) calls counter(). It was used for all kinds of
things besides the debugging purpose it was originally added for. In fact,
Python developers still use it with Tk, to hook UI bits where Tk forgot to add
events or validators.
And actually, you can already do that in Pytho
ut doing anything in between, what if, say,
x.__getself__() raises?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
ht
On Jun 27, 2019, at 13:36, Michael Foord wrote:
>
>> On Thu, 27 Jun 2019 at 20:53, Yonatan Zunger wrote:
>> Generally, threads don't have a notion of non-cooperative thread
>> termination.
> That's precisely why thread cancellation in managed languages (lik
hich then gets
> checked at similar times to signals. (Probably not the exact same times
> since I'm sure there's plenty of code depending implicitly on that function
> being a noop outside the main thread) Basically, it would be having the
> Python interpreter doin
keep them readable, but those are usually not the kind of benefits
that other language designers steal from Python.)
>> If you had code involving “x = 2” that stopped working
>> when you moved it from local to a module init function to the top level ...
> > would you think
seful than a function which is like C scanf with a few differences and a
few extensions (that aren’t the same extensions as, say, ObjC).
Although I suppose there’s no reason you couldn’t do both.
_______
Python-ideas mailing list -- [email protected]
T
ople have been trying to improve on scanf
for 40 years, and the only things that have caught on look nothing like it
(regex, or just not having a format string at all and doing something like C++
>> operator).
___________
Python-ideas mailing list -- py
On Jul 3, 2019, at 03:54, Stefan Droege wrote:
>
> Currently, when creating a virtualenv with the PEP-405 `venv` module, the
> python-config executable will not be copied/symlinked to the virtualenv.
>
> That means for projects that link against the python interpreter, *and* whi
Dear python enthusiasts,
For some industrial project a few years ago we needed a reliable way to get the
version number for a package or module.
I found out that there was actually no method working in all edge cases,
including:
* Built-in modules
* Unzipped wheels and eggs added to
suggest it here:
https://github.com/smarie/python-getversion/issues )
I forgot to add something in my previous email: the original reason for
developing this library was to provide a version-aware persistency layer based
on json. Basically when you deserialize an object, your code would receive
On Jul 9, 2019, at 13:09, Shay Cohen wrote:
>
> >>> a: 3
The reason this isn’t a syntax error is that Python allows any valid expression
as an annotation. And “3” is just as valid an expression as “int”.
More generally, annotations don’t actually do anything at runtime, except
it possible for the installer to see the sys.version_info.releaselevel of
the Python it’s installing? If not, I guess it would require a commit every
release cycle to mark the new version as “no longer prerelease, so enable the
Windows installer check
on entry, or on exit?
ExitStack answers all of these problems. Maybe the solution is just to make it
slightly easier to use ExitStack with an iterable of context managers, and a
lot easier for novices to discover it?
_______
Python-ideas mailing list -- py
On Friday, July 12, 2019, 07:48:52 AM PDT, Joao S. O. Bueno
wrote:
> Modifying the fundamental tuples for doing that is certainly overkill -
> but maybe a context-helper function in contextlib that would proper handle
> all the > corner cases of some code as I've pasted
> BoundExpression instance.
Would it be easy to build something like this on top of a more general macro
system, like MacroPy? If so, you could create a proof of concept using existing
Python and get useful feedback. As it is, with just an explanation and a single
example, it’s hard to
unction (presumably equivalent to either
lambda: g(f()) or lambda *a, **kw: g(f(*a, **kw))) that represents the pipeline
that you then just call normally? I don’t see the benefit in being able to
write g() instead of g here, and in fact it seems actively misleading, because
it implies calling g on
lose each one immediately. Which you can just write
like this:
for n in range(1000):
with open(str(n) + '.tmp', 'w') as f:
f.write(str(n))
_______
Python-ideas mailing list -- [email protected]
To unsubs
of “x=x”.
But are there other benefits, for less trivial cases?
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
http
the CPython implementation. So this might require
>> at least defining that implementation behavior as the only correct one, and
>> changing the docs to explain it.
>
> You are correct. I have checked that this is the behavior of CPython, pypy,
> micropythob, iron python, an
uated at the callee context
It’s actually not even the callee context, but a custom one, maybe something
like self.columns. But that isn’t a problem.
> while x should be evaluated at the caller context. And how Python can know
> what is what?
I think the benefit of this proposal is that P
d in, say,
>> Haskell,
>> which would just define a function (presumably equivalent to either lambda:
>> g(f()) or
>> lambda a, **kw: g(f(a, **kw))) that represents the pipeline that you then
>> just
>> call normally? I don’t see the benefit in being able to
bly not a strength of the
>> language definition but a flaw. If every implementation does the exact same
>> thing (especially if it’s been that way unchanged in every implementation
>> from 2.3 to 3.8), why not document that as the rule?
>
> Agreed! If you don't fo
esumably write dt[price * taxrate < x], and get an exception if, say, both
tables have price columns, but otherwise get exactly what you expected. I
assume you think that’s too unclear or magical or whatever? But then I’m not
sure how dt[\price * \taxrate < x] is much better.
__
On Jul 15, 2019, at 04:43, Adrien Ricocotam wrote:
>
> Oh ok !
> I tried with some unicodes (🔥) but it didn't work. So it's only a subset as
> described in PEPs ?
> What about extending it ?
I’m pretty sure that the docs explain that the subset of characters that Pyth
e__? Would Apple’s Python distribution include their extra modules like
PyObjC, and would Debian’s exclude the ones they’ve taken out of the python
package and put in separate debs? Is there a distributor and/or site mechanism
for customizing this?
You might want to take a look at https://github.c
early benchmark numbers to consider. This is far smaller
> than any of the Python parsing libraries I have looked at, yet more universal
> than many of them. I hope that it would convert the skeptics ;).
For at least some of your use cases, I don’t think it’s a problem that it’s 70x
s
at ships with cPython”
I think a better current definition might be more like “all the stuff that has
chapters in docs.python.org/library”. That documentation claims to define “The
Python Standard Library” in the same way the reference defines “The Python
Language”. (It also says to keep it under y
both ways, so presumably that’s something that needs to be
discussed and decided on usefulness grounds rather than forced on us by an
implementation technique._______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to pyt
On Jul 16, 2019, at 10:20, Abdur-Rahmaan Janhangeer
wrote:
>
> I must make a C or pure Python demo?
You can definitely implement this in pure Python. It doesn’t need C for
performance reasons, it’s not going to be bootstrapped into the start sequence,
it doesn’t need access to C-onl
the more fun limitation to
solve, right? :)___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.
rea between, or whatever.
So, how does plot know which argument is y and which is a? It can’t be by the
names, because the names are stringified lambda expressions. The only thing it
can do is treat the first name-value pair in kwargs as y, and the second we z.
In other words, it has to treat them a
function? There’s nothing about having one * vs. two that tells you which one
is y and which is z. And of course there’s nothing about the values, either. If
there’s no way to tell based on the names, and no way to tell based on the
values, what way can there be to tell, except for the posi
local variables lying around for real and imag, complex(=imag, =real) would be
just as clear: the callee’s imag local gets the value of the caller’s imag
local.
But in the plot example, that isn’t what’s happening. The callee y variable
gets the first argument, and z gets the second. That’s not wha
On Jul 17, 2019, at 18:41, Yonatan Zunger wrote:
>
>
> I'm in the middle of developing a fancy heap profiler for Python (for those
> times when tracemalloc isn't enough), and in the process, thought of a small
> change in the interpreter which could have a lot
301 - 400 of 1690 matches
Mail list logo