On 10 June 2018 at 07:59, Michel Desmoulin
wrote:
> What I'm proposing is to make that easy to implement by just letting
> anyone put a check in there.
>
> Overriding policy, loops or tasks factories are usually down for
> critical parts of the system. The errors emerging from a bug in there
>
On Sat, Jun 09, 2018 at 09:17:37AM -0400, Juancarlo Añez wrote:
> > Do you mean the context manager semantics of with statements? As in,
> > calling the __enter__ and __exit__ method?
> >
>
> No. Just the scope of the variables introduced, which is different in `with
> as` and `except as`.
They
>
> IMHO, it is not any framework's job to check for this. It is a
> programmer error.
Not clearing the memory is a programmer error either but a gc helps.
Not closing a file either but using `with` help.
Not passing the proper type is a programmer error but we have type hints.
We even
On 9 June 2018 at 19:20, Michel Desmoulin wrote:
> Given 2 callables checking when a condition arises and returning True:
>
> def starting_when(element):
> ...
>
> def ending_when(element:
> ...
> Allow:
>
> a_list[starting_when:]
>
> To be equivalent to:
>
> from
On Sat, Jun 9, 2018 at 2:22 AM Adam Bartoš wrote:
> The idea was that the functions could handle the PiMultiple instances in a
> special way and fall back to float only when a special value is not detected.
> It would be like the proposed dsin functionality, but with a magic class
> instead
On Sat, Jun 9, 2018 at 6:28 AM Michel Desmoulin
wrote:
> Example, open this files, load all lines in memory, skip the first line,
> then get all the line until the first comment:
>
> import itertools
>
> def is_commented(line):
> return lines.startwith('#')
>
> def lines():
>
Le 09/06/2018 à 12:33, Andrew Svetlov a écrit :
> If we consistently apply the idea of hook for internal python structure
> modification too many things should be changed. Import
> machinery, tracemalloc, profilers/tracers, name it.
> If your code (I still don't see the real-life example) wants
Le 09/06/2018 à 11:47, Steven D'Aprano a écrit :
> On Sat, Jun 09, 2018 at 11:17:05AM +0200, Michel Desmoulin wrote:
>> Such as that:
>>
>> def starting_when(element):
>> ...
>>
>> a_list[starting_when:]
>
>> Is equivalent to:
> [...]
>> list(dropwhile(lambda x: not
> Do you mean the context manager semantics of with statements? As in,
> calling the __enter__ and __exit__ method?
>
No. Just the scope of the variables introduced, which is different in `with
as` and `except as`.
> Please make sure you are very familiar with PEP 572 before you do, and
>
On Sat, Jun 09, 2018 at 08:43:47AM -0400, Juancarlo Añez wrote:
> Hello @here,
>
> Is there a guide about writing (and publishing) PEPs?
https://www.python.org/dev/peps/pep-0001/
> I'd like to write one on `while expre as v: ...` using the context
> semantics of `with expr as v` (not `except E
On 2018-06-09 14:43, Juancarlo Añez wrote:
Is there a guide about writing (and publishing) PEPs?
https://www.python.org/dev/peps/pep-0001/
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Hello @here,
Is there a guide about writing (and publishing) PEPs?
I'd like to write one on `while expre as v: ...` using the context
semantics of `with expr as v` (not `except E as e`).
Cheers,
___
Python-ideas mailing list
Python-ideas@python.org
On Wed, Jun 06, 2018 at 07:05:35PM +0100, Barry Scott wrote:
> I assume the the idea is that everybody has Path available without the need
> to do the import dance first.
>
> If its for personal convenience you can always do this trick, that is used by
> gettext to make _ a builtin.
>
> import
Given 2 callables checking when a condition arises and returning True:
def starting_when(element):
...
def ending_when(element:
...
Allow:
a_list[starting_when:]
To be equivalent to:
from itertools import dropwhile
list(dropwhile(lambda x: not
On Sat, Jun 09, 2018 at 03:07:39PM +1000, Nick Coghlan wrote:
> It's doable without code generation hacks by using class statements instead
> of with statements.
>
> The withdrawn PEP 422 shows how to use a custom metaclass to support a
> "namespace" keyword argument in the class header that
Classes Provide already some features of a namespace :
class cool_namespace:
A = 8
@staticmethod
def f():
return "yo"
@staticmethod
def g():
return (1 + cool_namespace.A) * cool_namespace.f()
And if you're tired of writing @staticmethod, you can write a
On Fri, Jun 08, 2018 at 02:41:54PM -0400, David Teresi wrote:
> One of the features I miss from languages such as C# is namespaces that
> work across files - it makes it a lot easier to organize code IMO.
I too have often wanted a sub-module namespace without the need to
separate code into
Creating built in dynamically is not a good idea. Tools complain, new
comers wonder where it comes from, it sets a precedent for adding more
or debating about it.
Better have the debate once here, make it official or decline it
officially, and have a clean result.
Le 08/06/2018 à 21:28, Barry a
On Fri, Jun 08, 2018 at 03:07:28PM -0700, Michael Selik wrote:
> You can use ``eval`` to run an expression, swapping in a different globals
> and/or locals namespace. Will this serve your purpose?
>
> In [1]: import types
> In [2]: ns = types.SimpleNamespace(a=1)
> In [3]: eval('a', ns.__dict__)
The benefit of list, dict, and set comprehensions and generator expressions
is that they evaluate, as opposed to simply exec. The purpose of making
them one-liners is to allow them to be assigned to a variable or passed as
an argument.
If you're not assigning or passing, then why not use a
20 matches
Mail list logo