On Thu, Feb 2, 2017 at 7:01 AM, wrote:
> from random import *
>
>
>
> def randfloat(x , y , maxfloatpt=None):
>
> if x > y:
>
> x , y = y , x
>
> lenx = len(str(x))
>
> leny = len(str(y))
>
> intx = int(x)
>
> inty = int(y)
>
> bigger =
On Aug 20, 2016 2:27 AM, "Alexander Heger" wrote:
> The point is it does not try to disassemble it into elements as it would
do with other iterables
>
> >>> np.array([1,2,3])
> array([1, 2, 3])
> >>> np.array([1,2,3]).shape
> (3,)
It isn't so much that strings are special, it's
a
missile to hammer in a nail.)
On Oct 14, 2016 9:46 AM, "Franklin? Lee" <leewangzhong+pyt...@gmail.com>
wrote:
>
> On Oct 14, 2016 9:14 AM, "Gustavo Carneiro" <gjcarne...@gmail.com> wrote:
> >
> > Sorry if I missed the boat, but only just now
On Oct 14, 2016 9:14 AM, "Gustavo Carneiro" wrote:
>
> Sorry if I missed the boat, but only just now saw this PEP.
>
> Glancing through the PEP, I don't see mentioned anywhere the SQL
alternative of having a coalesce() function:
On Fri, Mar 31, 2017 at 3:58 AM, Chris Angelico wrote:
> This keeps on coming up in one form or another - either someone
> multiplies a list of lists and ends up surprised that they're all the
> same, or is frustrated with the verbosity of the alternatives.
>
> Can we use the
On Fri, May 26, 2017 at 2:45 PM, Stephan Houben wrote:
> Hi all,
>
> The itertools.tee function can hold on to objects "unnecessarily".
> In particular, if you do
>
> iter2 = itertools.tee(iter1, 2)[0]
>
> i.e. you "leak" one of the returned iterators, then all returned
>
Consider the following code, which creates a generator that
immediately returns 1, and then catches the StopIteration twice.
def generatorfunction():
if False: yield
return 1
def get_return(gen):
try:
next(gen)
except StopIteration as e:
> hanging on to the exception object longer than necessary was not in our best
> interest.
>
> On Mon, Dec 11, 2017 at 1:10 AM, Franklin? Lee
> <leewangzhong+pyt...@gmail.com> wrote:
>>
>> Consider the following code, which creates a generator that
>> immediately ret
On Mon, Dec 11, 2017 at 6:44 PM, Yury Selivanov <yselivanov...@gmail.com> wrote:
> On Mon, Dec 11, 2017 at 6:21 PM, Franklin? Lee
> <leewangzhong+pyt...@gmail.com> wrote:
>> What about hanging onto just the value, and creating new StopIteration
>> instances instead
The topic reminded me of Stephan Houben's streamtee.
https://github.com/stephanh42/streamtee/blob/master/streamtee.py
It was an attempt at a memory-efficient tee, but it turned out tee was
efficient enough. It uses a thunk-like method and recursion to remove
the need for an explicit linked list.
On Mon, May 14, 2018 at 8:35 PM, Steven D'Aprano wrote:
> I'm hoping that the arguments for assignment expressions will be over by
> Christmas *wink* so as a partial (and hopefully less controversial)
> alternative, what do people think of the idea of flagging certain
>
On Mon, May 21, 2018 at 7:40 PM, Steven D'Aprano wrote:
> On Mon, May 21, 2018 at 09:43:45AM -0700, Mike Miller wrote:
>> To clarify there were three main criteria, and one minor. Newer,
>> popular/becoming industry standard, and designed to address shortcomings in
>>
I assume there can't be space between the backslash and the name, to
prevent ambiguity like in the following:
# Is this `foo = not [1]` or `foo = \not[1]`?
foo = (\
not[1])
A sampling of \ in other languages, for consideration:
- Haskell: A lambda. E.g. `\x -> x+1`
- TeX: A
On Wed, Jun 13, 2018 at 8:15 PM, Greg Ewing wrote:
> Chris Angelico wrote:
>>
>> This would want to be semantically different from chained
>> calls, in that a single replace([x,y,z], q) would avoid re-replacing;
>
>
> +1, this would be REALLY handy!
>
> It's easy to trip yourself up with chained
On Thu, Jun 14, 2018 at 2:12 AM, Brendan Barnwell wrote:
> On 2018-06-13 22:29, Steven D'Aprano wrote:
>>
>> On Wed, Jun 13, 2018 at 10:59:34PM +0200, Michel Desmoulin wrote:
>>
>>> > Attaching an entire module to a type is probably worse than
>>> > adding a slew of extra methods to the type.
>>>
Would guards (such as from the switch-case discussions) be a good fit?
try:
...
except RuntimeError as e if e.message == "tie":
...
On Thu, May 31, 2018, 00:48 Danilo J. S. Bellini
wrote:
> Hi!
> I was working on handling some exceptions from external software
> (e.g. database
On Wed, Jun 20, 2018, 00:05 Serhiy Storchaka wrote:
> 19.06.18 22:18, James Edwards пише:
> > I've only recently looked for these special methods, so that in and of
> > itself may be the reason these methods aren't exposed, but I could think
> > of objects that may wish to implement __min__ and
On Wed, Jun 27, 2018, 10:31 Steven D'Aprano wrote:
> On Wed, Jun 27, 2018 at 06:52:14AM -0700, Michael Selik wrote:
>
> > > > Have you ever written ``max(range(x))`` in production code?
> > >
> > > I have never written that.
> > >
> > > But I have written ``max(iterable)`` dozens of times, where
On Wed, Jun 27, 2018 at 11:30 AM, Michael Selik wrote:
> On Wed, Jun 27, 2018 at 8:16 AM Franklin? Lee
> wrote:
>>
>> On Wed, Jun 27, 2018, 10:31 Steven D'Aprano wrote:
>>>
>>> On Wed, Jun 27, 2018 at 06:52:14AM -0700, Michael Selik wrote:
>>> >
On Tue, Jun 26, 2018 at 11:34 AM, Franklin? Lee
wrote:
> On Wed, Jun 20, 2018, 00:05 Serhiy Storchaka wrote:
>>
>> 19.06.18 22:18, James Edwards пише:
>> > I've only recently looked for these special methods, so that in and of
>> > itself may be the reason th
On Fri, Dec 29, 2017 at 11:25 PM, Steven D'Aprano wrote:
> On Sat, Dec 30, 2017 at 02:56:46AM +1100, Chris Angelico wrote:
>> On Sat, Dec 30, 2017 at 2:38 AM, Steven D'Aprano wrote:
>> > The lack of support for the `in` operator is a major difference,
On Sun, Dec 31, 2017 at 12:09 PM, MRAB wrote:
> On 2017-12-31 08:13, Paddy3118 wrote:
>>
>> Hmm, yea I had not thought of how it would look - I had thought formost of
>> not needing to necessarily learn about bitsets.when learning about passing a
>> large number of
On Mon, Feb 5, 2018 at 6:04 AM, Paul Moore wrote:
> On 5 February 2018 at 08:10, Steve Barnes wrote:
>> When a new version of python is in alpha/beta it is often desirable to
>> have it installed for tests but remain on a previous version for day to
On Thu, Feb 8, 2018 at 5:45 AM, Franklin? Lee
<leewangzhong+pyt...@gmail.com> wrote:
> On Feb 7, 2018 17:28, "Serhiy Storchaka" <storch...@gmail.com> wrote:
> > The name of complicated str methods is regular expressions. For doing these
> > operations effi
On Feb 8, 2018 13:06, "Serhiy Storchaka" <storch...@gmail.com> wrote:
08.02.18 12:45, Franklin? Lee пише:
> Could it be that re uses an optimization that can also be used in str?
> CPython uses a modified Boyer-Moore for str.find:
> https://github.com/python/cpython/b
On Feb 7, 2018 17:28, "Serhiy Storchaka" <storch...@gmail.com> wrote:
04.02.18 00:04, Franklin? Lee пише:
Let s be a str. I propose to allow these existing str methods to take
> params in new forms.
>
> s.replace(old, new):
> Allow passing in a collection o
On Sat, Feb 3, 2018 at 6:43 PM, Terry Reedy <tjre...@udel.edu> wrote:
> On 2/3/2018 5:04 PM, Franklin? Lee wrote:
>>
>> Let s be a str. I propose to allow these existing str methods to take
>> params in new forms.
>
>
> Thanks for the honest title. As you sor
Let s be a str. I propose to allow these existing str methods to take
params in new forms.
s.replace(old, new):
Allow passing in a collection of olds.
Allow passing in a single argument, a mapping of olds to news.
Allow the olds in the mapping to be tuples of strings.
s.split(sep),
On Thu, Feb 8, 2018 at 11:24 AM, Steve Dower wrote:
> Easily fixed by installing one of the alternate regex libraries.
MRAB's regex library, the most prominent alternative, does not use the
linear-time search algorithm. The only libraries I know that do are
the ones with
On Thu, Dec 28, 2017 at 5:21 AM, William Rose wrote:
> I agree with the point that it should allow builtin but the main purpose of
> it is to not allow global variables
But functions are also accessed using global names. What is your
answer to the potential problem of
On Fri, Dec 29, 2017 at 1:01 AM, Chris Angelico <ros...@gmail.com> wrote:
> On Fri, Dec 29, 2017 at 1:31 PM, Franklin? Lee
> <leewangzhong+pyt...@gmail.com> wrote:
>> On Thu, Dec 28, 2017 at 5:21 AM, William Rose <william27.07...@gmail.com>
>> wrote:
>&
On Mon, Dec 18, 2017 at 8:31 AM, Steve Barnes wrote:
>
> On 18/12/2017 11:43, Steven D'Aprano wrote:
>> On Mon, Dec 18, 2017 at 07:54:17AM +, Steve Barnes wrote:
>>
>>> Isn't this exactly the sort of information already available via
>>> inspect.getardspec,
On Sat, Dec 23, 2017, 09:23 William Rose, wrote:
>
> I had an idea that it could be helpful to have local functions as well as
> normal ones. They would be called the same way as normal ones but def would
> be replaced by internal and inside they could only access
On Thu, Sep 6, 2018 at 2:23 PM Chris Angelico wrote:
>
> On Fri, Sep 7, 2018 at 4:11 AM, Franklin? Lee
> wrote:
> > On Tue, Aug 28, 2018 at 6:37 PM Greg Ewing
> > wrote:
> >>
> >> Guido van Rossum wrote:
> >> > we might propose (as the OP
On Tue, Aug 28, 2018 at 6:37 PM Greg Ewing wrote:
>
> Guido van Rossum wrote:
> > we might propose (as the OP did) that this:
> >
> > a, b, c += x, y, z
> >
> > could be made equivalent to this:
> >
> > a += x
> > b += y
> > c += z
>
> But not without violating the principle that
>
>
n Thu, Sep 6, 2018 at 2:47 PM Chris Angelico wrote:
>
> On Fri, Sep 7, 2018 at 4:38 AM, Franklin? Lee
> wrote:
> > The following are equivalent and compile down to the same code:
> > a, b, c = lst
> > [a, b, c] = lst
> >
> > The left hand side is n
On Fri, Sep 7, 2018 at 2:22 PM Rhodri James wrote:
>
> Top posting for once, since no one is quoting well in this thread:
>
> Does this in any way answer David's question? I'm serious; you've spent
> a lot of words that, as best I can tell, say exactly nothing about how
> keyword arguments would
On Mon, Jul 9, 2018 at 12:22 PM, Chris Barker wrote:
> On Fri, Jul 6, 2018 at 12:26 PM, Franklin? Lee I use this kind of function
>> I added several options, such as:
>> - key function
>> - value function
>> - "ignore": Skip values with these keys.
>>
(Fixing quote and attribution.)
On Fri, Jul 6, 2018, 11:32 Chris Barker - NOAA Federal via
Python-ideas wrote:
>
> On Jul 6, 2018, at 2:10 AM, Steven D'Aprano wrote:
>
> > On Fri, Jul 06, 2018 at 09:49:37AM +0100, Cammil Taank wrote:
> > > I would consider statistics
>
> > > to have
On Thu, Jul 5, 2018 at 1:23 AM, Chris Barker via Python-ideas
wrote:
> On Wed, Jul 4, 2018 at 6:34 AM, David Mertz wrote:
>
>>
>> You've misunderstood part of the discussion. There are two different
>> signatures being discussed/proposed for a grouping() function.
>>
>> The one you show we might
Instead of extending Counter to fit fancier usecases, why not have a
new class that is designed for arithmetic?
I, for one, would love Numpy-style list and dict classes in the
standard library. And they wouldn't be confusingly called Counter, and
have strange behaviors with negative values.
I
On Fri, Sep 21, 2018 at 10:52 AM Elazar wrote:
>
>
>
> On Fri, Sep 21, 2018, 16:56 Philipp A. wrote:
>>
>> The main clause differentiating bad, weaponizable CoCs from good ones is
>>
>> "Assume good faith"
>>
>> Everything will be OK if good faith can reasonably be assumed (E.g. when
>> someone
Ew, magic. `{{foo}}` is already valid syntax (though it will always
fail). I don't like this path. If the proposal requires new syntax or
magic, it will be less likely to get accepted or even pip'd. Remember
also that PyPy, IronPython, and Jython are still alive, and the latter
two are still
Those arguments are rules of thumb, which may or may not apply to DbC,
and speculation, based on why DbC isn't more popular, to explain why
DbC isn't more popular. They are general arguments for features in
general, whereas Marko has been giving arguments for why DbC in
particular is good or why
On Sun, Sep 23, 2018 at 2:05 AM Marko Ristin-Kaufmann
wrote:
>
> Hi,
>
> (I'd like to fork from a previous thread, "Pre-conditions and
> post-conditions", since it got long and we started discussing a couple of
> different things. Let's discuss in this thread the implementation of a
> library
Ah. It wasn't clear to me from the thread that James was using `inspect`.
As it happens, not only does getsource give more than it should, it
also gives less than it should. The following bug still exists in
3.6.1. It was closed as a wontfix bug back in Python 2 because, I
presume, fixing it
I am very disappointed with the responses to this thread. We have
mockery, dismissiveness, and even insinuations about OP's
psychological health. Whether or not OP is a troll, and whether or not
OP's idea has merit, that kind of response is unnecessary and
unhelpful.
(While I lean toward OP being
On Sun, Sep 16, 2018 at 4:14 AM Antoine Pitrou wrote:
>
> Yeah, right.
>
> You know, when I was pointing out Calvin not being very brave by
> attacking a bunch of people without giving names, my aim was to merely
> point out how dishonest and disrespectful his attitude his. *Not* to
> encourage
On Mon, Sep 17, 2018 at 10:50 AM Jacco van Dorp wrote:
>
> Op ma 17 sep. 2018 om 16:40 schreef Wes Turner :
>>
>> I think it's meant to be ironic?
>>
>> Why would that be the first sentence of a poem about software and the Python
>> newsgroup/mailing list community?
>>
>> A certain percentage of
Monty Python had the goal of making people laugh, while python-ideas
has the goal of improving Python. With those priorities, we can have
fun, but not at the expense of potential contributions and
contributors.
Other people aren't perfect, but sometimes you have to adapt to them
for the sake of
On Tue, Sep 18, 2018 at 2:37 PM Jonathan Goble wrote:
>
> On Tue, Sep 18, 2018, 2:00 PM Franklin? Lee
> wrote:
>>
>> On Tue, Sep 18, 2018 at 11:02 AM Jonathan Goble wrote:
>> >
>> > The biggest moderation issue I see with mailing lists is the inability
On Tue, Sep 18, 2018 at 11:02 AM Jonathan Goble wrote:
>
> On Tue, Sep 18, 2018 at 10:49 AM Robert Vanden Eynde
> wrote:
>>
>> About moderation, what's the problem on the list ?
>
>
> The biggest moderation issue I see with mailing lists is the inability to
> lock threads and delete posts
On Tue, Sep 18, 2018 at 8:21 PM James Lu wrote:
>
> > Is that really an issue here? I personally haven't seen threads where
> > Brett tried to stop an active discussion, but people ignored him and
> > kept fighting.
> Not personally with Brett, but I have seen multiple people try to stop the
>
On Sun, Sep 16, 2018 at 2:04 PM Antoine Pitrou wrote:
>
> On Sun, 16 Sep 2018 13:32:26 -0400
> "Franklin? Lee"
> wrote:
> > On Sun, Sep 16, 2018 at 4:14 AM Antoine Pitrou wrote:
> > >
> > > Yeah, right.
> > >
> > > You know, when I
On Mon, Sep 17, 2018 at 3:17 AM Jacco van Dorp wrote:
>
> Op zo 16 sep. 2018 om 05:40 schreef Franklin? Lee
> :
>>
>> Jacco:
>> - This is completely disrespectful and way over the line. Don't try to
>> make a psychological evaluation from two emails, especially
On Tue, Jun 18, 2019 at 5:01 AM Emin Bugra Saral via Python-ideas
wrote:
>
> `<:` kind of notation would look more clear, I agree.
>
> My proposition came after thinking the wording used in Python.
>
> issubclass() - is subclass?
>
> By definition, subclass reminds me set theory.
>
n 19, 2019, 15:19 Chris Angelico wrote:
> On Thu, Jun 20, 2019 at 4:31 AM Guido van Rossum wrote:
> >
> > On Wed, Jun 19, 2019 at 11:27 AM Chris Angelico
> wrote:
> >>
> >> On Thu, Jun 20, 2019 at 2:07 AM Franklin? Lee
> >> wrote:
> >> > For exam
On Fri, Jun 14, 2019, 13:49 Brett Cannon wrote:
> I think the logic breaks down with multiple inheritance. If you make C(A, B),
> then you can say C > A and C > B, but then you can't say A > B or A < B which
> breaks sorting.
The logic is fine. Classes can be considered as containers of their
On Sun, Jun 16, 2019 at 8:58 AM Dan Sommers
<2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 6/16/19 7:49 AM, Franklin? Lee wrote:
>
> > On Sat, Jun 15, 2019 at 10:26 PM Guido van Rossum
> wrote:
>
> >> I don't actually know how viable this proposal is, but
On Sat, Jun 15, 2019 at 10:26 PM Guido van Rossum wrote:
> I don't actually know how viable this proposal is, but given that it's being
> debated at some length, I'd like to put in my opinion that *if* we're going
> to define an operator that's (roughly) synonymous with issubclass(), it
>
60 matches
Mail list logo