ast wrote:
dir(config) provides a list, some processing is needed to
remove some __identifiers__ and get a dict
Is there a simple way to do that, without processing ?
Here's an alternative that leverages the import machinery.
d = {}
exec("from config import *", d)
del d['__builtin
On 28/07/2017 18:36, Irmen de Jong wrote:
> On 27/07/2017 00:03, Paul Moore wrote:
>> If you want to create a feature request for a filter function on
>> bugs.python.org and assign it to me, I'll take a look at it. \
>
>
> I will do this, thanks in advance.
Should have included a link perhaps.
On 27/07/2017 20:55, Andreas Jung wrote:
>
> I need to installed Python 3.6.x on Windows as part of an automated process
> without user-interaction. Recently Python releases provided MSI files for
> installation using the "msiexec" utility however there are no more MSI
> release files available
On 27/07/2017 00:03, Paul Moore wrote:
> On Wednesday, 26 July 2017 18:37:15 UTC+1, Irmen de Jong wrote:
>> What do you think? Should the zipapp module perhaps be improved to
>> automatically skip
>> obvious temporary files or perhaps allow to provide a filter function?
> If you want to create
actually i used in this application
if same color is neighbor like connected then group them
i use for segmentation of words in screen capture
https://stackoverflow.com/questions/45294829/how-to-group-by-function-if-any-one-of-the-group-members-has-neighbor-relationsh
i asked here too, but i do
actually i used in this application
if same color is neighbor like connected then group them
i use for segmentation of words in screen capture
https://stackoverflow.com/questions/45294829/how-to-group-by-function-if-any-one-of-the-group-members-has-neighbor-relationsh
i asked here too, but i do
On 07/28/2017 01:13 AM, Ben Finney wrote:
Ethan Furman writes:
class X(Enum):
Falsey = 0
Truthy = 1
Fakey = 2
def __bool__(self):
return bool(self.value)
I am surprised this is not already the behaviour of an Enum class,
without overriding the ‘__bool__’ method.
Yes, it's more "leaky," though that's not quite the term I'd use. Instead,
I'd say there are fewer checks. On the mailing list side of things, you
have all the Postfix bells and whistles, which stop a ton of crap, much of
it before the message is officially entered into the mail.python.org
system.
"ast" a écrit dans le message de
news:597b31fb$0$4823$426a3...@news.free.fr...
I answer to myself
import config
dico = {k:v for k, v in vars(conf).items() if not (k.startswith('__') or
k.endswith('__'))}
that's not so difficult
--
https://mail.python.org/mailman/listinfo/python-list
Hello
I have a file conf.py which only contains some
variables definition like that:
a = 7
b = 9
c = 3
In my main program I would like to get a dictionnary
dico = {'a' :7,'b':9, 'c':3}
I tried:
import conf
dico = vars(conf)
but there is among a huge amount of stuff to remove
dir(config) pro
On Fri, Jul 28, 2017 at 8:28 PM, Steve D'Aprano
wrote:
> On Fri, 28 Jul 2017 05:52 pm, Ethan Furman wrote:
>
>> class X(Enum):
>> Falsey = 0
>> Truthy = 1
>> Fakey = 2
>> def __bool__(self):
>> return bool(self.value)
>
> Thanks Ethan.
>
> Like Ben, I'm surprised that'
On Fri, 28 Jul 2017 05:52 pm, Ethan Furman wrote:
> class X(Enum):
> Falsey = 0
> Truthy = 1
> Fakey = 2
> def __bool__(self):
> return bool(self.value)
Thanks Ethan.
Like Ben, I'm surprised that's not the default behaviour.
--
Steve
“Cheer up,” they said, “thing
On Friday, July 28, 2017 at 1:45:46 PM UTC+5:30, Ben Finney wrote:
> Ethan Furman writes:
>
> > class X(Enum):
> > Falsey = 0
> > Truthy = 1
> > Fakey = 2
> > def __bool__(self):
> > return bool(self.value)
>
> I am surprised this is not already the behaviour of an Enum c
Ethan Furman writes:
> class X(Enum):
> Falsey = 0
> Truthy = 1
> Fakey = 2
> def __bool__(self):
> return bool(self.value)
I am surprised this is not already the behaviour of an Enum class,
without overriding the ‘__bool__’ method.
What would be a good reason not to hav
On 07/27/2017 07:15 PM, Steve D'Aprano wrote:
I has some Enums:
from enum import Enum
class X(Enum):
Falsey = 0
Truthy = 1
Fakey = 2
and I want bool(X.Falsey) to be False, and the others to be True. What should I
do?
class X(Enum):
Falsey = 0
Truthy = 1
Fakey = 2
Dan Sommers writes:
> def __bool__(self):
> return False if self == X.Falsey else True
return self != X.Falsey
--
https://mail.python.org/mailman/listinfo/python-list
16 matches
Mail list logo