On Sat, Aug 8, 2020 at 5:49 PM Michael Smith wrote:
> This kind of thing is so powerful, and I would love to see tooling capable
> of it in the python ecosystem. I believe folks who say it's very hard to
> implement correctly, but I don't know that that's a good reason not to make
> the proposed
the twin prime
conjecture. Or whatever. Mersenne Twister is just a non-obvious calculation
that we have convenient functions for.
On Sat, Aug 8, 2020, 1:28 AM David Mertz wrote:
>
>
> On Sat, Aug 8, 2020, 1:12 AM Steven D'Aprano
>
>> Static languages often check wha
On Sat, Aug 8, 2020, 1:12 AM Steven D'Aprano
> Static languages often check what
> bounds they can at compile time, and optionally insert bound checking
> runtime code for ambiguous places.
Yep. That's an assert, or it's moral equivalent.
Here's a deterministic program using the hypothetical ne
On Sat, Aug 8, 2020, 12:18 AM Ricky Teachey
> Yes, it's hard in the sense that it would require solving the halting
>> problem.
>>
>
> That doesn't sound so hard. ;)
>
> Thanks for educating me. Could it at least be useful for:
>
> 1. Providing semantic meaning to code (but this is probably not en
On Fri, Aug 7, 2020, 6:03 PM Paul Moore wrote:
> > x: int[0:] # any ints greater than or equal to zero would match, others
> would fail
> > x: int[:101] # any ints less than 101 match
> > x: int[0:101:2] # even less than 101
>
> I suspect the biggest issue with this is that it's likely to be
>
On Fri, Aug 7, 2020 at 11:32 AM Alex Hall wrote:
> > def not_valid(instance, schema):
>
>> > try:
>> > return validate(instance, schema)
>> > except ValidationError as err:
>> > return str(err)
>
>
> David, your example involves capturing the exception which was deferred i
>
> For an example. Anyone is free to use, but I'm not claiming it's
> necessarily the best. This is from... well, probably not yesterday like I
> said in other comment, but a couple days ago. The module `jsonschema` has
> an API where it raises an exception if `validate()` doesn't succeed (None
>
On Fri, Aug 7, 2020 at 4:58 AM Brendan Barnwell
wrote:
> It seems that the rationale that was used in the PEP was fairly
> narrowly focused on the comparison with things like dict.get() and the
> idea of EAFP. A somewhat broader justification might be something along
> these lines:
>
For an exa
I think getting Guido on board would be a huge step. Python has added
quite a bit of new syntax since 2014, and Guido himself is currently
advocating another new big change (pattern matching). His opinion may have
shifted.
FWIW, I'm +1 on the concept. I've wanted it quite often, as recently as
y
On Thu, Aug 6, 2020 at 2:52 AM Greg Ewing
wrote:
> On 6/08/20 6:42 am, David Mertz wrote:
> >>>> @unit("meter") a = 3 # a = unit("meter")("a", 3)
> >>>> @unit("foot") b = 4 # b = unit("foot")("b", 4)
On Wed, Aug 5, 2020 at 2:25 PM Jonathan Fine wrote:
> Real world examples where it would be useful are generally worth much more
> than invented examples.
>
I agree that @const is not really a useful "value decorator." I was just
picking up the example that occurred up-thread.
Here's something
On Wed, Aug 5, 2020 at 1:27 PM Ricky Teachey wrote:
> On Wed, Aug 5, 2020 at 11:41 AM Marco Sulla
> wrote:
>
>> On Wed, 5 Aug 2020 at 15:53, Ricky Teachey wrote:
>> from mypython import *
>> @const a = 5
>>
>
> I'm probably dim but I have no idea what that is supposed to mean or do.
> Is this
This definitely feels to me like though if an oddball case that "write your
own function" seems like the best solution. I accept the OP needs it, but I
have trouble imagining that many others would.
On Tue, Aug 4, 2020, 7:42 AM Dominik Vilsmeier
wrote:
> In one of my projects I'm reusing class-l
On Thu, Jul 30, 2020 at 11:55 AM Christopher Barker
wrote:
> > smaller_dict = dict(islice(large_dict.items(), 0, 255))
> well, beauty is in the eye of the beholder, of course. But really, you
> think it's pretty to import itertools, then make a function call, for
> what's very much a slicing ope
On Sat, Jul 25, 2020, 3:12 PM Christopher Barker
> I'm not advocating for any change (Obviously :-) ) -- but if there were to
> be one, I"d strongly vote for some version of else not break or else if
> not break because it introduces no keywords, and it's a lot more
> compatible documentation-wise
On Thu, Jul 23, 2020, 9:19 PM Rob Cliffe via Python-ideas
> The upholders of the status quo regularly provide gallant explanations of
> why "else" is perfectly natural, even intuitive.
> The fact is, it isn't. If it were, it wouldn't **need** to be repeatedly
> explained by gurus to lesser mortal
On Tue, Jul 21, 2020, 12:14 PM Sebastian Berg
> First, using it for named dimensions, means you don't actually need to
> mix it with normal tuple indexing, mixing both seems rather confusing?
>
> temperature.loc(method="nearest")[longitude=longs, latitude=lats]
>
I probably don't disagree on
There is absolutely no possibility that this will go anywhere. It breaks
every single Python program written since 1989, with absolutely ZERO new
functionally. Changing the spelling of a few of the most come keywords is a
non-starter.
If you can time travel to 1987 and propose differently spelled
On Sun, Jul 19, 2020 at 10:27 PM Jonathan Goble wrote:
> One use case that comes up in xarray and pandas is support for indicating
>> indexing "modes". For example, when indexing with floating point numbers
>> it's convenient to be able to opt-in to approximate indexing, e.g.,
>> something like:
On Sun, Jul 19, 2020 at 6:35 PM Dominik Vilsmeier
wrote:
> But this looks unnecessarily complicated. Why can't xarray allow the
> following:
>
> ds["empty"]["lon", 1:5, "lat", 3:] = 10
>
> which looks very close to the proposed syntax below. Not that I'm against
> the proposal but I think tha
We have this in re.sub(). Not sure we need a second way to do it.
On Sun, Jul 19, 2020 at 12:57 PM artem6191 wrote:
> Example: '1 1 1 1'.replace('1', lambda char, index: str(index)+char) # '01
> 11 21 31'
> ___
> Python-ideas mailing list -- python-id
On Fri, Jul 17, 2020 at 4:12 PM Todd wrote:
> ds["empty"][lon=1:5, lat=6:] = 10
>
I agree that looks really nice. I think this is the first suggestion to
allow slices on the RHS of keyword indexing. That's the part that was
missing in me understanding how this would help xarray greatly. It's als
really care about it. I don't think 'd[K(1, 2, 3, a=4, b=5)]' is
bad as an existing spelling.
On Fri, Jul 17, 2020, 12:08 PM David Mertz wrote:
> On Fri, Jul 17, 2020, 8:16 AM Jonathan Fine wrote:
>
>> Steve and I have different opinions, as to what the new behaviour
On Fri, Jul 17, 2020, 8:16 AM Jonathan Fine wrote:
> Steve and I have different opinions, as to what the new behaviour of:
> >>> d = dict()
> >>> d[x=1, y=2] = 3
> should be.
>
> He prefers that the assignment fail with
> TypeError: dict subscripting takes no keyword arguments
>
> I p
On Thu, Jul 16, 2020, 2:57 PM wrote:
> I know, I know that PyPy is fast as V8 but PyPy implement the whole
> library inside and it is not easy to embed it somewhere
>
I have no idea what you mean by that. PyPy doesn't need its standard
library to run. Just like in CPython, those are just a bunch
On Thu, Jul 16, 2020 at 12:59 PM wrote:
> Recently I have been thinking about why `JavaScript` with it's horrible
> type system and lots of edge cases has supported so many platform and is
> very fast ...
> First answer is simple, because big companies such as Google, Facebook and
> so on evolve
If we get this function (which I would like), the version with k items
(default 1) is much better. Some iterators cannot be repeated at all, so
not only is it slower to call multiple times if you need k>1, it's
impossible.
On Mon, Jul 13, 2020, 8:37 AM David Mertz wrote:
>
This is an inefficient reservoir sampling. The optimized version does not
need to call a random inclusion switch on every element, but can skip a
geometrically ordered collection of (random) skip lengths to avoid most
random inclusion decisions.
Obviously, all items must be iterated over no matter
On Sat, Jul 11, 2020 at 4:24 PM Christopher Barker
wrote:
> NOTE: I've wanted for ages to make a "PYSON" format / module for when JSON
> is not quite enough. e.g. distinction between lists and tuples, dict keys
> that aren't strings
>
https://github.com/jsonpickle/jsonpickle
You're not the
On Sat, Jul 11, 2020 at 4:33 PM David Mertz wrote:
> In any case, if "reservoir sampling" is the goal here, we should just add
> a function `random.reservoir_sample()` to accommodate using iterators
> rather than sequences (https://en.wikipedia.org/wiki/Reservoir_sampl
On Sat, Jul 11, 2020 at 3:45 PM Christopher Barker
wrote:
> random.choice(the_dict.keys())
>
> is a little easier than:
>
> random.choice(list(the_dict.keys())
>
Ummm... don't you mean:
random.choice(list(the_dict))
If it's keys you care about I've saved you one character over your proposed
st
On Sat, Jul 11, 2020 at 3:45 PM Christopher Barker
wrote:
> On Fri, Jul 10, 2020 at 12:45 PM David Mertz wrote:
> > The strongest argument I've seen is: `list(d.items())` adds six
> characters.
>
> 1) Matching our mental model / usability: if I want the nth item (or a
>
Definitely -1 after reading all the discussion.
The strongest argument I've seen is: `list(d.items())` adds six characters.
So far, there's absolutely nothing described that cannot easily be
accomplished with list(). Moreover, even apart from the work of maintaining
the feature itself, the attrac
This class or closure to clamp at specific bounds is nice. But I want to
clamp based on runtime values for upper/lower fairly often. A function is
much better for that use.
On Wed, Jul 8, 2020, 11:22 AM Jonathan Fine wrote:
> Hi All
>
> This is related to discussion
> https://mail.python.org/arc
On Sun, Jul 5, 2020, 10:25 PM Steven D'Aprano wrote:
> > The standard library *does* seem to have taken pains to avoid
> "finite nans."
>
> I don't know what you mean by "finite nans". By definition, any NAN is not
> considered finite.
>
The scare quotes because I know that's not a real thing. M
On Sun, Jul 5, 2020 at 10:04 PM Christopher Barker
wrote:
> Since you brought that up -- I recall a lot of debate about whether NaN's
> should be considered missing values or "poisoning" in the statistics module
> -- there are arguments for both, and neither was clear or obvious. So using
> NaN t
On Sun, Jul 5, 2020 at 9:38 PM Steven D'Aprano wrote:
> > >I agree with you that `clamp(lower=x, value=NAN, upper= x)` should
> > >return x.
>
> Sorry Greg, on this point at least the IEEE-754 standard is firm: if a
> function will return the same result for every non-NAN argument, then it
> must
On Sun, Jul 5, 2020 at 8:57 PM Steven D'Aprano wrote:
> On Sun, Jul 05, 2020 at 12:15:27PM -0400, David Mertz wrote:
> > This is a digression, but does anyone have a nice example IN PYTHON of
> > arriving at a NaN without going through infinity. I think Julia is right
>
On Sun, Jul 5, 2020, 3:51 PM Chris Angelico wrote:
> On Mon, Jul 6, 2020 at 2:15 AM David Mertz wrote:
> >
> > This is a digression, but does anyone have a nice example IN PYTHON of
> arriving at a NaN without going through infinity. I think Julia is right
> and Python is w
This is a digression, but does anyone have a nice example IN PYTHON of
arriving at a NaN without going through infinity. I think Julia is right
and Python is wrong about '0/0', but as things are, that's not an example.
On Sun, Jul 5, 2020, 12:05 PM Chris Angelico wrote:
> On Mon, Jul 6, 2020 at
A large number of topics have come up that wish to make Python more
"fluent" (https://en.wikipedia.org/wiki/Fluent_interface). This is an
example of the same general idea. In every single case, the goal has been
almost universally rejected as opposite Python's attitude.
Converting fun(a) to a.fu
On Sun, Jun 28, 2020, 10:19 AM Jeff Allen
> Now the commit message is the thing that causes me to write. It contains
a long justification for the change. It need only have said that we've
decided not to enforce S&W rules. It is somewhat offensive, since it
asserts as fact an opinion the community e
e actually
removes subjectivity about what's clear either.
On Sat, Jun 27, 2020, 1:24 AM Steven D'Aprano wrote:
> On Sat, Jun 27, 2020 at 12:37:35AM -0400, David Mertz wrote:
>
> > Objectively, could I have dropped "most"? Both "most famous"?
> >
&g
Objectively, could I have dropped "most"? Both "most famous"?
Could you have dropped "still," objectively?
On Sat, Jun 27, 2020, 12:34 AM Steven D'Aprano wrote:
> On Fri, Jun 26, 2020 at 11:36:47PM -0400, David Mertz wrote:
> > On Fri, Ju
On Fri, Jun 26, 2020, 8:40 PM Steven D'Aprano wrote:
> "Clear and easily understandable" is subjective. What is clear and
> understandable to me may be impenetrably confusing to others, or
> obnoxiously dumbed down.
>
Strunk and White's most famous mandate of "omit needless words" is likewise
su
Your minor change is certainly an improvement. _The Elements of Style_ (
https://en.wikipedia.org/wiki/The_Elements_of_Style) is certainly a good
text, but it's not even actually a style guide in the formal sense.
On Fri, Jun 26, 2020 at 5:26 PM Keara Berlin wrote:
> Hi all, this is a very smal
How on earth is "count()" not easily available?
On Fri, Jun 19, 2020 at 12:23 PM wrote:
> Proposal:
> range(start, ..., step)
> should function like
> itertools.count(start, step)
>
> Reason:
> It's pretty common to see people do things where they increment a count
> within a while True loop, an
Apart from not making it clear that allow_nan=False is about RFC compliance
whether than for some other purpose, it also doesn't mean what it says. The
argument really means "allow_nan_and_infs."
On Wed, Jun 17, 2020, 8:18 AM Greg Ewing
wrote:
> On 17/06/20 5:42 pm, David
On Wed, Jun 17, 2020, 1:30 AM Steven D'Aprano wrote:
> What exactly is getting in the way here? Standards do change. One standard
> (JSON) is not capable of representing all values from another standard
> (IEEE-754). Removing NANs and INFs would break floating point software
> everywhere, and a l
On Tue, Jun 16, 2020 at 11:55 PM Christopher Barker
wrote:
> Well, maybe not "Decimal", but it IS, in fact decimal -- i.e. base 10 --
> it can only exactly represent values that can be exactly represented in
> base 10.
> Which is why, performance aside, it would be better if a JSON number
> mapp
On Tue, Jun 16, 2020, 8:42 PM Steven D'Aprano wrote:
> Please forgive the stupid question, but given that the JSON standard is so
> obviously broken (being unable to serialise valid values from a supported
> type, what on earth were they thinking???), wouldn't all this time and
> energy be better
On Sun, Jun 14, 2020 at 7:49 PM Oscar Benjamin
wrote:
> > > I've had occasion to use math.isclose(), np.isclose(), and
> np.allclose()
> > > quite often.
> > Can you elaborate a bit on the kinds of things you use them for?
>
> I can't elaborate on David's use but in my own experience these
> func
On Sun, Jun 14, 2020, 10:22 AM Greg Ewing
wrote:
> On 15/06/20 12:39 am, Sebastian M. Ernst wrote:
> > It's such a common problem when dealing with floating point numbers
>
> Is it really? I've done quite a lot of work with floating
> point numbers, and I've very rarely needed to compare two
> of
On Wed, Jun 10, 2020, 8:04 PM Jonathan Crall wrote:
> I wouldn't mind if this *only *worked for the specific characters
> "print".
>
I often swap out 'print' for 'pprint', depending on the presentation I'm
assuming for. Obviously, I need a 'from pprint import pprint' earlier. It
"just works" and
I think I have almost the same feeling as Naomi and Gregory. After 10+
years of print statement being an error, typing it as one remains my SECOND
most common syntax error.
My FIRST most common is omitting the colon that introduces blocks... Which
we also don't actually need. I've made that mistak
On Fri, May 29, 2020 at 5:06 PM Dominik Vilsmeier
wrote:
> I'm still struggling to imagine a real use case which can't already be
> solved by generators. Usually the purpose of such computation graphs is to
> execute on some specialized hardware or because you want to backtrack
> through the grap
On Fri, May 29, 2020 at 1:56 PM Rhodri James wrote:
> Presumably "delayed" is something that would be automatically applied to
> the actual parameter given, otherwise your call graphs might or might
> not actually be call graphs depending on how the function was called.
> What happens if I call "
On Fri, May 29, 2020 at 1:12 PM Alex Hall wrote:
> def foo(a=17, b=42,, x=delayed randint(0,9), y=delayed randrange(1,100)):
>
>> if something:
>> # The simple case is realizing a direct delayed
>> val = concretize x
>> elif something_else:
>> # This line creates a
> > Where do we draw the line? How much of the behaviour of the
> > function do we want to move into the header?
>
> Well obviously we don't draw the line until we've fallen down the
> slippery slope and the entire body of the function is part of the
> header!
>
Sure, what's the problem? :-)
def
On Fri, May 29, 2020 at 3:19 AM Stephen J. Turnbull <
turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> # Just too ugly for me!
> def foo(x=lambda: random.randint(0,9)):
>
> x = x()
> # ...
>
I think this is a perfect example of where my desired "delayed" (or
"deferred") const
I agree with Paul's sentiment. We do not need to bless just one way of
writing scripts. Code review or organization style guides, sure. But not at
language level.
I also write scripts with no explicit __main__. But I rarely name them as
.py. In the style of Unix commands, they have no extension, b
On Thu, May 28, 2020, 3:06 PM Chris Angelico wrote:
> There aren't multiple entry points, though. There would be multiple
> blocks of code that are skipped if the module is imported, but
> executed if it's run as a script. Remember, Python code is NOT
> declarative. That 'def' statement is an act
On Thu, May 28, 2020, 12:17 PM wrote:
> The OP is proposing as a possibility: "we could require user to have only
> one if __name__ == '__main__':". In that case, functionality will be
> reduced, won't it?
>
I don't support the proposal. However, I've also never written a script
with multiple 'i
On Tue, May 26, 2020 at 8:30 PM Greg Ewing
wrote:
> "Did the user supply a value for this optional argument?" is
> a simple and reasonable question to ask. It deserves to have a
> simple and direct way of answering it that always works.
>
It does so very little that I would definitely not want s
On Tue, May 26, 2020 at 12:53 PM Steven D'Aprano
wrote:
> >>> len(Undef)
> TypeError: len() takes exactly one argument (0 given)
>
> since len takes no default values. But if Undef is considered to be an
> actual object, like any other object, we ought to get this:
>
JavaScript and R, fo
On Tue, May 26, 2020 at 12:02 PM Dominik Vilsmeier
wrote:
> The NumPy, deque, and lru_cache cases are all ones where None is a perfect
>> sentinel and the hypothetical 'undef' syntax would have zero value.
>
> For both `deque` and `lru_cache` None is a sensible argument so it can't
> act as a sen
is always a sentinel.
On Tue, May 26, 2020, 4:48 AM Dominik Vilsmeier
wrote:
> On 26.05.20 06:03, David Mertz wrote:
>
> On Mon, May 25, 2020, 11:56 PM Christopher Barker
>
>> well, yes and no. this conversation was in the context of "None" works
>> fine most of t
You mean the sentinel is called 'undef'? With undef-coallescing operators?
On Tue, May 26, 2020, 2:14 AM Greg Ewing
wrote:
> Wild idea: Instead of sentinels, have a way of declaring optional
> arguments with no default, and a way of conditionally assigning a
> value to them if they are not bound
On Mon, May 25, 2020, 11:56 PM Christopher Barker
> well, yes and no. this conversation was in the context of "None" works
> fine most of the time.
>
How many functions take None as a non-sentinel value?! How many of that
tiny numbers do so only because they are poorly designed.
None already is
On Mon, May 25, 2020, 5:33 PM Christopher Barker
> see numba: http://numba.pydata.org/
>
> Also, I"m pretty sure one of the efforts to make a faster python was based
> on LLVM, but it didn't work out as well as hoped -- unladen swallow maybe?
>
Numba is great. Very easy and very fast. Pypy exper
Subject changed for tangent.
On Sun, May 24, 2020 at 4:14 PM Dominik Vilsmeier
wrote:
> output = []
> for x in data:
> a = delayed inc(x)
> b = delayed double(x)
> c = delayed add(a, b)
> output.append(c)
> total = sum(outputs) # concrete answer here.
>
> Obviously the simple ex
On Sun, May 24, 2020, 9:03 PM Rob Cliffe via Python-ideas
> In fact it's *more* intuitive than what we do now (evaluation is strictly
> left-to-right), as can be seen with composed functions:
>
> ((path)str)len
Forth was created in 1970. The idea isn't brand new.
C is two years newer (197
On Sun, May 24, 2020 at 6:56 PM Steven D'Aprano wrote:
> > I use bash a lot, and writing something like this is common:
> > cat data | sort | cut -d; -f6 | grep ^foo | sort -r | uniq -c
>
> And today's "Useless Use Of cat Award" goes to... :-)
>
> sort data | ...
>
> (What is it specifically
Tiimmy:
> Best I know, f@g applies g first in every language that implements a
>>
> composition operator, and in mathematics. While that may be arbitrary,
>> it's easy to remember: (f@g)(x) "looks a heck of a lot more like"
>> f(g(x)) than g(f(x))
>>
>
On Sun, May 24, 2020 at 5:39 PM Guido van R
On Sun, May 24, 2020, 5:11 PM Alex Hall
> But when you *read* a call to filter(), it's generally pretty obvious
> which argument is which, even if you don't remember the signature. You just
> need to see which one's callable or which one's iterable (few things are
> both). You can probably guess j
On Sun, May 24, 2020, 3:43 PM Guido van Rossum wrote:
> I’ve never been able to remember whether (f@g)(x) means f(g(x)) or
> g(f(x)). That pretty much kills the idea for me.
>
Well, it means whichever one the designers decide it should mean. But
obviously it's a thing to remember, and one that c
On Sun, May 24, 2020 at 12:36 PM Alex Hall wrote:
> OK, let's forget the colon. The point is just to have some kind of
> 'modifier' on the default value to say 'this is evaluated on each function
> call', while still having something that looks like `arg=`. Maybe
> something like:
>
> def fu
On Sun, May 24, 2020 at 11:21 AM Steven D'Aprano
wrote:
> > But how would you go about getting a .__matmul__ attribute onto all
> > functions. For ones you write yourselves, you could decorate them at
> > definition. What about all the other functions though.
>
> As a functional programming fan,
Changed subject line. This is far from original topic.
On Sun, May 24, 2020, 9:35 AM Ram Rachum wrote:
> What's wrong with using @? If I understand correctly, it's used for matrix
> multiplication, which is far enough from function composition to avoid
> confusion. And it's slightly similar visu
Hi Steven,
On Sun, May 24, 2020, 8:14 AM Steven D'Aprano
> sorted(paths, key=len∘str, reverse=True)
> *semi-wink*
>
Do you have an evil twin with whom you share email.
Yesterday you were arguing against functional programming style on the
grounds that filtering based on a predicate was too
Like several other commenters, I would expect len(path) to be its depth,
not the length of its string representation.
On Sun, May 24, 2020, 7:30 AM Ram Rachum wrote:
> Hi everyone,
>
> I submitted a PR today, and Serhiy decided it needs a discussion on
> python-ideas and agreement from core deve
On Sat, May 23, 2020, 10:54 AM Rob Cliffe via Python-ideas
> index_of(needle, haystack, key=func)
>
> Sounds like a list comprehension: [ needle for needle in haystack if
> func(needle) ]
>
The times it doesn't sound like a list comprehension is when you have a
million items in the list, 100k of
On Sat, May 23, 2020, 12:26 AM Steven D'Aprano
> Obviously not all such key functions are that simple and you may need to
> write a helper function, but the same applies to filter.
>
I like the key function much better than the predicate. In large part
that's because as soon as you say predicate,
On Fri, May 22, 2020 at 8:59 PM Steven D'Aprano wrote:
> > Why not just this (by object, not by its index, but that seems simpler):
> > >>> do_something(next(filter(pred, somelist)))
>
> Sure, that works too. But have you ever written it for real? I haven't.
> And having seen it, I'll probably fo
>
> After I answered that question, it dawned on me that I have probably
>
written something like that loop, or variations of it, a thousand times:
>
> for obj in somelist:
> if comparison(obj, needle):
> do_something(obj)
> break
>
Why not just this (by object,
As is... my editor looks like this. I don't type all those special things,
except once in a configuration file. But the "prettification" is handled
transparently when I type some ASCII sequences.
[image: Python-arrow.png]
> that’s nice ! it’s a real shame though, and a bit of a waste honestly,
On Thu, May 21, 2020, 5:51 PM Thierry Parmentelat <
thierry.parmente...@inria.fr> wrote:
> You are SERIOUSLY suggesting that typing 'Ctrl-Shift-U 2 1 9 2 ' is
> easier for me than typing '->' as I do now!?
>
> that’s not how I’d do it; and I dont think I said or suggested anything to
> that effect
You are SERIOUSLY suggesting that typing 'Ctrl-Shift-U 2 1 9 2 ' is
easier for me than typing '->' as I do now!?
And it remains easier if I use a different computer where I have to figure
out or remember some different way of getting the Unicode code point into
the editor?
The goal of this being
On Tue, May 19, 2020 at 8:43 PM Cameron Simpson wrote:
> >salt = salt.rstrip("=", maxstrip=2)
> >assert not salt.endswith("=")
>
> Reiterating the Python 3.9 suggestion, what about:
>
> salt2 = salt.cutsuffix(('==', '='))
>
You'd have to call cutsuffix twice. Valid base64 might end in one, tw
On Tue, May 19, 2020 at 3:50 PM Alex Hall wrote:
> Anyway, you could write:
> assert not salt.endswith("=" * 3) # at most 2 ='s allowed
> salt = salt.rstrip("=")
>
Yes, I *could* write that. It feels a bit more cryptic than the version I
mentioned. But it's fine.
--
The dead increasingly d
>
> I may be misunderstanding, but it sounds like = is not acceptable in the
> final result, so it's not enough to remove only 2 of 4 ='s. You want to
> make sure nothing messed up your string. So if the code existed, what you'd
> want is:
> ```
> assert salt.count("=") <= 2
> salt = salt.rstrip(
I did a couple greps of my git/ directory to see if I found examples.
Given that there are a couple ways one might achieve the effect now, I
don't necessarily find everything. But here's something in software I did
not write myself.
This is from ./JohnTheRipper/run/sspr2john.py. I found another
I think this would be useful, and doesn't break any backward
compatibility. I would have use for it from time to time myself.
On Tue, May 19, 2020 at 9:01 AM computermaster360 . <
computermaster...@gmail.com> wrote:
> I often find myself in a need of stripping only a specified amount of
> charac
On Sun, May 17, 2020 at 2:09 PM Nathan Schneider wrote:
> If you want a better metaphor: Some door handles include locks, others do
>> not. "Strict" ones have locks. So yes, it's possible to leave the lock in
>> the unlocked position, and then it functions pretty much the same as one
>> without
On Sun, May 17, 2020 at 12:22 PM Nathan Schneider
wrote:
> Let me attempt a metaphor, which won't be perfect but may help:
>
> The safety one gets from strictness is a bit like driving a car wearing a
> seat belt. It is not fundamentally different from driving a car without a
> seat belt, and in
On Thu, May 14, 2020, 11:20 PM Stephen J. Turnbull
> > I can teach a child why a glass will break permanently when you hit
> > it while a lake won’t by using the words “solid” and “liquid”.
>
> Terrible example, since a glass is just a geologically slow liquid. ;-)
>
It isn't though. I used to
A third-party module on PyPI for "fix-the-horrible-things-Outlook-does"
could be useful. There is no way the standard library can or should keep
up with the newest mangling techniques mail handlers employ in this week's
version.
I don't understand what you mean by the current interpreter not tell
On Sun, May 10, 2020 at 9:05 PM Steven D'Aprano wrote:
> On Sun, May 10, 2020 at 01:17:17PM -0700, Andrew Barnert via Python-ideas
> wrote:
> > (By the way, the reason I used -f rather than —fix is that I can’t
> > figure out how to get the iPhone Mail.app to not replace double
> > hyphens with a
I think it is a bad idea to change the design of Python because some
college professor teaching intro to programming very poorly might require
inappropriate tooling.
On Sun, May 10, 2020, 8:39 PM Jonathan Goble wrote:
> On Sun, May 10, 2020 at 8:08 PM David Mertz wrote:
>
>> Why w
Why would you use Word? LaTeX exists, and will export to PDF. Heck, the PDF
export from Jupyter is quite good (by way of LaTeX).
On Sun, May 10, 2020, 7:40 PM Jonathan Goble <
Several of the questions required us to write Bash scripts or Python
functions, and we were required to write all of that
401 - 500 of 1177 matches
Mail list logo