> On 5 Jan 2020, at 22:41, Andrew Barnert via Python-ideas
> wrote:
>
> On Jan 5, 2020, at 00:17, James Lu wrote:
>>
>>
>> I use macOS, and using Python is very confusing.
>>
>> - Apple's bundled Python 2.7.
>
> Apple has made a me
have any idea who to trust to get it 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://
ly in the sense that it starts running and quickly fails with an exception
for most users.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-id
wnloading a Mac-specific py2app app or something
else that will definitely work instead of only maybe working and otherwise
punting on it as a user problem that I have to figure out how to solve myself?
The fact that I can copy that same zipapp to a Windows box and then figure out
how to so
t Python’s mbcs codec should also change to (on
Windows when UTF8 is enabled) use “legacy” if it exists and only otherwise use
actual “mbcs”?
Or that nobody should use this Windows feature on Python 3.8+?
_______
Python-ideas mailing list -- python-ideas
to, or to use in place of sys.path for finding the main
module? (Without knowing the intended use I don’t know which of those is
appropriate, but I’m guessing one of them is.)
_______
Python-ideas mailing list -- [email protected]
To unsubscri
cording to some rule you
can’t even tell us is supposed to make that any easier for anyone.
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/
n’t use Python.!
_______
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/python-ideas@pyth
where the default codepage wasn’t Shift-JIS.
___________
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:
all valid code and strictly bounded
complexity on error recovery (so it may get as bad as worst-case cubic, but
cubic on N<=5 so who cares) so they could usually produce error messages as
good as most C compilers without the horrible mess of parsing that most C
compilers need.
__
On 04/12/2019 23:41:19, Andrew Barnert via Python-ideas wrote:
On Dec 4, 2019, at 12:14, Mike Miller wrote:
On 2019-12-04 11:05, David Mertz wrote:
I've often wanted named loops. I know approaches to this have been proposed
many times, and they all have their own warts. E.g. an a
t it’s usually used only to mutate something that’s only relevant
within the statement is a big part of the reason people actually like it once
they see real examples.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to p
ay when you have a mishmash of the
two where it would make sense to write confusing things like `lst.sort() +
lst.remove(10)` or a comprehension that mutates as it goes. Good uses of that
kind of mishmash do exist, but aren’t that common.
_______
Python-ideas m
what’s wrong with the function call syntax (a la setuptools)? The only reason
import has to be special syntax in the first place is that it does stuff like
adding bindings into the outer namespace, and your proposal (in this second
version) doesn’t need that.
________
ly do something like `bar = foo` instead of `bar = foo()`
(and then don’t use `bar` in a way that would detectably cause a TypeError)
that can’t be detected.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@python.
atever. You need some argument for why reading text files is so
much more important than all the other things you use a module for that it
needs to be builtin.
The reason importing modules is special is the obvious bootstrapping problem:
if you had to import a module to import modules, there
be having this argument. it's not a function tho ;)
I’m sorry, but this doesn’t even make sense as a reply to what I said.
I explained why import can’t be a function. But your resource import-expression
(or import-not-an-expression-but-f-strings-treat-them-as-if-they-we’re) can be
a function
er answer that isn’t a pain.
___
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/a
s and methods
around the most obvious way.
___________
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:
nything that just gives
you the raw bytes or text of a resource file. I’m not sure it’s useful enough
to be worth building. But it might be fun enough to try even if I can’t think
of a good use. :)
_______
Python-ideas mailing list -- python-ideas@pyt
ste whenever I’m writing a lot of classes that
need a repr, which seems to be exactly your use case, and I’ve never been
bothered by doing that, much less considered that maybe it’s worth having
either one as a builtin, before now.
___
Python-ideas
to figure out that it’s the “age” attribute of this via
reflection (or maybe the compiler can do that). This also means you can pass
around a reference to this.age and mutate this through that reference (and
presumably nameof works on that reference too), which doesn’t make any sense in
Python.
_
w__. If
every param has an attribute with the same name, use that; otherwise, this
doesn’t work.
And if none of the automatic ways worked and you tried to use them anyway, you
get an error. But it would be nice if this error were at class-defining time
rather than at repr-calling time, so ma
f-attributes
> form is useful but too fiddly, it would be possible to add a stated
> default of "figure it out by magic", and then the exact magic can be
> redefined at will.
I don’t think you can document something as “magic” and redefine it from
version to version in Python wi
have code to generate help for
a module that includes all of its attributes. That doesn’t make sense for class
instances in general, but it does make sense for dataclass instances. And
extending it to also include some string for each one makes sense. I wouldn’t
be surprised if such things already
args.items())) return f"{func.__name__}({', '.join(args)})"
# or maybe as a class decorator def auto_repr(cls): def
__repr__(self): func, bound_args = inspect.deconstruct(self)
args = itertools.chain( map(repr, bound_args.args),
alid meaning as something else...
what's the point of the colon, otherwise? Seems like just grit on the screen.
+1
Rob Cliffe
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
htt
rlook that execution is supposed to fall through.
IMO it is also clearer than "or if", though we wouldn't know for sure
until/unless "or if"
was adopted in Python and we had had time to get used to it.
Rob Cliffe
_______
Python-ideas mail
n’t _want_ the name of the object, you want the
name of the variable. And no object knows the name of the variable you used to
access it. Even for classes and functions, the fact that class statements and
def statements happen to produce a variable with the same name that’s stored in
the objec
C#, maybe it is a static typing
error to use it on an attribute that can’t be statically checked? Or maybe a
warning? I don’t know. Maybe that should even be left up to the type checkers
as a QoI issue rather than defined by Python?
___
Python-ideas mailin
e, you statically know
whether foo.bar exists, and therefore the compiler can check that nameof is
correct, but you dynamically don’t know, so the runtime cannot check that
nameof is correct. It could check something significantly different, and less
useful, but it can’t check the eq
ht be a reasonable proposal, but you’d need to look them
all over and make the case for why one design is the right one to standardize
on and why it needs to be standardized in the first place, not just suggest
that we should have something underspecified.
_____
cannot tell the type, or the attributes
of that type, the checker may report an error or a warning or nothing. If the
type is explicitly Any, or if it’s determined to be some type intended to have
dynamic attributes (like SimpleNamespace, or a bridge or proxy), the checker
should not report an
attr(spam, 'eggs'), which could be any arbitrary
code”. Even if it were possible, it’s not clear what the benefit would be, and
without someone making a case for a benefit, it’s not worth trying to come up
with something clever in the first place.
__
that breaks the point of
the feature better?
> IDEs are very much capable of refactoring strings.
No they’re not. They have to guess at it using heuristics, which are
complicated, and often get it wrong. Because it’s inherently ambiguous whether
the string or substring “spam” is meant as the name
e’s nothing stopping someone
from creating ambiguous operators… But I think the fact that code written with
custom operators wouldn’t feel much like Python is a better argument against it
than the practical difficulties.
_______
Python-ideas mailing list -
data model, etc.
in terms that make sense to Python programmers (as opposed to, e.g., the C
spec, which is only intended to make sense to people writing C compilers)._______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email
ou edit.
Couldn’t a Python tool just also keep track of every string and substring that
has at least one match as a use or definition of an attribute? Yes. But I think
it’s obvious why this is a lot more work and at least a little less useful. And
that may be part of the reason Python has alway
eing proposed and how it helps, but also make the case
that Python tools and Python programmers are likely to actually take advantage
of it.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.
tions.Fraction, that would be pretty handy
in the stdlib…)
___________
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
e going to search, to be a problem. And
they’re ubiquitously documented in C or shell terms that will give you C-style
octal values, so most people who do search will be misled.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an e
after
that. (Unless you can convince them that this new feature is not only worth
using, but so compelling that it’s worth being much more aggressive than usual
in requiring the latest Python, which doesn’t seem all that likely.)
___________
Python-i
problems I’m not seeing here. But it seems at least worth
exploring.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.
e a fun weekend project, so maybe it’s worth
just diving in to see what we run into, and then just ask -ideas about the
remaining open questions. If you don’t want to try it, there’s a good chance I
will, but no promises as to when.
___________
Python-ideas m
lip opener flip…), but might be worth
putting in your own toolkit.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Mess
of the borderline where three vs. seven
characters would push it over the edge for any given developer? Maybe, but I
doubt enough such cases to change things.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email t
ut if
it is, I think Shai’s idea (or mine, if I misinterpreted Shai’s) might be a
decent match, and very simple.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mai
o stop thinking of it as a syntactic transformation and instead think
of the semantics directly: the with affects the innermost scope if it’s smaller
than the innermost statement, even though there’s no way to rewrite it like
that. But then nothing else in Python is defined as a syntactic rew
arn even the basic use of futures and executors, of course that's fine. And
if you put it on PyPI, maybe others will find it useful as well. But I don't
think there's any need for it in the stdlib or anything.
_______
Python-ideas ma
use, and maybe create that demand.
___________
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/arch
rapper
@implicit_cast
def f(x: int, y=2, *, z) -> int:
return x+y+z_______
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
rget them,
so you can just rely on it. The quick&dirty hack I posted was for Python 3.7,
so it doesn’t support positional-only parameters because they don’t exist in
3.7, but it will handle keyword-only parameters and positional-or-keyword
parameters, and default values, and decorated function
fter functions, or a context
to with around the original function, or a param-translator, or other common
things that together cover 90% of your needs. The implementations of those
handful of helpers would need to be verbose, but your code that uses them to
create hundreds of different decorators wouldn
ledispatch
def transformator(x):
return x
@transformator.register
def _(x: int):
return str(x)
spam = Spam(2, 3.0, z=[1, 2.0, 'abc'])
print(transform(spam, transformer=transformator))
This should print:
Spam(x='2', y=3.0, z=['1'
best model for new code doesn’t
mean it’s the always best model for porting all code.
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python
cks to do that plus adding all kinds of useful
heuristics might be nifty.)
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.pytho
he PEP can dismiss the problem, just not in the way it currently
does.___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
M
I figured out how to
skip over all the docker-compose helpers…). I don’t know if anyone’s using it
in real life code, but it should be fine to use as an example to show that even
with such libraries there’s no ambiguity.
___________
Python-ideas mailing list --
wisted and asyncio, even if the lowest level code that you rarely look at is
very different. So I think it’s not really a problem for most people.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to pyth
on to encode
the text, you’d get the same result—either no answers, or bad answers from
people who don’t know anything but are desperate for points so they just guess
wildly at something that might be kind of similar to what you want.
_______
Python-ideas mai
possibly be getting 0 out of that
calculation before realizing you’re actually getting None?
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/pytho
building a PyPI library, you can guess at all of this and see what people say,
but if you add it to the stdlib you have to get it right the first time.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas
ng that makes some of these choices necessary or
desirable. But otherwise, I think we’d be better off adding a SerialExecutor
(that works with the existing Future type as-is) but not adding or changing
anything else.
_______
Python-ideas mailing list --
onathan’s sense
here.
[4] Checking the docs, it looks like the immediate policy didn’t make into
C++11 either. But anyway, the deferred policy did, and that’s serial in
Jonathan’s sense._______
Python-ideas mailing list -- [email protected]
To u
-length ints.
___
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/python-idea
ut you might come up
with a great new feature.
___________
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
d be in the stdlib.
And, if it gets rejected, you still have it for your own use, and can publish
it on PyPI for others. (And maybe, if it gets a lot more use than other people
expected, you can propose it to be added to the stdlib again in the future.
_______
ackground thread. That’s the naming used in the
third-party C++ and ObjC libs I’ve used most recently, and it may be more
common than that—but it may not, in which case my reading may be idiosyncratic
and not worth worrying about.
_______
Python-ideas
ve
use as a word qualifies as “excessive swearing” per the CoC, surely an -ideas
thread isn’t the place to have it?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.pyt
> That surprises me and I cannot explain it.
Without reading the code, I can guess. The first one does two 500K allocations
and a 500K memcpy; the second only does one 500K allocation but does 150K
separate 4-byte copies, and the added cost of that loop and of not moving as
many bytes at a
ts; I think that’s the
shortest—although definitely not cleanest—way to install a token-filtering
import hook for Python 3.4, and only a few things have changed since then.)_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an em
om inside a comprehension
do?
_______
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.p
> On Feb 21, 2020, at 15:34, Greg Ewing wrote:
>
> On 22/02/20 11:45 am, Andrew Barnert via Python-ideas wrote:
>> there’s no reason you can’t write `[(yield None) for _ in range(3)]` to
>> gather the first three values sent into your generator
>
> Currently thi
whatever
and you’re done.
_______
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/arch
5/06/hacking-python-without-hacking-python.html
___________
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
htt
there's a good reason we haven't added
a binary `~`. It seems like I've seen discussion in the past. But I couldn't
find such discussion. And as I'm currently taking some statistics courses, I'm
getting R-feature-envy again...
What do you think?
Aaron Hall
_
sn’t provide any of them.)
Passing a char object, you’d know statically that it makes sense; passing a str
object, you don’t.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.p
ce, `a ~= b` but I don't currently have a strong
motivating use-case for it.)
_______
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 a
what we're currently doing in statsmodels right now
because we lack the binary (in the sense of two-arguments) `~`.
See: https://www.statsmodels.org/dev/example_formulas.html
_______
Python-ideas mailing list -- [email protected]
To unsubscrib
at PEP 465. Should I write up a PEP?
___
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
.).
Sympy is rather new, but I think they'd appreciate it since they have an entire
subpackage for distributions:
https://docs.sympy.org/latest/modules/stats.html
I do envision other usages, but these are the strongest cases I have right now.
___
Python-i
dless.
___
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/python-
My main goal here is to increase the flexibility of Python for various domains
where I have used `object0 ~ object1` - and can't yet do so in Python.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ide
countered in multiple domains, `object1 ~ object2`, possible in Python.
_______
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
ple think
it should have context in integers where it binds strongly. Maybe Patsy is the
right way to do it. Maybe this is ultimately a bad idea. But I want a record of
the discussion and conclusion, and I want it to be the best reasoned one we can
muster.
________
Thank you all for your discussion! Cheers!
ACH
___
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
hout even looking for it) in particular?
___________
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/archiv
a non-builtin type. How often do you accidentally
unpack a length-6 dict where you wanted to unpack a length-2 dict?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://m
means, etc.—would all break. And what code would benefit?
_______
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://mai
][d]?NoneError:None to be explicit.)
Even in that case it’s still not the same thing. For example, if any of b, c,
or d is None, the none-aware operators will still raise, but your
exception-aware version will not.
So, the fact that exception-aware operators could replace some but not most
u
rt, or if you want a
double-linked list, etc.), as in C++, not a node.
But there are cases where you’re dealing with complex objects that are
internally linked up (e.g., I used to deal with a ton of C code that dealt with
internally linked database/filesystem-style extents lists, and the handle is
might turn out to be useful enough to
qualify (byte I’m much less confident of—it comes up less often, and also once
you start bikeshedding the interface there’s a lot more vagueness in the
concept), or at least worth having a PEP to explain why it’s rejected. (But of
course “if not for backwa
l
leaves functions that parse *args and **kw and raise TypeError manually,
whether in Python or in C, but I suppose you can say that in that case it
really isn’t a parameter error (the signature really is *args, **kw so
everything matches). What about inspect.Signature.bind?
_______
dered) or np.array
(where they aren’t even Boolean-values)? In particular, transitivity keeps
coming up, but all of those examples are transitive (it’s never true that ahttps://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archive
> What about inspect.Signature.bind?
>
> Do you have a specific concern?
Just whether you’re proposing to change it as part of the proposal. I think you
do want to, and I think it’ll be easy, but I don’t think either answer would be
a deal breaker.
More generally, I’m just tryin
On Mar 4, 2020, at 01:56, Mark Dickinson wrote:
>
>> On Wed, Mar 4, 2020 at 9:22 AM Andrew Barnert via Python-ideas
>> wrote:
>
>> Is there any commonly used or even imaginable useful type that uses them in
>> weirder ways than set and float (wh
t keyword param that accepts any iterable of strings.
So when you have a set of prefixes, you don’t have to call
s.lcut(tuple(prefixes)), you just pass the set as-is to
s.lstrip(strings=prefixes)).
___________
Python-ideas mailing list -- [email protected]
a TypeError.) Fitting this
into the type algebra (& and | and -) is pretty easy. I’m not aware of anyone
translating that idea to dynamic type systems, but it could be interesting.
___
Python-ideas mailing list -- [email protected]
To uns
via Python-ideas
> wrote:
>
>
>> On Mar 30, 2019, at 12:30, MRAB wrote:
>>
>> I'd much prefer .lcut/.rcut to .cut_prefix/.cut_suffix, to match
>> .lstrip/.rstrip.
>
> I agree that we should use either l/r or something to do with start/end. We
On Mar 5, 2020, at 05:24, Richard Damon wrote:
>
> On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote:
>>> On Mar 4, 2020, at 19:12, Richard Damon wrote:
>>> Yes, because of the NaN issue, you sort of need an 'Almost Total Order' and
>>> '
901 - 1000 of 1693 matches
Mail list logo