Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Larry Hudson
On 07/17/2012 04:24 AM, Lipska the Kat wrote: ... Thanks for your time and I'll try to do a bit better with the reading thing before asking more questions... not sure about this obsession with code indentation though :-| I think it's inaccurate to call this indentation an obsession, it's part

Re: jython lacks working xml processing modules?

2012-07-18 Thread Matej Cepl
On 18/07/12 05:12, gaodexiaozh...@gmail.com wrote: However,there is one project implemented by Python used PyXML and now my Jython project has to depend on it ,so I am afraid that if Jython doesn't support PyXML,then my jython project can not depend on the original Python project ,then my jython

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Lipska the Kat
On 18/07/12 01:46, Andrew Cooper wrote: On 17/07/2012 19:36, Lipska the Kat wrote: On 17/07/12 19:18, Mark Lawrence wrote: On 17/07/2012 18:29, Ethan Furman wrote: Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: snip Take for example a Linux system call handler. The gen

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Arnaud Delobelle
On 17 July 2012 13:01, Lipska the Kat wrote: > Well I've set myself a task. > I have a text file containing a list of stock items > each line contains the number in stock followed by a tab followed by the > name of the item. I need to implement something that reads in the text file > and outputs

[ANN] Pylint 0.25.2 / ASTNG 0.24 / logilab-common 0.58.1 released

2012-07-18 Thread Sylvain Thénault
Hi there, I've released this morning new versions of Pylint, ASTNG and logilab-common projects. For more information, read http://www.logilab.org/blogentry/100365 Enjoy! -- Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (09.54.03.55.76) Formations Python, Debian, Méth. Agiles: htt

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Ulrich Eckhardt
Am 18.07.2012 11:06, schrieb Lipska the Kat: On 18/07/12 01:46, Andrew Cooper wrote: Take for example a Linux system call handler. The general form looks a little like (substituting C for python style pseudocode) if not (you are permitted to do this): return -EPERM if not (you've given me

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Tue, 17 Jul 2012 12:01:21 +0100, Lipska the Kat wrote: > For the past 9 years I have been developing in Java [...] > Anyway, I'm looking at Python as a rapid prototyping language. I have an > idea and just want to get it down in basic outline code as quickly as > possible before it departs my a

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Tue, 17 Jul 2012 09:52:59 -0400, Roy Smith wrote: > you could write in Python: > > # Type matching will get checked at run-time > def my_function(mpf, ot): >assert isinstance(mpf, MassivelyParallelFrobinator) >assert isinstance(ot, OtherThing) Keep in mind that assertions are not gu

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Wed, 18 Jul 2012 01:46:31 +0100, Andrew Cooper wrote: > Take for example a Linux system call handler. The general form looks a > little like (substituting C for python style pseudocode) > > if not (you are permitted to do this): > return -EPERM > if not (you've given me some valid data):

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Roy Smith
In article <5006b2e2$0$29978$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Tue, 17 Jul 2012 09:52:59 -0400, Roy Smith wrote: > > > you could write in Python: > > > > # Type matching will get checked at run-time > > def my_function(mpf, ot): > >assert isinstance(mpf, Mas

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Wed, 18 Jul 2012 09:07:22 -0400, Roy Smith wrote: >> Keep in mind that assertions are not guaranteed to run. Code like the >> above is buggy, because if Python is run under the -O (optimize) flag, >> assertions will be stripped out. > > One could equally say that "code like the above is effici

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Grant Edwards
On 2012-07-17, Lipska the Kat wrote: > and what's this obsession with 'correct' indentation of code ??? If you can explain to us Java's obsession with 'correct' placemnt of curly-braces, then you've explained indentation in python. Unless you're asking about the tabs vs. spaces argument. In th

Re: Foxpro goto command and deleted records

2012-07-18 Thread Grant Edwards
On 2012-07-17, Ethan Furman wrote: > In Foxpro if you do a Foxpro? -- Grant Edwards grant.b.edwardsYow! I am NOT a nut at gmail.com -- http://mail.python.org/mailman/listinfo/p

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Lipska the Kat
On 18/07/12 14:05, Steven D'Aprano wrote: On Wed, 18 Jul 2012 01:46:31 +0100, Andrew Cooper wrote: Take for example a Linux system call handler. The general form looks a little like (substituting C for python style pseudocode) if not (you are permitted to do this): return -EPERM if not (

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Lipska the Kat
On 18/07/12 15:34, Grant Edwards wrote: On 2012-07-17, Lipska the Kat wrote: and what's this obsession with 'correct' indentation of code ??? If you can explain to us Java's obsession with 'correct' placemnt of curly-braces, then you've explained indentation in python. I'm not getting into

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Andrew Berg
On 7/18/2012 9:34 AM, Grant Edwards wrote: > people who us tabs are wrong Don't make me get my flamethrower! > and people who mix spaces and tabs -- well, we don't > talk about them in polite company. Mixing can make sense, but not in Python. *hides* -- CPython 3.3.0b1 | Windows NT 6.1.7601.1780

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Chris Angelico
On Thu, Jul 19, 2012 at 12:40 AM, Lipska the Kat wrote: > Python looks like an interesting language and I will certainly spend time > getting to know it but at the moment it seems to me that calling it an > Object Oriented language is just plain misleading. Python isn't object oriented in the way

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Chris Angelico
On Thu, Jul 19, 2012 at 12:48 AM, Lipska the Kat wrote: > hmm, I've been using tabs ... still, why use one key press when you can use > 4 ;-). Actually I quite like this aspect of Python, it's rapidly growing on > me. Wonder if I could introduce this in a future release of Java ... nah, > I'd be

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Ethan Furman
Lipska the Kat wrote: On 18/07/12 14:05, Steven D'Aprano wrote: Even with a break, why bother continuing through the body of the function when you already have the result? When your calculation is done, it's done, just return for goodness sake. You wouldn't write a search that keeps going after

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Lipska the Kat
On 18/07/12 16:09, Chris Angelico wrote: On Thu, Jul 19, 2012 at 12:48 AM, Lipska the Kat wrote: hmm, I've been using tabs ... snip We must meet half way, you know. Seems reasonable to me, I'll let you suggest it ;-) As to tab vs spaces: I'm a fan of tabs, myself. There was an argument

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Lipska the Kat
On 18/07/12 16:32, Ethan Furman wrote: Lipska the Kat wrote: On 18/07/12 14:05, Steven D'Aprano wrote: Even with a break, why bother continuing through the body of the function when you already have the result? When your calculation is done, it's done, just return for goodness sake. You wouldn'

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Dave Angel
On 07/18/2012 08:58 AM, Steven D'Aprano wrote: > > > > 2) To check your internal reasoning in a function or method. > > For example: > > def foo(something): > n = len(something) > x = math.sqrt(x) > # We expect that x must be less than half of n. > # E.g. n=100 gives 10 < 50, whic

Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 17, 2012, at 5:57 PM, Ethan Furman wrote: > In Foxpro if you do a > > GOTO 7 > > with deleted off and record 7 is deleted, the record pointer doesn't > move (at least in version 6). > > I don't like that. > > I see four other options: > > 0) don't move the pointer (listed for completen

Re: Foxpro goto command and deleted records

2012-07-18 Thread Ethan Furman
Ed Leafe wrote: On Jul 17, 2012, at 5:57 PM, Ethan Furman wrote: In Foxpro if you do a GOTO 7 with deleted off and record 7 is deleted, the record pointer doesn't move (at least in version 6). I don't like that. I see four other options: 0) don't move the pointer (listed for completeness)

Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 18, 2012, at 12:16 PM, Ethan Furman wrote: > Your memory is good! I typed it in wrong. Well, I was an MVP for Visual Foxpro for 10 years, so... ;-) > I see four other options: > > 0) don't move the pointer (listed for completeness) > 1) go to that record anyway > 2) go

Re: Foxpro goto command and deleted records

2012-07-18 Thread MRAB
On 18/07/2012 18:28, Ed Leafe wrote: On Jul 18, 2012, at 12:16 PM, Ethan Furman wrote: Your memory is good! I typed it in wrong. Well, I was an MVP for Visual Foxpro for 10 years, so... ;-) I see four other options: 0) don't move the pointer (listed for completeness) 1) g

Re: Foxpro goto command and deleted records

2012-07-18 Thread Ed Leafe
On Jul 18, 2012, at 12:57 PM, MRAB wrote: >> #4 is probably the most Pythonic approach. The calling code can then >> decide how to react to attempting to access a deleted record. Even if you're >> accessing data stored in VFP tables, your module should be as Pythonic as >> possible. >> >

Re: FORTH in Python (py4th.py)

2012-07-18 Thread recaialkan
7 Aralık 1994 Çarşamba 05:04:22 UTC+2 tarihinde Nick Seidenman yazdı: > Just for fun I sat down and started writing a forth interpreter in > python. I got as far as putting in control structs and decided I';d > better get back to my real job. It does make a nice little example of > many of the co

Finding duplicate file names and modifying them based on elements of the path

2012-07-18 Thread larry.mart...@gmail.com
I have an interesting problem I'm trying to solve. I have a solution almost working, but it's super ugly, and know there has to be a better, cleaner way to do it. I have a list of path names that have this form: /dir0/dir1/dir2/dir3/dir4/dir5/dir6/file I need to find all the file names (basename

Re: FORTH in Python (py4th.py)

2012-07-18 Thread Ian Kelly
On Wed, Jul 18, 2012 at 4:05 PM, wrote: > 7 Aralık 1994 Çarşamba 05:04:22 UTC+2 tarihinde Nick Seidenman yazdı: You realize that you're replying to a post from 1994? This code was written for Python 1.0. I'll be pretty impressed if it still works in 2.7. > Thank you for the code. How can i im

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-18 Thread Paul Rubin
"larry.mart...@gmail.com" writes: > I have an interesting problem I'm trying to solve. I have a solution > almost working, but it's super ugly, and know there has to be a > better, cleaner way to do it. ... > > My solution involves multiple maps and multiple iterations through the > data. How woul

A thread import problem

2012-07-18 Thread Bruce Sherwood
I'm trying to do something rather tricky, in which a program imports a module that starts a thread that exec's a (possibly altered) copy of the source in the original program, and the module doesn't return. This has to do with an attempt to run VPython in the Mac Cocoa context, in which Cocoa is re

Re: FORTH in Python (py4th.py)

2012-07-18 Thread MRAB
On 18/07/2012 23:43, Ian Kelly wrote: On Wed, Jul 18, 2012 at 4:05 PM, wrote: 7 Aralık 1994 Çarşamba 05:04:22 UTC+2 tarihinde Nick Seidenman yazdı: You realize that you're replying to a post from 1994? This code was written for Python 1.0. I'll be pretty impressed if it still works in 2.7.

Re: How to configure Tkinter Listbox to disable state keeping selected item highlighted

2012-07-18 Thread Rick Johnson
On Tuesday, July 17, 2012 8:55:21 AM UTC-5, Sarbjit singh wrote: > I am having a problem configuring a listbox widget such that the selection > remains highlighted even while it is set (programmatically) to the DISABLED > state. Below code shows the problem: > > from Tkinter import * > master =

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-18 Thread Simon Cropper
On 19/07/12 08:20, larry.mart...@gmail.com wrote: I have an interesting problem I'm trying to solve. I have a solution almost working, but it's super ugly, and know there has to be a better, cleaner way to do it. I have a list of path names that have this form: /dir0/dir1/dir2/dir3/dir4/dir5/di

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread BartC
"Lipska the Kat" wrote in message news:c76dnv778_sw4zvnnz2dnuvz8ukdn...@bt.com... On 18/07/12 01:46, Andrew Cooper wrote: if not (you are permitted to do this): return -EPERM if not (you've given me some valid data): return -EFAULT if not (you've given me some sensible data): r

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Wed, 18 Jul 2012 15:48:28 +0100, Lipska the Kat wrote: > On 18/07/12 15:34, Grant Edwards wrote: >> Unless you're asking about the tabs vs. spaces argument. In that case, >> people who use 4 spaces per level are 'correct'; people who use a >> different number of spaces are a bit less correct;

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Wed, 18 Jul 2012 12:33:01 -0400, Dave Angel wrote: > On 07/18/2012 08:58 AM, Steven D'Aprano wrote: >> >> For bonus points, can you see the mistake? [...] >> > There are actually two bugs in that function. One is in the assertion, > but more importantly, there's a typo earlier. One that wou

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Thu, 19 Jul 2012 01:04:50 +1000, Chris Angelico wrote: > Python isn't object oriented in the way Java is ("EVERYTHING has to be > in a class! Look, it's all OO now!"). Actually, Python is more object-oriented than Java. In Python, everything is an object. We have no distinction between boxed

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread MRAB
On 19/07/2012 02:14, Steven D'Aprano wrote: On Wed, 18 Jul 2012 15:48:28 +0100, Lipska the Kat wrote: On 18/07/12 15:34, Grant Edwards wrote: Unless you're asking about the tabs vs. spaces argument. In that case, people who use 4 spaces per level are 'correct'; people who use a different nu

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Steven D'Aprano
On Wed, 18 Jul 2012 15:40:00 +0100, Lipska the Kat wrote: [...] >> Even with a break, why bother continuing through the body of the >> function when you already have the result? When your calculation is >> done, it's done, just return for goodness sake. You wouldn't write a >> search that keeps goi

Need help connecting via a remote VPN

2012-07-18 Thread The Coca Cola Kid
I need to connect to a site/server that's only accessible after logging into a remote VPN, then scan a directory for a file pattern and then copy those files. I know how to do the latter using glob, and I think I figured out how to connect to the VPN using win32ras and got a response that said

Re: Need help connecting via a remote VPN

2012-07-18 Thread Dave Angel
On 07/18/2012 09:36 PM, The Coca Cola Kid wrote: > I need to connect to a site/server that's only accessible after > logging into a remote VPN, then scan a directory for a file pattern > and then copy those files. I know how to do the latter using glob, > and I think I figured out how to connect t

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Chris Angelico
On Thu, Jul 19, 2012 at 11:22 AM, Steven D'Aprano wrote: > On Thu, 19 Jul 2012 01:04:50 +1000, Chris Angelico wrote: > >> Python isn't object oriented in the way Java is ("EVERYTHING has to be >> in a class! Look, it's all OO now!"). > > Actually, Python is more object-oriented than Java. In Pytho

Re: Google the video "9/11 Missing Links". 9/11 was a Jew Job!

2012-07-18 Thread William Ray Wing
On Jul 18, 2012, at 11:47 PM, Nicky dsdsdsds wrote: > COPY THIS MESSAGE FAST BECAUSE JEWS AND TRAITORS DELETE IT FAST! > > Sometimes I wish this list was moderated... -Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: Google the video "9/11 Missing Links". 9/11 was a Jew Job!

2012-07-18 Thread Mark Lawrence
On 19/07/2012 05:10, William Ray Wing wrote: On Jul 18, 2012, at 11:47 PM, Nicky dsdsdsds wrote: COPY THIS MESSAGE FAST BECAUSE JEWS AND TRAITORS DELETE IT FAST! Sometimes I wish this list was moderated... -Bill I do that, unofficially of course :) I routinely flag crap like this on g

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread rusi
On Jul 19, 6:34 am, Steven D'Aprano wrote: > On Wed, 18 Jul 2012 15:40:00 +0100, Lipska the Kat wrote: > > Object Oriented programming is all about encapsulating human concepts in > > a way that makes sense to human beings. Make no mistake, it is NEVER the > > case that a software system is writte

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Terry Reedy
On 7/18/2012 10:40 AM, Lipska the Kat wrote: fact ... and I have never been forced to admit that I don't know what I wrote six months ago. That is an explicit objective of Python's design. Python looks like an interesting language and I will certainly spend time getting to know it but at the