Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread eryk sun
On Sun, Jun 19, 2016 at 4:04 AM, Danny Yoo wrote: > >> def f((x,y), z): > ... print x, y, z > ... >> f([1, 2], 3) > 1 2 3 Note that Python 3 doesn't support tuple parameter unpacking. See PEP 3113: https://www.python.org/dev/peps/pep-3113 ___ Tu

Re: [Tutor] Correct use of model-view-controller design pattern

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 11:18 PM, boB Stepp wrote: > On Sun, May 29, 2016 at 9:28 AM, Peter Otten <__pete...@web.de> wrote: > >> Here's a commandline example with two views (the circle-drawing routine has >> to be fixed)... > > I have to admit that now that I have finally gotten around to your > c

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread Danny Yoo
One other thing to add: the notion of pattern matching is often used in mathematics. For example, if we want to define a function that does something special to even numbers vs. odd numbers, it's not uncommon to see the following when we want to describe a function `f`: for `n` in the natural num

Re: [Tutor] Correct use of model-view-controller design pattern

2016-06-18 Thread boB Stepp
On Sun, May 29, 2016 at 9:28 AM, Peter Otten <__pete...@web.de> wrote: > Here's a commandline example with two views (the circle-drawing routine has > to be fixed)... I have to admit that now that I have finally gotten around to your code, I am left scratching my head. My main issue is what am I

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread Danny Yoo
> You know Steve, as I was typing the beginning of a reply responding to > a similar question you asked earlier in your response, I suddenly > realized how ridiculous having a parameter of 'col/2' is! I'll just > have either eat crow or attribute this to a brain fart. You pick! Just to play dev

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 9:10 PM, Steven D'Aprano wrote: > On Sat, Jun 18, 2016 at 02:04:46PM -0500, boB Stepp wrote: > Can you explain what you expected > > def d(row, col/2) > > to mean? I have literally no idea. You know Steve, as I was typing the beginning of a reply responding to a similar q

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread Steven D'Aprano
On Sat, Jun 18, 2016 at 02:04:46PM -0500, boB Stepp wrote: > I have (Finally!) gotten a bit of time to look at Peter's answer to my > Model-View-Controller question from May 29th, particularly his > CircleImageView class to which he added a "#FIXME" comment. I thought > it would be helpful to abbr

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread Alan Gauld via Tutor
On 18/06/16 20:04, boB Stepp wrote: > py3: def d(row, col/2, radius=5): > File "", line 1 > def d(row, col/2, radius=5): > ^ > SyntaxError: invalid syntax > > And this surprised me. It seems that only identifiers are allowed as > parameters in a function definition statem

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 3:14 PM, Joel Goldstick wrote: > On Sat, Jun 18, 2016 at 3:04 PM, boB Stepp wrote: >> Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 >> 64 bit (AMD64)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >> py3: def d(

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread Joel Goldstick
On Sat, Jun 18, 2016 at 3:04 PM, boB Stepp wrote: > I have (Finally!) gotten a bit of time to look at Peter's answer to my > Model-View-Controller question from May 29th, particularly his > CircleImageView class to which he added a "#FIXME" comment. I thought > it would be helpful to abbreviate h

[Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread boB Stepp
I have (Finally!) gotten a bit of time to look at Peter's answer to my Model-View-Controller question from May 29th, particularly his CircleImageView class to which he added a "#FIXME" comment. I thought it would be helpful to abbreviate his distance function in the interpreter while I played arou

Re: [Tutor] Turtle

2016-06-18 Thread Steven D'Aprano
On Fri, Jun 17, 2016 at 11:25:40PM -0700, Hershel Millman wrote: > Hello tutors, > > I have been learning basic python on my Macintosh computer and > everything I have tried so far has worked, except when I tried to use > the turtle module. I then used my Linux computer and the turtle module >

Re: [Tutor] help with comparing list of tuples in python 2

2016-06-18 Thread Peter Otten
Lulu J wrote: > Hi there, > > My apologies if this is a trivial question but I am sort of new to python. > Here is my problem: > I have a list of dictionaries. Each dictionary has a word and its position > in the text the positions are in the form of a tuple. > Here is an example: > [ > {'positi

Re: [Tutor] help with comparing list of tuples in python 2

2016-06-18 Thread Michael Selik
On Fri, Jun 17, 2016, 6:12 PM Lulu J wrote: > Hi there, > > My apologies if this is a trivial question but I am sort of new to python. > Here is my problem: > I have a list of dictionaries. Each dictionary has a word and its position > in the text the positions are in the form of a tuple. > Here

[Tutor] Turtle

2016-06-18 Thread Hershel Millman
Hello tutors, I have been learning basic python on my Macintosh computer and everything I have tried so far has worked, except when I tried to use the turtle module. I then used my Linux computer and the turtle module still did not work. I tried to use the command line and type "sudo dnf instal