Re: [Tutor] class methods as static methods?

2010-05-29 Thread Mark Lawrence
Hi Alex, thanks for the response, please see below. On 30/05/2010 02:50, Alex Hall wrote: On 5/29/10, Mark Lawrence wrote: On 29/05/2010 20:49, Alex Hall wrote: Hi all, In Battleship, I have a weapons.py file, currently with just one missile type (a Harpoon anti-ship missile). This Harpoon cl

Re: [Tutor] SENTINEL, & more

2010-05-29 Thread Steven D'Aprano
On Sat, 29 May 2010 06:29:43 pm spir ☣ wrote: > I'll try to clarify the purpose and use of sentinels with an example. > Please, advanced programmers correct me. A point is that, in > languages like python, sentinels are under-used, because everybody > tends to une None instead, or as all-purpose s

Re: [Tutor] class methods as static methods?

2010-05-29 Thread Steven D'Aprano
On Sun, 30 May 2010 05:49:45 am Alex Hall wrote: > Hi all, > In Battleship, I have a weapons.py file, currently with just one > missile type (a Harpoon anti-ship missile). This Harpoon class > defines a getImpactCoords method, which returns all coordinates on > the map that it will hit. I would lik

Re: [Tutor] class methods as static methods?

2010-05-29 Thread Alex Hall
On 5/29/10, Mark Lawrence wrote: > On 29/05/2010 20:49, Alex Hall wrote: >> Hi all, >> In Battleship, I have a weapons.py file, currently with just one >> missile type (a Harpoon anti-ship missile). This Harpoon class defines >> a getImpactCoords method, which returns all coordinates on the map >>

Re: [Tutor] class methods as static methods?

2010-05-29 Thread Mark Lawrence
On 29/05/2010 20:49, Alex Hall wrote: Hi all, In Battleship, I have a weapons.py file, currently with just one missile type (a Harpoon anti-ship missile). This Harpoon class defines a getImpactCoords method, which returns all coordinates on the map that it will hit. I would like to not instantiat

Re: [Tutor] SENTINEL, & more

2010-05-29 Thread Eike Welk
Hey Denis! On Saturday May 29 2010 10:29:43 spir ☣ wrote: > I'll try to clarify the purpose and use of sentinels with an example. > Please, advanced programmers correct me. A point is that, in languages > like python, sentinels are under-used, because everybody tends to une None > instead, or

Re: [Tutor] class methods as static methods?

2010-05-29 Thread Lie Ryan
On 05/30/10 05:49, Alex Hall wrote: > Hi all, > In Battleship, I have a weapons.py file, currently with just one > missile type (a Harpoon anti-ship missile). This Harpoon class defines > a getImpactCoords method, which returns all coordinates on the map > that it will hit. I would like to not inst

[Tutor] class methods as static methods?

2010-05-29 Thread Alex Hall
Hi all, In Battleship, I have a weapons.py file, currently with just one missile type (a Harpoon anti-ship missile). This Harpoon class defines a getImpactCoords method, which returns all coordinates on the map that it will hit. I would like to not instantiate a Harpoon object, just call the Harpoo

Re: [Tutor] SENTINEL, & more

2010-05-29 Thread Lie Ryan
On 05/29/10 18:29, spir ☣ wrote: > Hello, > > > from the thread: "class methods: using class vars as args?" > > On Sat, 29 May 2010 11:01:10 +1000 Steven D'Aprano > wrote: > >> On Fri, 28 May 2010 07:42:30 am Alex Hall wrote: >>> Thanks for all the explanations, everyone. This does make sense,

Re: [Tutor] Homework Problem

2010-05-29 Thread Alan Gauld
"Shawn Blazer" wrote This problem told me to use map and filter, so how would I use that to solve it? Because its homework we won't solve it for you, we will only answer questions or suggest approaches. From your earlier post it looks like you have all the tools: recursion, map and filte

[Tutor] SENTINEL, & more

2010-05-29 Thread spir ☣
Hello, from the thread: "class methods: using class vars as args?" On Sat, 29 May 2010 11:01:10 +1000 Steven D'Aprano wrote: > On Fri, 28 May 2010 07:42:30 am Alex Hall wrote: > > Thanks for all the explanations, everyone. This does make sense, and > > I am now using the > > if(arg==None): arg

Re: [Tutor] list of dicts <-> dict of lists?

2010-05-29 Thread Matthew Wood
On Fri, May 28, 2010 at 6:55 PM, Steven D'Aprano wrote: > On Fri, 28 May 2010 12:00:46 pm Matthew Wood wrote: > > > I THOUGHT the guaranteed same-ordering of dict.keys and dict.values > > started in python 2.6. That was a simple mistake. > > > > It turns out, that's not the case. But in general,

Re: [Tutor] Homework Problem

2010-05-29 Thread spir ☣
On Fri, 28 May 2010 19:11:13 -0400 "Shawn Blazer" wrote: > > This problem told me to use map and filter, so how would I use that to > solve it? [some piece of interactive session] > Thanks! So, where's the problem? Denis vit esse estrany ☣ spir.wikidot.com