Re: What is a function parameter =[] for?

2015-11-22 Thread Steven D'Aprano
On Monday 23 November 2015 10:43, Gregory Ewing wrote: > Steven D'Aprano wrote: >> Memoisation isn't "esoteric", it is a simple, basic and widely-used >> technique used to improve performance of otherwise expensive functions. > > That may be true, but I don't think it's a good example > of a use

[RELEASED] Python 3.5.1rc1 is now available

2015-11-22 Thread Larry Hastings
On behalf of the Python development community and the Python 3.5 release team, I'm pleased to announce the availability of Python 3.5.1rc1. Python 3.5.1 will be the first update for Python 3.5. Python 3.5 is the newest version of the Python language, and it contains many exciting new featur

testfixtures 4.5.1 Released!

2015-11-22 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 4.5.1. This release that contains: - LogCapture, OutputCapture and TempDirectory explicitly show what is expected versus actual when reporting differences as of 4.5.0. - The 4.5.1 release contains a bugfix where OutputCapture cou

Re: What is a function parameter =[] for?

2015-11-22 Thread BartC
On 23/11/2015 00:04, Mark Lawrence wrote: On 22/11/2015 23:44, Steven D'Aprano wrote: On Mon, 23 Nov 2015 12:21 am, BartC wrote: But if it's used for static storage, then why not just use static storage? That's a simpler and more general concept than memoisation. /head-desk "But if it's use

Re: What is a function parameter =[] for?

2015-11-22 Thread Chris Angelico
On Mon, Nov 23, 2015 at 11:04 AM, Mark Lawrence wrote: > What happened to "Please do not feed the trolls"? Hey, Norwegian researchers get hungry too you know! https://en.wikipedia.org/wiki/Troll_(research_station) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there an meaning of '[[]]' in a list?

2015-11-22 Thread Joel Goldstick
On Sun, Nov 22, 2015 at 6:25 PM, Quivis wrote: > On Thu, 19 Nov 2015 12:40:17 +0100, Peter Otten wrote: > > > those questions that are a little harder > > And just how is he going to determine what is hard? > -- > _ __ __ __ __ __ __ __ > (( )) || || || \\ // || (( > \\_/X| \\_// |

Re: What is a function parameter =[] for?

2015-11-22 Thread Mark Lawrence
On 22/11/2015 23:44, Steven D'Aprano wrote: On Mon, 23 Nov 2015 12:21 am, BartC wrote: But if it's used for static storage, then why not just use static storage? That's a simpler and more general concept than memoisation. /head-desk "But if it's used for cooking, why not just cook? That's a

Re: What is a function parameter =[] for?

2015-11-22 Thread Steven D'Aprano
On Mon, 23 Nov 2015 12:21 am, BartC wrote: > But if it's used for static storage, then why not just use static > storage? That's a simpler and more general concept than memoisation. /head-desk "But if it's used for cooking, why not just cook? That's a simpler and more general concept than roasti

Re: What is a function parameter =[] for?

2015-11-22 Thread Gregory Ewing
Steven D'Aprano wrote: Memoisation isn't "esoteric", it is a simple, basic and widely-used technique used to improve performance of otherwise expensive functions. That may be true, but I don't think it's a good example of a use for a shared, mutable default value, because it's arguably an *abus

Re: What is a function parameter =[] for?

2015-11-22 Thread Gregory Ewing
BartC wrote: What's bothering me is: ... * The insistence (I think largely from Steven) that the way this feature works is good rather than bad Here's one reason to prefer the way it currently works: It's rare to want a mutable default value. The vast majority of default values are simple t

Re: Comparators

2015-11-22 Thread Chris Angelico
On Mon, Nov 23, 2015 at 9:01 AM, Quivis wrote: > On Sun, 22 Nov 2015 10:00:51 +1100, Chris Angelico wrote: > >> I recommend creating a text file of notes. Every time you learn >> something new, add it to your notes file - and commit the change to git. >> Then, when you come back to the file, you'l

Re: anyone tell me why my program will not run?

2015-11-22 Thread Larry Hudson via Python-list
On 11/21/2015 06:44 PM, Larry Hudson wrote: On 11/20/2015 07:30 PM, Dylan Riley wrote: i am learning python and was tasked with making a program that flips a coin 100 times and then tells you the number of heads and tails. [snip] import random heads = int("1") tails = int("2") flips = 100

Re: anyone tell me why my program will not run?

2015-11-22 Thread John Gordon
In <1737402a-2f4d-440a-abd7-6cc500f67...@googlegroups.com> Dylan Riley writes: > heads = int("1") Why are you taking the int value of a string constant? If you know you want the value 1, why not just use it directly? > flips = 100 > headscount = 0 > tailscount = 0 > while flips != 0: > f

Re: What is a function parameter =[] for?

2015-11-22 Thread BartC
On 22/11/2015 13:21, BartC wrote: On 22/11/2015 03:43, Steven D'Aprano wrote: Quite frankly, to call it such demonstrates a considerable level of ignorance about basic programming idioms. Not just Python, but general purpose programming. I've come to learn that basic idioms are best. I may

Re: What is a function parameter =[] for?

2015-11-22 Thread BartC
On 22/11/2015 03:43, Steven D'Aprano wrote: On Fri, 20 Nov 2015 10:59 pm, BartC wrote: On 20/11/2015 01:05, Steven D'Aprano wrote: Here's another use for function defaults, as static storage: [...] This is a quick and easy way to memoise a function which would otherwise be horribly slow. A

ANN: yubistorm

2015-11-22 Thread Nagy László Zsolt
YubiStorm provides a simple module that can be used from a Tornado server to authenticate users with YubiCloud authentication servers. The PyPi package contains the module for the API only. The repository contains an example web server that can be used to understand how YubiCloud authentication

Re: What is a function parameter =[] for?

2015-11-22 Thread Marko Rauhamaa
Steven D'Aprano : > Really? Astonishing. To me, the Ackermann's function is a > straight-forward, simple example. I must admit I have not once in my life written an implementation of the Ackermann function. > Whereas this initiate_query example is the opposite of > straight-forward. It involves

Re: What is a function parameter =[] for?

2015-11-22 Thread Steven D'Aprano
On Fri, 20 Nov 2015 11:39 pm, BartC wrote: > What's bothering me is: > > * The large amount of mumbo-jumbo used to describe what's going on Just because you don't know the terminology doesn't make it mumbo-jumbo. That's a particularly unfair and unjustified response to make when multiple peopl

Re: What is a function parameter =[] for?

2015-11-22 Thread Steven D'Aprano
On Fri, 20 Nov 2015 11:53 pm, BartC wrote: > On 20/11/2015 12:28, Marko Rauhamaa wrote: >> Even more appropriately, you may expressly want a mutable, singleton >> object to be the default: >> >> def initiate_query(query, database=global_database): > > Finally, a down-to-earth example. Reall