Re: Getting a dictionnary from a module's variables

2017-07-28 Thread Gregory Ewing
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

Re: zipapp should not include temporary files?

2017-07-28 Thread Irmen de Jong
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.

Re: Installation Python 3.6.x on Windows using command line installer (without GUI)

2017-07-28 Thread Irmen de Jong
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

Re: zipapp should not include temporary files?

2017-07-28 Thread Irmen de Jong
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

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-28 Thread Ho Yeung Lee
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

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-28 Thread Ho Yeung Lee
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

Re: Falsey Enums

2017-07-28 Thread Ethan Furman
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.

Re: Recent Spam problem

2017-07-28 Thread Skip Montanaro
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.

Re: Getting a dictionnary from a module's variables

2017-07-28 Thread ast
"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

Getting a dictionnary from a module's variables

2017-07-28 Thread ast
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

Re: Falsey Enums

2017-07-28 Thread Chris Angelico
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'

Re: Falsey Enums

2017-07-28 Thread Steve D'Aprano
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

Re: Falsey Enums

2017-07-28 Thread Rustom Mody
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

Re: Falsey Enums

2017-07-28 Thread Ben Finney
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

Re: Falsey Enums

2017-07-28 Thread Ethan Furman
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

Re: Falsey Enums

2017-07-28 Thread Paul Rubin
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