Re: another newbie question

2010-11-20 Thread Anssi Saari
Roy Smith r...@panix.com writes: I'm still searching for as nice a font to use on Linux. Envy Code R is a lookalike, so maybe worth considering. I haven't tried actual Monaco on Linux, but apparently it's possible. Personally, I use -lfp-gamow-medium-r-*-*-7-*-*-*-*-*-*-* in Linux (Emacs). --

Re: another newbie question

2010-11-20 Thread Slie
I really enjoyed it when I put the MacOsx font on my Ubuntu or any other. Anssi Saari a...@sci.fi wrote: Roy Smith r...@panix.com writes: I'm still searching for as nice a font to use on Linux. Envy Code R is a lookalike, so maybe worth considering. I haven't tried actual Monaco on Linux,

Re: another newbie question

2010-11-15 Thread Neil Cerutti
On 2010-11-14, Roy Smith r...@panix.com wrote: Then, there are people who try to program in proportional fonts. The mind boggles. For a (thankfully short) while some years ago, people were publishing programming books with the code samples in proportional fonts. Blech. I kinda like it, but

another newbie question

2010-11-14 Thread otenki
Hello Pythonistas! I'm trying to get floating point division to work; I'm using Python 2.6.5. When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. How can I rectify this? Sorry for this basic question, but I don't know where else to

Re: another newbie question

2010-11-14 Thread Nitin Pawar
From the error, you are importing wrong module which actually does not exists try importing something from maths On Sun, Nov 14, 2010 at 8:21 PM, otenki scott.stephen...@gmail.com wrote: Hello Pythonistas! I'm trying to get floating point division to work; I'm using Python 2.6.5. When I

Re: another newbie question

2010-11-14 Thread Tim Golden
On 14/11/2010 3:00 PM, Nitin Pawar wrote: I'm trying to get floating point division to work; I'm using Python 2.6.5. When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. How can I rectify this? That should be two underscores, not

Re: another newbie question

2010-11-14 Thread Peter Otten
otenki wrote: Hello Pythonistas! I'm trying to get floating point division to work; I'm using Python 2.6.5. When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. How can I rectify this? You need two leading/trailing underscores,

Re: another newbie question

2010-11-14 Thread David
On 15/11/2010, otenki scott.stephen...@gmail.com wrote: When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. The module name is __future__ Notice that there are 2 underscore characters before the word future and 2 after it. This is

Re: another newbie question

2010-11-14 Thread otenki
On Nov 14, 10:09 am, David bouncingc...@gmail.com wrote: On 15/11/2010, otenki scott.stephen...@gmail.com wrote: When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. The module name is __future__ Notice that there are 2

Re: another newbie question

2010-11-14 Thread Roy Smith
In article mailman.986.1289747396.2218.python-l...@python.org, David bouncingc...@gmail.com wrote: On 15/11/2010, otenki scott.stephen...@gmail.com wrote: When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. The module name is

Re: another newbie question

2010-11-14 Thread MRAB
On 14/11/2010 16:40, Roy Smith wrote: In articlemailman.986.1289747396.2218.python-l...@python.org, Davidbouncingc...@gmail.com wrote: On 15/11/2010, otenkiscott.stephen...@gmail.com wrote: When I enter 'from _future_ import division' at the command line, I get the ImportError, no module

Re: interacting with shell - another newbie question

2007-02-12 Thread Hertha Steck
James Stroud schrieb: Yes, and finding ways to have employees pointlessly waste time is equal to simply removing them. Not as long as they are paid for the wasted time. -- http://mail.python.org/mailman/listinfo/python-list

Re: interacting with shell - another newbie question

2007-02-10 Thread Tina I
James wrote: Hello, I work in this annoying company where I have to autheticate myself to the company firewall every 30-50 minutes in order to access the internet. (I think it's a checkpoint fw). I have to run telnet what.ever.ip.address 259 then it prompts me with userid, then

Re: interacting with shell - another newbie question

2007-02-10 Thread James Stroud
Tina I wrote: James wrote: Hello, I work in this annoying company where I have to autheticate myself to the company firewall every 30-50 minutes in order to access the internet. (I think it's a checkpoint fw). I have to run telnet what.ever.ip.address 259 then it prompts me with userid,

Re: interacting with shell - another newbie question

2007-02-10 Thread Steve Holden
James Stroud wrote: Tina I wrote: James wrote: Hello, I work in this annoying company where I have to autheticate myself to the company firewall every 30-50 minutes in order to access the internet. (I think it's a checkpoint fw). I have to run telnet what.ever.ip.address 259 then it

interacting with shell - another newbie question

2007-02-09 Thread James
Hello, I work in this annoying company where I have to autheticate myself to the company firewall every 30-50 minutes in order to access the internet. (I think it's a checkpoint fw). I have to run telnet what.ever.ip.address 259 then it prompts me with userid, then password, then I have to

Re: interacting with shell - another newbie question

2007-02-09 Thread Larry Bates
James wrote: Hello, I work in this annoying company where I have to autheticate myself to the company firewall every 30-50 minutes in order to access the internet. (I think it's a checkpoint fw). I have to run telnet what.ever.ip.address 259 then it prompts me with userid, then

Re: interacting with shell - another newbie question

2007-02-09 Thread James Stroud
James wrote: Hello, I work in this annoying company where I have to autheticate myself to the company firewall every 30-50 minutes in order to access the internet. (I think it's a checkpoint fw). I have to run telnet what.ever.ip.address 259 then it prompts me with userid, then

another newbie question: why should you use *args ?

2007-01-31 Thread stef
why should I use *args, as in my ignorance, making use of a list (or tupple) works just as well, and is more flexible in it's calling. So the simple conclusion might be: never use *args, or am I overlooking something ? # method 1 def execute (self, *args): for i in range ( len(args)

Re: another newbie question: why should you use *args ?

2007-01-31 Thread Diez B. Roggisch
stef wrote: why should I use *args, as in my ignorance, making use of a list (or tupple) works just as well, and is more flexible in it's calling. So the simple conclusion might be: never use *args, or am I overlooking something ? Yup. For example decorators, that wrap functions. If you

Re: another newbie question: why should you use *args ?

2007-01-31 Thread Bruno Desthuilliers
stef a écrit : why should I use *args, as in my ignorance, making use of a list (or tupple) works just as well, and is more flexible in it's calling. Err... How so ? So the simple conclusion might be: never use *args, or am I overlooking something ? Try writing generic higher order

Re: another newbie question: why should you use *args ?

2007-01-31 Thread Dustan
On Jan 31, 5:41 am, stef [EMAIL PROTECTED] wrote: why should I use *args, as in my ignorance, making use of a list (or tupple) works just as well, and is more flexible in it's calling. Others have mentioned the instances in which it's actually useful - for catch-all arguments. But you also

Re: another newbie question: why should you use *args ?

2007-01-31 Thread stef
It's bad practice to use built-ins like 'list' as a regular variable name. ok, but it was just an example (in practice, I always use very long names ;-) # calling method 1: execute (S[0], S[4] ) # calling method 2: execute ( ( S[0], S[4] ) ) Let's take a look at those

Re: another newbie question: why should you use *args ?

2007-01-31 Thread Eugene Antimirov
stef wrote: # method 2 def chunk_plot(self, list): for i in range ( len(list) ): do something And one note more. Just to be more pythonic you shouldn't use form range(len(blabla)). Instead use: for i in list: blabla... -- Sincerely, Eugene Antimirov

Re: another newbie question: why should you use *args ?

2007-01-31 Thread stef
Eugene Antimirov wrote: stef wrote: # method 2 def chunk_plot(self, list): for i in range ( len(list) ): do something And one note more. Just to be more pythonic you shouldn't use form range(len(blabla)). Instead use: for i in list: blabla... I

Re: another newbie question: why should you use *args ?

2007-01-31 Thread Jeffrey Froman
stef wrote: And one note more. Just to be more pythonic you shouldn't use form range(len(blabla)). Instead use: for i in list: blabla... I would love that, but please tell me how (I need an integer counter for something else too): for index, item in enumerate(args): ...

Re: another newbie question: why should you use *args ?

2007-01-31 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], stef wrote: Eugene Antimirov wrote: And one note more. Just to be more pythonic you shouldn't use form range(len(blabla)). Instead use: for i in list: blabla... I would love that, but please tell me how (I need an integer counter for something else too):

Re: another newbie question: why should you use *args ?

2007-01-31 Thread stef
I would love that, but please tell me how (I need an integer counter for something else too): def chunk_plot(*args): if len(args) == 1: list = args[0] else: list = args color = ['g','r','b','y','m'] plot ( list[0], color[0]) hold (True) for i in range

Re: another newbie question

2006-11-15 Thread Bruno Desthuilliers
Mary Jane Boholst a écrit : Hello everyone, I have a question that google couldnt answer for me and thought that the brains on here might be able to help. I am trying to upload a file to a database What do you mean upload a file to a database ? I know how to uplaod a file (from a web form to

another newbie question

2006-11-14 Thread Mary Jane Boholst
Hello everyone, I have a question that google couldnt answer for me and thought that the brains on here might be able to help. I am trying to upload a file to a database using a (cgi) form and am having trouble doing this. I think that I need some way of escaping the file contents or making it so

Re: another newbie question

2006-11-14 Thread BartlebyScrivener
Lots of smart, patient people here, but they can't help you until you provide a lot more information and the actual error messages you are getting and whether they are spawned by Python or MySQL, if that is indeed the db you are using. Where did you get the idea that Python might be involved?

Re: another newbie question

2006-11-14 Thread Fredrik Lundh
Mary Jane Boholst wrote: I am trying to upload a file to a database using a (cgi) form and am having trouble doing this. I think that I need some way of escaping the file contents or making it so that mysql/python (not sure which) will ignore the files actual contents and store it in the db

Re: Another newbie question

2005-12-13 Thread Mike Meyer
Antoon Pardon [EMAIL PROTECTED] writes: Op 2005-12-11, Steven D'Aprano schreef [EMAIL PROTECTED]: On Sat, 10 Dec 2005 15:46:35 +, Antoon Pardon wrote: Do you really think that my class and some other class written by another person will have the same API? If both writers try to implement

Re: Another newbie question

2005-12-12 Thread Antoon Pardon
Op 2005-12-11, Steven D'Aprano schreef [EMAIL PROTECTED]: On Sat, 10 Dec 2005 15:46:35 +, Antoon Pardon wrote: But I *want* other classes to poke around inside my implementation. That's a virtue, not a vice. My API says: In addition to the full set of methods which operate on the

Re: Another newbie question

2005-12-12 Thread Steven D'Aprano
On Mon, 12 Dec 2005 12:12:46 +, Antoon Pardon wrote: And maybe it isn't a Coordinate class at all, hmmm? Indeed it isn't. It is usually a Point class. An ordinary, Cartesian, real-valued Coordinate is a pair of ordinates, an X and Y ordinates. That's what it *is* -- a coordinate class

Re: Another newbie question

2005-12-12 Thread Antoon Pardon
Op 2005-12-12, Steven D'Aprano schreef [EMAIL PROTECTED]: On Mon, 12 Dec 2005 12:12:46 +, Antoon Pardon wrote: And maybe it isn't a Coordinate class at all, hmmm? Indeed it isn't. It is usually a Point class. An ordinary, Cartesian, real-valued Coordinate is a pair of ordinates, an X

Re: Another newbie question

2005-12-12 Thread james . moughan
Mike Meyer wrote: [EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: In addition to the full set of methods which operate on the coordinate as a whole, you can operate on the individual ordinates via instance.x and instance.y which are floats. That's

Re: Another newbie question

2005-12-12 Thread John J. Lee
Steve Holden [EMAIL PROTECTED] writes: [...] The Law of Demeter isn't about *how* you access objects, it's about what interfaces to objects you can legally manipulate without undue instability across refactoring. In other words, it's about semantics, not syntax. And it's led a lot of Java

Re: Another newbie question

2005-12-11 Thread Steve Holden
Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: The fact that sys is a module and not a class is a red herring. If the Law of Demeter makes sense for classes, it makes just as much sense for modules as well -- it is about reducing coupling between pieces of code, not something

Re: Another newbie question

2005-12-11 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... It's not my cherished example - it actually came from someone You picked it to (try and fail to) show that there is DIFFICULTY, which I showed there isn't. else. That you can change the requirements so that there is no extra work is immaterial - all

Re: Another newbie question

2005-12-11 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... Claim: doing X makes Y hard. Harder, not hard. The specific wording you used was MORE DIFFICULT. Here is an example of doing X where Y is easy Y is very easy in any case. Making it incrementally harder doesn't make it hard - it's still very

Re: Another newbie question

2005-12-11 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: ... It's not my cherished example - it actually came from someone You picked it to (try and fail to) show that there is DIFFICULTY, which I showed there isn't. No, you showed you could change the example so

Re: Another newbie question

2005-12-11 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... Except you haven't shown that the API was badly designed. You can't show that it's badly designed, because you don't know the requirements that the API is meeting. I can show that an API is badly designed *whatever requirements it might be intended

Re: Another newbie question

2005-12-11 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: ... Except you haven't shown that the API was badly designed. You can't show that it's badly designed, because you don't know the requirements that the API is meeting. I can show that an API is badly designed

Re: Another newbie question

2005-12-10 Thread Xavier Morel
Mike Meyer wrote: And you've once again missed the point. The reason you don't manipulate the attributes directly is because it violates encapsulation, and tightens the coupling between your class and the classes it uses. It means you see the implementation details of the classes you are

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 01:28:52 -0500, Mike Meyer wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Thu, 08 Dec 2005 20:46:33 -0500, Mike Meyer wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Yes. Reaching through objects to do

Re: Another newbie question

2005-12-10 Thread Antoon Pardon
On 2005-12-10, Steven D'Aprano [EMAIL PROTECTED] wrote: On Sat, 10 Dec 2005 01:28:52 -0500, Mike Meyer wrote: The not-so-wise programmer takes abstraction as an end itself, and consequently spends more time and effort defending against events which almost certainly will never happen than it

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... it. Nothing you do with zim.foo or zim.foo.bar can change the state of zim. The only invariants you need to check are bar's, which you do at the exit to it's baz method. So foo's class is not allowed to have as its invariant any formula

Re: Another newbie question

2005-12-10 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: In particular, you can get most of your meaningless methods out of a properly designed Coordinate API. For example, add/sub_x/y_ord can all be handled with move(delta_x = 0, delta_y = 0). Here is my example again: [quote] Then, somewhere in my

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: ... it. Nothing you do with zim.foo or zim.foo.bar can change the state of zim. The only invariants you need to check are bar's, which you do at the exit to it's baz method. So foo's class is not allowed to

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... Well, the hard-core solution is to note that your class doesn't really deal with the type Bar, but deals with a subtype of Bar for which x 23 in all cases. Since types are represented by classes, you should subclass Bar so you have a class that

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: In addition to the full set of methods which operate on the coordinate as a whole, you can operate on the individual ordinates via instance.x and instance.y which are floats. That's an API which makes changing the object more difficult. It may be the

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: ... Well, the hard-core solution is to note that your class doesn't really deal with the type Bar, but deals with a subtype of Bar for which x 23 in all cases. Since types are represented by classes, you should

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: In addition to the full set of methods which operate on the coordinate as a whole, you can operate on the individual ordinates via instance.x and instance.y which are floats. That's an API which makes changing

Re: Another newbie question

2005-12-10 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: You could make a case for a 2D coordinate class being sufficiently primitive to have immutable instances, of course (by analogy with numbers and strings) -- in that design, you would provide no mutators, and therefore neither would you provide setters

Re: Another newbie question

2005-12-10 Thread Bernhard Herzog
[EMAIL PROTECTED] (Alex Martelli) writes: You could make a case for a 2D coordinate class being sufficiently primitive to have immutable instances, of course (by analogy with numbers and strings) -- in that design, you would provide no mutators, and therefore neither would you provide setters

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... Take our much-abused coordinate example, and assume you've exposed the x and y coordinates as attributes. Now we have a changing requirement - we want to get to make the polar coordinates available. To keep the API consistent, they should be

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Paul Rubin http://[EMAIL PROTECTED] wrote: ... I could imagine using Python's built-in complex numbers to represent 2D points. They're immutable, last I checked. I don't see a big conflict. No big conflict at all -- as I recall, last I checked, computation on complex numbers was optimized

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Bernhard Herzog [EMAIL PROTECTED] wrote: ... and y, obviously. However, a framework for 2D geometry entirely based on immutable-instance classes would probably be unwieldy Skencil's basic objects for 2d geometry, points and transformations, are immutable. It works fine. Immutable

Re: Another newbie question

2005-12-10 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: I could imagine using Python's built-in complex numbers to represent 2D points. They're immutable, last I checked. I don't see a big conflict. No big conflict at all -- as I recall, last I checked, computation on complex numbers was optimized

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Paul Rubin http://[EMAIL PROTECTED] wrote: ... Right, you could use properties to make point.x get the real part of an internal complex number. But now you're back to point.x being an accessor function; you've just set things up so you can call it without parentheses, like in Perl. E.g.

Re: Another newbie question

2005-12-10 Thread Erik Max Francis
Paul Rubin wrote: Right, you could use properties to make point.x get the real part of an internal complex number. But now you're back to point.x being an accessor function; you've just set things up so you can call it without parentheses, like in Perl. E.g. a = point.x b =

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: def setRho(self, rho): c = self.fromPolar(rho, self.getTheta()) self.x, self.y = c.x, c.y def setTheta(self, theta): c = self.fromPolar(self.getRho(), theta) self.x, self.y = c.x, c.y That's the maximum

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 13:33:25 -0500, Mike Meyer wrote: Steven D'Aprano [EMAIL PROTECTED] writes: In particular, you can get most of your meaningless methods out of a properly designed Coordinate API. For example, add/sub_x/y_ord can all be handled with move(delta_x = 0, delta_y = 0). Here

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: def setRho(self, rho): c = self.fromPolar(rho, self.getTheta()) self.x, self.y = c.x, c.y def setTheta(self, theta): c = self.fromPolar(self.getRho(), theta) self.x,

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 22:56:12 -0500, Mike Meyer wrote: [snip] Really, I don't think this makes a good poster child for your attribute mutators make life more difficult campaign...;-) The claim is that there exists cases where that's true. This cases demonstrates the existence of such cases.

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 15:46:35 +, Antoon Pardon wrote: Do you lie awake at nights worrying that in Python 2.6 sys.stdout will be renamed to sys.standard_output, and that it will no longer have a write() method? According to the law of Demeter, you should, and the writers of the sys module

Re: Another newbie question

2005-12-10 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: The fact that sys is a module and not a class is a red herring. If the Law of Demeter makes sense for classes, it makes just as much sense for modules as well -- it is about reducing coupling between pieces of code, not something specific to classes.

Re: Another newbie question

2005-12-10 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 10 Dec 2005 13:33:25 -0500, Mike Meyer wrote: Steven D'Aprano [EMAIL PROTECTED] writes: In particular, you can get most of your meaningless methods out of a properly designed Coordinate API. For example, add/sub_x/y_ord can all be handled

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: Really, I don't think this makes a good poster child for your attribute mutators make life more difficult campaign...;-) The claim is that there exists cases where that's true. This cases demonstrates the

Re: Another newbie question

2005-12-10 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 10 Dec 2005 22:56:12 -0500, Mike Meyer wrote: Really, I don't think this makes a good poster child for your attribute mutators make life more difficult campaign...;-) The claim is that there exists cases where that's true. This cases

Re: Another newbie question

2005-12-09 Thread BartlebyScrivener
http://en.wikipedia.org/wiki/Law_of_Demeter That was fun. Thanks, Kent. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Another newbie question

2005-12-09 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: My standard object interface is modeled after Meyer's presentation in OOSC: an objects state is manipulated with methods and examined with attributes; manipulating attributes

Re: Another newbie question

2005-12-09 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: for an object, and methods are the knobs/dials/etc. This also ties in with the compiler having facilities to check class invariants. If you allow assignments to attributes in other classes, the assignments have to

Re: Another newbie question

2005-12-09 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: ... What classes' invariants do you have to check in those cases? E.g., consider zim.foo.bar.baz() -- you do have to check the invariants of bar, foo AND zim, right? Nope, just bar. Attributes display state, they don't let you change it. Nothing

Re: Another newbie question

2005-12-09 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: What classes' invariants do you have to check in those cases? E.g., consider zim.foo.bar.baz() -- you do have to check the invariants of bar, foo AND zim, right? Nope, just bar. Attributes display state, they

Re: Another newbie question

2005-12-09 Thread Steven D'Aprano
On Thu, 08 Dec 2005 20:46:33 -0500, Mike Meyer wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Yes. Reaching through objects to do things is usually a bad idea. I don't necessarily disagree, but I don't understand why you say this.

Re: Another newbie question

2005-12-09 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: On Thu, 08 Dec 2005 20:46:33 -0500, Mike Meyer wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Yes. Reaching through objects to do things is usually a bad idea. I don't necessarily disagree,

Re: Another newbie question

2005-12-08 Thread John Bushnell
I think that's supposed to be [(i + j) % 2] for the index to the (green,red) tuple (since i*8 is always even). [EMAIL PROTECTED] wrote: Mike, Thanks for your insight. It has been a big help. I guess I was trying to learn too much with my original code. Trying to implement inheritance,

Re: Another newbie question

2005-12-08 Thread Steven D'Aprano
On Wed, 07 Dec 2005 23:58:02 -0500, Mike Meyer wrote: solaris_1234 [EMAIL PROTECTED] writes: 1) The stmt board.Blist[10].DrawQueen(board.Blist[10].b1) seems awkward. Is there another way (cleaner, more intuitive) to get the same thing done? Yes. Reaching through objects to do things is

Re: Another newbie question

2005-12-08 Thread Kent Johnson
Steven D'Aprano wrote: On Wed, 07 Dec 2005 23:58:02 -0500, Mike Meyer wrote: 1) The stmt board.Blist[10].DrawQueen(board.Blist[10].b1) seems awkward. Is there another way (cleaner, more intuitive) to get the same thing done? Yes. Reaching through objects to do things is usually a bad idea.

Re: Another newbie question

2005-12-08 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: On Wed, 07 Dec 2005 23:58:02 -0500, Mike Meyer wrote: solaris_1234 [EMAIL PROTECTED] writes: 1) The stmt board.Blist[10].DrawQueen(board.Blist[10].b1) seems awkward. Is there another way (cleaner, more intuitive) to get the same thing done? Yes.

Re: Another newbie question

2005-12-08 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: Yes. Reaching through objects to do things is usually a bad idea. I don't necessarily disagree, but I don't understand why you say this. Why it is bad? The traditional OOP spirit is to encapsulate the object's entire behavior in the class definition.

Re: Another newbie question

2005-12-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : I'm off to study the code. (Hmm.. how does python parse (green, red)[(i * 8 + j) % 2] command ... (green, red)[0] == green (green, red)[1] == red (i * 8 + j) is somewhat trivial (just take care of precedence order), and will return an integer % is the modulo

Re: Another newbie question

2005-12-08 Thread Steven D'Aprano
Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Yes. Reaching through objects to do things is usually a bad idea. I don't necessarily disagree, but I don't understand why you say this. Why it is bad? The traditional OOP spirit is to encapsulate the object's entire behavior

Re: Another newbie question

2005-12-08 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Yes. Reaching through objects to do things is usually a bad idea. I don't necessarily disagree, but I don't understand why you say this. Why it is bad? The traditional OOP spirit is to

Re: Another newbie question

2005-12-08 Thread Alex Martelli
Mike Meyer [EMAIL PROTECTED] wrote: My standard object interface is modeled after Meyer's presentation in OOSC: an objects state is manipulated with methods and examined with attributes; manipulating attributes doesn't change the internal state of the object. This makes it possible to change

Re: Another newbie question

2005-12-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mike Meyer [EMAIL PROTECTED] wrote: My standard object interface is modeled after Meyer's presentation in OOSC: an objects state is manipulated with methods and examined with attributes; manipulating attributes doesn't change the internal state of the

Another newbie question

2005-12-07 Thread solaris_1234
I am a python newbie and have been trying to learn python. To this end, I have coded the following program creates: a 8 by 8 checker board Places two checkers on the board Checks the board and prints out which squares has a checker on them. It works. But I have a one question: 1) The stmt

Re: Another newbie question

2005-12-07 Thread Mike Meyer
solaris_1234 [EMAIL PROTECTED] writes: 1) The stmt board.Blist[10].DrawQueen(board.Blist[10].b1) seems awkward. Is there another way (cleaner, more intuitive) to get the same thing done? Yes. Reaching through objects to do things is usually a bad idea. Some languages don't allow you to do

Re: Another newbie question

2005-12-07 Thread [EMAIL PROTECTED]
Mike, Thanks for your insight. It has been a big help. I guess I was trying to learn too much with my original code. Trying to implement inheritance, object creation, calling methods via inheritance made the code harder than it needed to be. I'm off to study the code. (Hmm.. how does python

Re: Another newbie question from Nathan.

2005-07-10 Thread johng2001
Nathan Pinno wrote: Hi all, How do I make Python get a def? Is it the get function, or something else? I need to know so that I can get a def for that computer MasterMind(tm) game that I'm writing. BTW, I took your advice, and wrote some definitions for my Giant Calculator program.

Re: Another newbie question from Nathan.

2005-07-09 Thread Nathan Pinno
Hi all, How do I make Python get a def? Is it the get function, or something else? I need to know so that I can get a def for that computer MasterMind(tm) game that I'm writing. BTW, I took your advice, and wrote some definitions for my Giant Calculator program. Might make the code

Another newbie question from Nathan.

2005-07-02 Thread Nathan Pinno
Hi all. How do I make the computer generate 4 random numbers for the guess? I want to know because I'm writing a computer program in Python like the game MasterMind. Thanks. -- Nathan Pinno http://www.npinnowebsite.ca/ --

Re: Another newbie question from Nathan.

2005-07-02 Thread Brian van den Broek
Nathan Pinno said unto the world upon 02/07/2005 02:25: Hi all. How do I make the computer generate 4 random numbers for the guess? I want to know because I'm writing a computer program in Python like the game MasterMind. Thanks. -- Nathan Pinno

Re: Another newbie question from Nathan.

2005-07-02 Thread Steven D'Aprano
On Sat, 02 Jul 2005 00:25:00 -0600, Nathan Pinno wrote: Hi all. How do I make the computer generate 4 random numbers for the guess? I want to know because I'm writing a computer program in Python like the game MasterMind. First you get the computer to generate one random number.