Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Peter Otten
Steven D'Aprano wrote: > and your code will break. Better and safer is: > > > def main(): # parse the args and call whatever function was selected > args = parser.parse_args(sys.argv[1:]) > try: > func = args.func > except AttributeError as err: > parser.print_help()

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Ian Kelly
On Dec 1, 2015 1:36 PM, "Rick Johnson" wrote: > > On Tuesday, December 1, 2015 at 1:55:59 AM UTC-6, Steven D'Aprano wrote: > > Python was never intended to be "merely" a teaching language. I think > > Guido's original vision was for it to be a glue language between C > > libraries, and a scri

Re: python response slow when running external DLL

2015-12-01 Thread jfong
Peter Otten at 2015/12/1 UTC+8 7:01:55PM wrote: > While the var_status.set() invoked from the second thread modifies some > internal data the main thread could kick in and modify (parts of) that same > data, thus bringing tkinter into an broken state. A simple example that > demonstrates the pr

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread boB Stepp
On Mon, Nov 30, 2015 at 7:00 PM, Steven D'Aprano wrote: > > Either way, vars() doesn't solve the problem. What problem does it solve? > I'm way out of my depth here (I normally post on Tutor, as Steve knows), but when I looked vars() up in Lutz's "Python Pocket Reference, 5th ed.", he ended his

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Ben Finney
Steven D'Aprano writes: > You misunderstand the koan. > > "There should be one way to do it" does not prohibit more than one > way. Further, that's omitting a very important modifier from the koan. Even without the parenthetical, the koan reads: There should be one obvious way to do it. S

Re: static variables

2015-12-01 Thread Steven D'Aprano
On Wed, 2 Dec 2015 12:16 pm, Erik wrote: > On 02/12/15 01:02, Steven D'Aprano wrote: >> On Tue, 1 Dec 2015 08:15 pm, Grobu wrote: >>> # - >>> >>> def test(arg=[0]): >>> ... print arg[0] >>> ... arg[0] += 1 >> Awesome! > > Hideous! > >> us

Re: static variables

2015-12-01 Thread Erik
On 02/12/15 01:02, Steven D'Aprano wrote: On Tue, 1 Dec 2015 08:15 pm, Grobu wrote: # - >>> def test(arg=[0]): ... print arg[0] ... arg[0] += 1 Awesome! Hideous! using a mutable default as static storage. Exposing something a calle

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Steven D'Aprano
On Tue, 1 Dec 2015 07:44 pm, Manolo Martínez wrote: > On 12/01/15 at 12:00pm, Steven D'Aprano wrote: >> I'm trying to understand why vars() exists. Does anyone use it? > > Well, I have this little podcast aggregator > (https://github.com/manolomartinez/greg) that I and a bunch of other > people u

Re: static variables

2015-12-01 Thread Steven D'Aprano
On Tue, 1 Dec 2015 08:15 pm, Grobu wrote: > Perhaps you could use a parameter's default value to implement your > static variable? > > Like : > # - > >>> def test(arg=[0]): > ... print arg[0] > ... arg[0] += 1 > ... Awesome! I'm not bein

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Steven D'Aprano
On Wed, 2 Dec 2015 07:33 am, Rick Johnson wrote: > On Tuesday, December 1, 2015 at 1:55:59 AM UTC-6, Steven D'Aprano wrote: >> Python was never intended to be "merely" a teaching language. I think >> Guido's original vision was for it to be a glue language between C >> libraries, and a scripting l

Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-01 Thread Skybuck Flying
It's not YOU doing it. Since you obviously don't understand that it's not worth reading anything else you wrote LOL. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Gregory Ewing
Rick Johnson wrote: the lie about: "THERE SHOULD BE ONE (AND PREFERABLY ONLY ONE) WAY TO DO IT!". You're misquoting the Zen. It says there should be one *obvious* way to do it. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: "Downloading"

2015-12-01 Thread Chris Angelico
On Wed, Dec 2, 2015 at 10:46 AM, Steven D'Aprano wrote: > On Wed, 2 Dec 2015 06:05 am, Random832 wrote: > >> On 2015-12-01, Steve Hayes wrote: >>> You download things FROM a computer, you upload them TO a computer. >> >> I'm a little bit confused as to what kinds of file transfers >> you think do

Re: "Downloading"

2015-12-01 Thread Steven D'Aprano
On Wed, 2 Dec 2015 06:05 am, Random832 wrote: > On 2015-12-01, Steve Hayes wrote: >> You download things FROM a computer, you upload them TO a computer. > > I'm a little bit confused as to what kinds of file transfers > you think don't have at least two endpoints. If you have a computer with tw

Re: python domain in China. This showed up on Python list

2015-12-01 Thread Steven D'Aprano
On Tue, 1 Dec 2015 10:49 pm, Laura Creighton wrote: > In a message of Tue, 01 Dec 2015 02:51:21 -0800, Chris Rebert writes: >>I hate to break it to you, but this seems to be just another of those >>come-ons spammed out by various scummy businesses that trawl WHOIS >>databases for people to scam in

Re: "Downloading"

2015-12-01 Thread Erik
On 01/12/15 23:28, Ian Kelly wrote: What about transfers that are initiated by neither? scp remote_host1:path/to/file remote_host2:path/to/destination Regardless of how the transfer is invoked, in traditional parlance the source uploads, the target downloads. Why is this on the Python list?

Re: "Downloading"

2015-12-01 Thread Chris Angelico
On Wed, Dec 2, 2015 at 10:28 AM, Ian Kelly wrote: > On Tue, Dec 1, 2015 at 5:05 PM, Chris Angelico wrote: >> On Wed, Dec 2, 2015 at 6:05 AM, Random832 wrote: >>> On 2015-12-01, Steve Hayes wrote: You download things FROM a computer, you upload them TO a computer. >>> >>> I'm a little bit c

Re: "Downloading"

2015-12-01 Thread Ian Kelly
On Tue, Dec 1, 2015 at 5:05 PM, Chris Angelico wrote: > On Wed, Dec 2, 2015 at 6:05 AM, Random832 wrote: >> On 2015-12-01, Steve Hayes wrote: >>> You download things FROM a computer, you upload them TO a computer. >> >> I'm a little bit confused as to what kinds of file transfers >> you think do

Re: "Downloading"

2015-12-01 Thread Chris Angelico
On Wed, Dec 2, 2015 at 6:05 AM, Random832 wrote: > On 2015-12-01, Steve Hayes wrote: >> You download things FROM a computer, you upload them TO a computer. > > I'm a little bit confused as to what kinds of file transfers > you think don't have at least two endpoints. >From some other computer to

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Erik
Apologies for self-replying, On 01/12/15 22:34, Erik wrote: what you're asking for is that the *container* object whose element is being assigned to is first queried as to whether it will accept a mutated element being assigned to it before that element is mutated. What I said above is rubbis

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Peter Otten
Manolo Martínez wrote: > Peter, thanks for taking the time to look into my code. > > On 12/01/15 at 11:40am, Peter Otten wrote: >> Manolo Martínez wrote: >> > def main(): # parse the args and call whatever function was >> selected >> > try: >> > ar

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Terry Reedy
On 12/1/2015 4:36 PM, Denis McMahon wrote: On Tue, 01 Dec 2015 16:18:49 -0500, Terry Reedy wrote: On 12/1/2015 3:32 PM, Denis McMahon wrote: On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: In the case of: tup[1] += [6, 7] what it's trying to do is: tup[1] = tup[1].__iadd__([

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Erik
On 01/12/15 21:37, Denis McMahon wrote: The assignment succeeds. That's imo a bug. If it's a TypeError to try and assign a value to tup[1], then tup[1] should not allow the mutated list to be assigned. Nothing got assigned. That original list object remains in that slot. However, it has been

Re: Pylint 1.5.0 / Astroid 1.4.1 released

2015-12-01 Thread Omar Abou Mrad
On Tue, Dec 1, 2015 at 1:42 AM, Claudiu Popa wrote: > Hello, > > > I'm happy to announce you the release of Pylint 1.5.0, > respectively Astroid 1.4.1. > > > > Claudiu > -- > https://mail.python.org/mailman/listinfo/python-list > Awesome! Congrats! -- https://mail.python.org/mailman/listinfo/p

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Denis McMahon
On Tue, 01 Dec 2015 14:44:38 -0600, Ian Kelly wrote: > On Tue, Dec 1, 2015 at 2:32 PM, Denis McMahon > wrote: >> On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: >> >>> In the case of: >>> >>> tup[1] += [6, 7] >>> >>> what it's trying to do is: >>> >>> tup[1] = tup[1].__iadd__([6, 7]) >>

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Manolo Martínez
Peter, thanks for taking the time to look into my code. On 12/01/15 at 11:40am, Peter Otten wrote: > Manolo Martínez wrote: > > def main(): # parse the args and call whatever function was > selected > > try: > > args = parser.parse_args(sys.argv[1:

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Denis McMahon
On Tue, 01 Dec 2015 16:18:49 -0500, Terry Reedy wrote: > On 12/1/2015 3:32 PM, Denis McMahon wrote: >> On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: >> >>> In the case of: >>> >>> tup[1] += [6, 7] >>> >>> what it's trying to do is: >>> >>> tup[1] = tup[1].__iadd__([6, 7]) >>> >>> tup

Re: I can't understand re.sub

2015-12-01 Thread Erik
On 01/12/15 05:28, Jussi Piitulainen wrote: A real solution should be aware of the actual structure of those lines, assuming they follow some defined syntax. I think that we are in violent agreement on this ;) E. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Rick Johnson
On Tuesday, December 1, 2015 at 10:56:27 AM UTC-6, John Gordon wrote: > Rick Johnson writes: > > Your lament does remind me of a pet peeve i have concerning Python, and > > that is, the lie about: "THERE SHOULD BE ONE (AND PREFERABLY ONLY ONE) > > WAY TO DO IT!". In fact, in python there is almost

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Terry Reedy
On 12/1/2015 3:32 PM, Denis McMahon wrote: On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: In the case of: tup[1] += [6, 7] what it's trying to do is: tup[1] = tup[1].__iadd__([6, 7]) tup[1] refers to a list, and the __iadd__ method _does_ mutate it, but then Python tries to put

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Ian Kelly
On Tue, Dec 1, 2015 at 2:32 PM, Denis McMahon wrote: > On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: > >> In the case of: >> >> tup[1] += [6, 7] >> >> what it's trying to do is: >> >> tup[1] = tup[1].__iadd__([6, 7]) >> >> tup[1] refers to a list, and the __iadd__ method _does_ mutate

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Denis McMahon
On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: > In the case of: > > tup[1] += [6, 7] > > what it's trying to do is: > > tup[1] = tup[1].__iadd__([6, 7]) > > tup[1] refers to a list, and the __iadd__ method _does_ mutate it, but > then Python tries to put the result that the method

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Rick Johnson
On Tuesday, December 1, 2015 at 1:55:59 AM UTC-6, Steven D'Aprano wrote: > Python was never intended to be "merely" a teaching language. I think > Guido's original vision was for it to be a glue language between C > libraries, and a scripting language. It's a well know fact that GvR was inspired

Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-01 Thread Ian Kelly
On Tue, Dec 1, 2015 at 12:49 PM, Steve Hayes wrote: > On Tue, 1 Dec 2015 03:19:39 +0100, "Skybuck Flying" > wrote: > >>Hello, >> >>The question is: >> >>Is Microsoft Windows secretly downloading childporn to your computer ?! > > You download things FROM a computer, you upload them TO a computer.

Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-01 Thread Keith Thompson
Steve Hayes writes: > On Tue, 1 Dec 2015 03:19:39 +0100, "Skybuck Flying" > wrote: >>The question is: >> >>Is Microsoft [snip] > > You download things FROM a computer, you upload them TO a computer. > > Since you don't even know that much about computers, anything else you > say is obviously not

Re: "Downloading"

2015-12-01 Thread Random832
On 2015-12-01, Steve Hayes wrote: > You download things FROM a computer, you upload them TO a computer. I'm a little bit confused as to what kinds of file transfers you think don't have at least two endpoints. -- https://mail.python.org/mailman/listinfo/python-list

activestate recipe for code to source and back fails on 3.3+, core Python bug?

2015-12-01 Thread Mark Lawrence
The recipe in question is here http://code.activestate.com/recipes/578353-code-to-source-and-back. I've called it c2sab in the test code below. The problem is that the class name gets dropped during the round trip, but only if a list, dict or set comprehension or a generator expression is inv

Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-01 Thread Steve Hayes
On Tue, 1 Dec 2015 03:19:39 +0100, "Skybuck Flying" wrote: >Hello, > >The question is: > >Is Microsoft Windows secretly downloading childporn to your computer ?! You download things FROM a computer, you upload them TO a computer. Since you don't even know that much about computers, anything els

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Mr Zaug
Ye, this does work. Many thanks! filename = "{NNN}_{BRAND}_farm.any".format(BRAND=brand, NNN=nnn) with open(filename, "w") as outstream: outstream.write(data) -- https://mail.python.org/mailman/listinfo/python-list

Re: 4D arrays

2015-12-01 Thread Peter Otten
jorge.conr...@cptec.inpe.br wrote: > I use the IDL but now I'm change to PYTHON. I have a 4D array (time, > level,lon,lat). I would like to get a 2D array for a specific time > (time1) and level (level1). In IDL I use: 2Darray = > 4Darray(time1,level1,*,*). How can I get the 2D array in Python Wi

4D arrays

2015-12-01 Thread jorge . conrado
Hi, I use the IDL but now I'm change to PYTHON. I have a 4D array (time, level,lon,lat). I would like to get a 2D array for a specific time (time1) and level (level1). In IDL I use: 2Darray = 4Darray(time1,level1,*,*). How can I get the 2D array in Python Conrado -- https://mail.python.or

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread John Gordon
In <4f0f7fc5-c93a-4223-9c05-e192a8faf...@googlegroups.com> Rick Johnson writes: > Your lament does remind me of a pet peeve i have concerning Python, and > that is, the lie about: "THERE SHOULD BE ONE (AND PREFERABLY ONLY ONE) > WAY TO DO IT!". In fact, in python there is almost always *MANY* wa

Re: Question about code writing '% i, callback'

2015-12-01 Thread Ian Kelly
On Mon, Nov 30, 2015 at 7:44 PM, Dennis Lee Bieber wrote: > On Mon, 30 Nov 2015 10:55:23 -0800 (PST), fl declaimed > the following: > >>Thanks Ian. I created the class because I want to use the original example >>line >> >> UI.Button("button %s" % i, callback) >> >>Is there another way to use the

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Peter Otten
Mr Zaug wrote: > That makes sense. > > So I still can't see how to write the string object to a file whist naming > the file with whatever values I provided for the NNN and BRAND variables. > > Printing the contents of the string object is working with all the > expected substitutions. Do I need

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Mr Zaug
That makes sense. So I still can't see how to write the string object to a file whist naming the file with whatever values I provided for the NNN and BRAND variables. Printing the contents of the string object is working with all the expected substitutions. Do I need to convert the string obje

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Peter Otten
Mr Zaug wrote: > Actually, I don't understand what you mean by "all other braces." What > braces are you talking about? The placeholders in the template file (the > file being read in) have braces around them but they are not escaped. The example you provide was $include "_dispatcher_publi

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Mr Zaug
Actually, I don't understand what you mean by "all other braces." What braces are you talking about? The placeholders in the template file (the file being read in) have braces around them but they are not escaped. Also, do I really need curly braces to tell Python what my placeholders are? --

Re: [Pylint-dev] Pylint 1.5.0 / Astroid 1.4.1 released

2015-12-01 Thread Claudiu Popa
On Tue, Dec 1, 2015 at 11:08 AM, Sylvain Thénault wrote: > On 01 décembre 01:42, Claudiu Popa wrote: >> Hello, > > Hi Claudiu, > >> I'm happy to announce you the release of Pylint 1.5.0, >> respectively Astroid 1.4.1. >> >> It's been over a year since the last major release >> and the amount of ch

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Mr Zaug
Oh, that's much easier to read. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: Exclude text within quotation marks and words beginning with a capital letter

2015-12-01 Thread Peter Otten
Kevin Glover wrote: > I am working on a program that is written in Python 2.7 to be compatible > with the POS tagger that I import from Pattern. The tagger identifies all > the nouns in a text. I need to exclude from the tagger any text that is > within quotation marks, and also any word that begi

Re: New JSON encoding method proposal for custom objects

2015-12-01 Thread cescus92
> At the same place where you already found python-list, or here: > > https://mail.python.org/mailman/listinfo/python-ideas Yeah, I've found it after a simple search.. I thought it was like an hidden place for just some python's guru lol! Thank you! :) -- https://mail.python.org/mailman/listi

Re: New JSON encoding method proposal for custom objects

2015-12-01 Thread Peter Otten
cescu...@gmail.com wrote: >> Go to python-ideas for a lengthy discussion ;) > Where can I find it? At the same place where you already found python-list, or here: https://mail.python.org/mailman/listinfo/python-ideas -- https://mail.python.org/mailman/listinfo/python-list

Re: New JSON encoding method proposal for custom objects

2015-12-01 Thread cescus92
Hello Burak, thank you for the reply. > FWIW, Spyne can to the exact same thing -- i.e. serialize an object > given its definition to whatever format you want. (currently xml, json, > yaml and msgpack are supported). My aim is to propose a built-in method to accomplish this common and simple task

Re: static variables

2015-12-01 Thread Ulli Horlacher
Wolfgang Maier wrote: > I'm wondering whether you have a good reason to stick with a function. Easy handling, no programming overhead. Clean, orthogonal code. > What you are trying to achieve seems to be easier and cleaner to > implement as a class: > > class Counter (object): > def __i

Re: python domain in China. This showed up on Python list

2015-12-01 Thread Laura Creighton
In a message of Tue, 01 Dec 2015 02:51:21 -0800, Chris Rebert writes: >I hate to break it to you, but this seems to be just another of those >come-ons spammed out by various scummy businesses that trawl WHOIS >databases for people to scam into buying extra/unnecessary domain >names. Google "chinese

Re: New JSON encoding method proposal for custom objects

2015-12-01 Thread Burak Arslan
hey, On 11/30/15 14:35, cescu...@gmail.com wrote: > > Hello everyone and thank you for your interest! > > The Peter's code is very similar to what I think the default JSON encoder > should be. > > The advantage of the method that I propose is that you should not care > anymore about which encode

Exclude text within quotation marks and words beginning with a capital letter

2015-12-01 Thread Kevin Glover
I am working on a program that is written in Python 2.7 to be compatible with the POS tagger that I import from Pattern. The tagger identifies all the nouns in a text. I need to exclude from the tagger any text that is within quotation marks, and also any word that begins with an upper case lett

Re: python response slow when running external DLL

2015-12-01 Thread Peter Otten
jf...@ms4.hinet.net wrote: > Peter Otten at 2015/11/28 UTC+8 6:14:09PM wrote: >> No, the point of both recipes is that tkinter operations are only ever >> invoked from the main thread. The main thread has polling code that >> repeatedly looks if there are results from the helper thread. As far I >

Re: python domain in China. This showed up on Python list

2015-12-01 Thread Chris Rebert
On Tue, Dec 1, 2015 at 2:10 AM, Laura Creighton wrote: > I think we have just dodged a bullet, let us now go thank the > nice people who sent us this and figure out how we should > secure the domain. > > Laura > > > --- Forwarded Message > > Return-Path: > Date: Tue, 1 Dec 2015 15:12:58 +0800

Re: Generate config file from template using Python search and replace.

2015-12-01 Thread Peter Otten
Mr Zaug wrote: > On Monday, November 30, 2015 at 4:14:48 AM UTC-5, Peter Otten wrote: >> Mr Zaug wrote: >> >> > On Sunday, November 29, 2015 at 5:50:51 PM UTC-5, Peter Otten wrote: >> >> Mr Zaug wrote: >> >> >> >> > When I run this script on OS X El Capitan, I see, >> >> > >> >> > # permiss

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Peter Otten
Manolo Martínez wrote: > On 12/01/15 at 12:00pm, Steven D'Aprano wrote: > > I'm trying to understand why vars() exists. Does anyone use it? > > Well, I have this little podcast aggregator > (https://github.com/manolomartinez/greg) that I and a bunch of other > people use. I started writing it som

Re: python domain in China. This showed up on Python list

2015-12-01 Thread Michiel Overtoom
Hi, > On 01 Dec 2015, at 11:10, Laura Creighton wrote: > > I think we have just dodged a bullet, let us now go thank the > nice people who sent us this and figure out how we should > secure the domain. I received exactly the same email a while ago, claiming that someone was registering the na

python domain in China. This showed up on Python list

2015-12-01 Thread Laura Creighton
I think we have just dodged a bullet, let us now go thank the nice people who sent us this and figure out how we should secure the domain. Laura --- Forwarded Message Return-Path: Date: Tue, 1 Dec 2015 15:12:58 +0800 From: "Ian Liu" To: Subject: python CN domain and keyword Message-ID: <

Re: static variables

2015-12-01 Thread Wolfgang Maier
On 01.12.2015 09:26, Ulli Horlacher wrote: Steven D'Aprano wrote: A better and more general test is: if hasattr(a, 'x'): print('attribute of a') Fine! I have now: def a(x=None): if not hasattr(a,'x'): a.x = 0 a.x += 1 print('%d:' % a.x,x) This simply counts the calls of a() But

Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-01 Thread Juha Nieminen
In comp.lang.c++ Skybuck Flying wrote: > Is Microsoft Windows secretly downloading childporn to your computer ?! No, because Microsoft is too smart to commit economical suicide. If a troyan/virus is doing so, that's not on Microsoft. --- news://freenews.netfront.net/ - complaints: n...@netfront

Re: [Pylint-dev] Pylint 1.5.0 / Astroid 1.4.1 released

2015-12-01 Thread Sylvain Thénault
On 01 décembre 01:42, Claudiu Popa wrote: > Hello, Hi Claudiu, > I'm happy to announce you the release of Pylint 1.5.0, > respectively Astroid 1.4.1. > > It's been over a year since the last major release > and the amount of changes that were brought into pylint > in this time is humongous, wit

Re: static variables

2015-12-01 Thread Grobu
Perhaps you could use a parameter's default value to implement your static variable? Like : # - >>> def test(arg=[0]): ... print arg[0] ... arg[0] += 1 ... >>> test() 0 >>> test() 1 # - -- ht

Re: static variables

2015-12-01 Thread Peter Otten
Ulli Horlacher wrote: > Steven D'Aprano wrote: > >> A better and more general test is: >> >> if hasattr(a, 'x'): print('attribute of a') > > Fine! > > I have now: > > def a(x=None): > if not hasattr(a,'x'): a.x = 0 > a.x += 1 > print('%d:' % a.x,x) > > This simply counts the calls of

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Manolo Martínez
On 12/01/15 at 12:00pm, Steven D'Aprano wrote: > I'm trying to understand why vars() exists. Does anyone use it? Well, I have this little podcast aggregator (https://github.com/manolomartinez/greg) that I and a bunch of other people use. I started writing it some years ago, and the code is a bit o

Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-01 Thread trolling tone
On 01.12.2015 03:19, Skybuck Flying wrote: Hello, The question is: Is Microsoft Windows secretly downloading childporn to your computer ?! How can you be sure ? It's closed source software. It's downloading all kinds of crap via Windows Update. Having childporn on your computer is a crime an

Re: static variables

2015-12-01 Thread Ulli Horlacher
Steven D'Aprano wrote: > A better and more general test is: > > if hasattr(a, 'x'): print('attribute of a') Fine! I have now: def a(x=None): if not hasattr(a,'x'): a.x = 0 a.x += 1 print('%d:' % a.x,x) This simply counts the calls of a() But, when I rename the function I have to renam

python CN domain and keyword

2015-12-01 Thread Ian Liu
(Please forward this to your CEO, because this is urgent. Thanks) We are a Network Service Company which is the domain name registration center in Shanghai, China. On Nov 30, 2015, we received an application from Huasu Holdings Ltd requested "python" as their internet keyword and China (CN) dom

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Steven D'Aprano
On Tuesday 01 December 2015 18:22, eryk sun wrote: > On Mon, Nov 30, 2015 at 7:00 PM, Steven D'Aprano > wrote: >> Either way, vars() doesn't solve the problem. What problem does it solve? > > vars() used to be the way to list local variables. Oh, snap! Nice bit of detective work. So it's basica

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread Steven D'Aprano
On Tuesday 01 December 2015 16:54, Rick Johnson wrote: > On Monday, November 30, 2015 at 7:01:14 PM UTC-6, Steven D'Aprano wrote: >> I'm trying to understand why vars() exists. Does anyone use it? > > I think your "mental dilemma" stems from the fact that python was > originally created to be an