Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread rusi
On Jul 18, 5:46 am, 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: > > > Well 'type-bondag

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
MRAB wrote: On 18/07/2012 03:19, Ethan Furman wrote: MRAB wrote: On 17/07/2012 23:57, 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 m

Re: jython lacks working xml processing modules?

2012-07-17 Thread gaodexiaozheng
在 2012年7月17日星期二UTC+8下午6时02分31秒,Stefan Behnel写道: > Matej Cepl, 17.07.2012 11:39: > > On 17/07/12 10:35, gaodexiaozh...@gmail.com wrote: > >>> > I'm trying to parse an xml file with jython > (not through java > >>> parsers > >>> > like xerces). > > > > https://code.google.com/p/jython-ele

Re: Foxpro goto command and deleted records

2012-07-17 Thread MRAB
On 18/07/2012 03:19, Ethan Furman wrote: MRAB wrote: On 17/07/2012 23:57, 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 point

Re: Style question: metaclass self vs cls?

2012-07-17 Thread Steven D'Aprano
On Tue, 17 Jul 2012 05:23:22 -0700, Michele Simionato wrote: > The standard is to use `cls`. In the __new__ method you can use `mcl` or > `meta`. Thanks to everyone who answered. I think I will stick with "meta" and "cls". -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: my email

2012-07-17 Thread Simon Cropper
On 18/07/12 11:44, Maria Hanna Carmela Dionisio wrote: mmdionisio1...@yahoo.com.ph Just a newbhie here :> [snip] You must know your password to change your options (including changing the password, itself) or to unsubscribe. It is: sweet103093 I suggest you change you password now th

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
MRAB wrote: On 17/07/2012 23:57, 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) 1) go to that

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
Ian Kelly wrote: On Tue, Jul 17, 2012 at 4: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

my email

2012-07-17 Thread Maria Hanna Carmela Dionisio
mmdionisio1...@yahoo.com.ph Just a newbhie here :> From: "python-list-requ...@python.org" To: mmdionisio1...@yahoo.com.ph Sent: Saturday, July 7, 2012 7:41 PM Subject: Welcome to the "Python-list" mailing list Welcome to the Python-list@python.org mailing l

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread alex23
On Jul 17, 6:23 pm, Andrew Berg wrote: > On 7/17/2012 2:08 AM, Steven D'Aprano wrote: > > The default behaviour is that every object is something, hence true-like, > > unless explicitly coded to be treated as false-like. Since both loggers > > and functions are objects, they are true-like unless t

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Cooper
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: > Well 'type-bondage' is a strange way of thinking about compile time > type > c

Re: Foxpro goto command and deleted records

2012-07-17 Thread MRAB
On 17/07/2012 23:57, 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) 1) go to that record anywa

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ian Kelly
On Tue, Jul 17, 2012 at 4: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 completene

Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
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) 1) go to that record anyway 2) go to the next undeleted record 3) go

Re: assertraises behaviour

2012-07-17 Thread Andrea Crotti
To clarify my "problem", I just thought that assertRaises if used as context manager should behave as following: - keep going if the exception declared is raised - re-raise an error even if catched after the declared exception was catched I was also confused by the doc a bit: "Test that an excep

Re: multiprocessing: apply_async with different callbacks

2012-07-17 Thread André Panisson
On 07/17/2012 11:44 PM, André Panisson wrote: Hi all, I'm having a strange behavior when executing the following script: --- import multiprocessing def f(i): return i p = multiprocessing.Pool() for i in range(20): def c(r): print r, i p.apply_async(f

Re: help needed with subprocess, pipes and parameters

2012-07-17 Thread John Pote
nuffi, Have you tried running your piped commands c:\Programs\bob\bob.exe -x -y "C:\text\path\to some\file.txt" | c:\Programs\kate\kate.exe -A 2 --dc "Print Media Is Dead" --da "Author" --dt "Title" --hf "Times" --bb "14" --aa "" --font "Ariel" - "C:\rtf\path\to some\file.rtf" in a single i

multiprocessing: apply_async with different callbacks

2012-07-17 Thread André Panisson
Hi all, I'm having a strange behavior when executing the following script: --- import multiprocessing def f(i): return i p = multiprocessing.Pool() for i in range(20): def c(r): print r, i p.apply_async(f, (i,) , callback=c) p.close() p.join() ---

RE: assertraises behaviour

2012-07-17 Thread Prasad, Ramit
> On 17/07/2012 18:49, Prasad, Ramit wrote: > >>> import unittest > >>> > >>> class TestWithRaises(unittest.TestCase): > >>> def test_first(self): > >>> assert False > >>> > >>> def test_second(self): > >>> print("also called") > >>> assert True > >>> > >>>

Re: Python 2.6 on Mac 10.7 doesn't work

2012-07-17 Thread Ned Deily
In article <5005927a$0$6949$e4fe5...@news2.news.xs4all.nl>, Hans Mulder wrote: > On 17/07/12 15:47:05, Naser Nikandish wrote: > > I am trying to install Python 2.6 on Mac OS Lion. Here is what I did: > > > > 1- Download Mac Installer disk image (2.6) (sig) from > >http://www.python.org/get

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 20:39, Mark Lawrence wrote: On 17/07/2012 20:29, Lipska the Kat wrote: On 17/07/12 18:07, Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: snip How easy was it to write max, or a universal sort in Java? Well java.lang.Math.max() (or min() depending on what you

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ian
On 17/07/2012 19:43, Ethan Furman wrote: 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: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and theref

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Mark Lawrence
On 17/07/2012 20:29, Lipska the Kat wrote: On 17/07/12 18:07, Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug snip How easy was it to writ

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Mark Lawrence
On 17/07/2012 19:43, Ethan Furman wrote: 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: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefo

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 18:07, Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug snip How easy was it to write max, or a universal sort in Java? Well ja

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 1:07 PM, Terry Reedy wrote: > 'type-bondage' is the requirement to restrict function inputs and output to > one declared type, where the type declaration mechanisms are usually quite > limited. This is interesting, I hadn't expected that sort of definition. So Haskell is n

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
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: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage

Re: assertraises behaviour

2012-07-17 Thread Terry Reedy
On 7/17/2012 5:06 AM, andrea crotti wrote: Well this is what I meant: import unittest class TestWithRaises(unittest.TestCase): def test_first(self): assert False def test_second(self): print("also called") assert True if __name__ == '__main__': unitt

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ethan Furman
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: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage' is the requireme

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 18:24, Terry Reedy wrote: On 7/17/2012 8:01 AM, Lipska the Kat wrote: On 17/07/12 09:45, Lipska the Kat wrote: Pythoners Python 2.7.3 Ubuntu Linux 12.04 LTS I've been taking a brief look at Python. snip >> Well I've set myself a task. I have a text file containing a list of s

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Mark Lawrence
On 17/07/2012 18:29, Ethan Furman wrote: Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage' is the requirement to restrict function

Re: assertraises behaviour

2012-07-17 Thread Mark Lawrence
On 17/07/2012 18:49, Prasad, Ramit wrote: import unittest class TestWithRaises(unittest.TestCase): def test_first(self): assert False def test_second(self): print("also called") assert True if __name__ == '__main__': unittest.main() in this case

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Tim Chase
On 07/17/12 12:29, Ethan Furman wrote: > Terry Reedy wrote: >> On 7/17/2012 10:23 AM, Lipska the Kat wrote: >> >>> Well 'type-bondage' is a strange way of thinking about compile time type >>> checking and making code easier to read (and therefor debug >> >> 'type-bondage' is the requirement to rest

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Chris Angelico
On Wed, Jul 18, 2012 at 12:23 AM, Lipska the Kat wrote: > Well 'type-bondage' is a strange way of thinking about compile time type > checking and making code easier to read (and therefor debug) but > I'm not about to get into some religious war about declaring a variables > type. There are option

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 12:30 PM, Terry Reedy wrote: > (In some ways, it is already better than 3.2.3.) I certainly make heavy use of some of the new features. I'm not sure we can have enough separate exceptions for OS errors without exhausting every possibility and I might start looking for excuses to use th

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Terry Reedy
On 7/17/2012 4:23 AM, Andrew Berg wrote: On 7/17/2012 2:08 AM, Steven D'Aprano wrote: The default behaviour is that every object is something, hence true-like, unless explicitly coded to be treated as false-like. Since both loggers and functions are objects, they are true-like unless the default

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Tim Chase
On 07/17/12 12:24, Terry Reedy wrote: > On 7/17/2012 8:01 AM, Lipska the Kat wrote: >> In bash this is laughably trivial >> >> sort -nr $1 | head -${2:-10} > > Won't sort work alphabetically and leave the following as is? > > 1\talpha > 11\tbeta > 2\tgamma Only if Lipska had omitted the "-n" whi

RE: assertraises behaviour

2012-07-17 Thread Prasad, Ramit
> > import unittest > > > > class TestWithRaises(unittest.TestCase): > > def test_first(self): > > assert False > > > > def test_second(self): > > print("also called") > > assert True > > > > if __name__ == '__main__': > > unittest.main() > > > > in this ca

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread MRAB
On 17/07/2012 18:24, Terry Reedy wrote: On 7/17/2012 8:01 AM, Lipska the Kat wrote: On 17/07/12 09:45, Lipska the Kat wrote: Pythoners Python 2.7.3 Ubuntu Linux 12.04 LTS I've been taking a brief look at Python. snip Well I've set myself a task. I have a text file containing a list of sto

Re: PyQt QCalendarWidget events question

2012-07-17 Thread Chris Angelico
On Tue, Jul 17, 2012 at 7:34 PM, wrote: > It's so fundamental to most GUIs that single-click > and double-click allow one to do different things with the same object Kinda yes, kinda no. Most GUIs and GUI recommendations would either enforce or strongly suggest that the double-click action incor

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ethan Furman
Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage' is the requirement to restrict function inputs and output to one declared type,

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Terry Reedy
On 7/17/2012 10:16 AM, Andrew Berg wrote: On 7/17/2012 9:01 AM, Lipska the Kat wrote: Wow, that was a blast from the past Just downloaded, unzipped, untarred, configured, made and installed python 3.2.3 ... it's YEARS since I've done this, makes me feel young again. Most Linux distributions s

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Terry Reedy
On 7/17/2012 8:01 AM, Lipska the Kat wrote: On 17/07/12 09:45, Lipska the Kat wrote: Pythoners Python 2.7.3 Ubuntu Linux 12.04 LTS I've been taking a brief look at Python. snip Well I've set myself a task. I have a text file containing a list of stock items each line contains the number in

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Terry Reedy
On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage' is the requirement to restrict function inputs and output to one declared type, where the type decla

Re: Blank TK Window

2012-07-17 Thread woooee
On Jul 17, 9:32 am, Shamefaced wrote: > Hi, > Any reason why a blank Tk() window opens up when I run my code: > Code: > for run in range(RUNS): >     waittime = Monitor2() >     checkouttime = Monitor2() >     totaltimeinshop = Monitor2() >     checkout_aisle = Simulation.Resource(AISLES) >     Si

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 17:26, Mark Lawrence wrote: On 17/07/2012 15:23, Lipska the Kat wrote: On 17/07/12 14:52, Roy Smith wrote: snip Still, I'm sure you're only kidding around with me :-) Kidding around on a Python mailing list, never, how dare you Sir, simply wouldn't be cricket :-) As in "The

Blank TK Window

2012-07-17 Thread Shamefaced
Hi, Any reason why a blank Tk() window opens up when I run my code: Code: for run in range(RUNS): waittime = Monitor2() checkouttime = Monitor2() totaltimeinshop = Monitor2() checkout_aisle = Simulation.Resource(AISLES) Simulation.initialize() cf = Customer_Market() Simu

Re: Style question: metaclass self vs cls?

2012-07-17 Thread Ian Kelly
On Tue, Jul 17, 2012 at 12:10 AM, alex23 wrote: > On Jul 17, 1:29 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> Here's a style question for you: in a metaclass, what should I call the >> instance parameter of methods, "cls" or "self"? > > Maybe portmanteu it as "clasself"? :) Wh

Re: Style question: metaclass self vs cls?

2012-07-17 Thread Ian Kelly
On Tue, Jul 17, 2012 at 6:23 AM, Michele Simionato wrote: > The standard is to use `cls`. In the __new__ method you can use `mcl` or > `meta`. I've also seen `mcs` a fair amount. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 on Mac 10.7 doesn't work

2012-07-17 Thread Hans Mulder
On 17/07/12 15:47:05, Naser Nikandish wrote: > Hi, > > I am trying to install Python 2.6 on Mac OS Lion. Here is what I did: > > 1- Download Mac Installer disk image (2.6) (sig) from >http://www.python.org/getit/releases/2.6/ > > 2- Install it > > 3- Run Python Luncher, go to Python Lunch

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Mark Lawrence
On 17/07/2012 15:23, Lipska the Kat wrote: On 17/07/12 14:52, Roy Smith wrote: In article<-8sdnvrxgqie25jnnz2dnuvz7qkdn...@bt.com>, Lipska the Kat wrote: I'm not used to using variables without declaring their type If you truly wanted to recreate this type-bondage style of programming in

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

2012-07-17 Thread inq1ltd
On Tuesday, July 17, 2012 06:55:21 AM 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 = Tk() >

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 15:16, Andrew Berg wrote: On 7/17/2012 9:01 AM, Lipska the Kat wrote: Wow, that was a blast from the past Just downloaded, unzipped, untarred, configured, made and installed python 3.2.3 ... it's YEARS since I've done this, makes me feel young again. Most Linux distributions should

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 14:52, Roy Smith wrote: In article<-8sdnvrxgqie25jnnz2dnuvz7qkdn...@bt.com>, Lipska the Kat wrote: I'm not used to using variables without declaring their type If you truly wanted to recreate this type-bondage style of programming in Python, it's easy enough to do. snip Well

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 9:01 AM, Lipska the Kat wrote: > Wow, that was a blast from the past > Just downloaded, unzipped, untarred, configured, made and installed > python 3.2.3 ... it's YEARS since I've done this, makes me feel young again. Most Linux distributions should have a premade package for stable P

Re: Diagramming code

2012-07-17 Thread 88888 Dihedral
Chris Rebert於 2012年7月16日星期一UTC+8上午9時38分53秒寫道: > On Sun, Jul 15, 2012 at 6:26 PM, hamilton wrote: > > Subject: Diagramming code > > > > Is there any software to help understand python code ? > > What sort of diagrams? Control flow diagrams? Class diagrams? Sequence > diagrams

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 12:37, Andrew Berg wrote: On 7/17/2012 6:01 AM, Lipska the Kat wrote: snip On a side note, I would highly recommend learning Python 3 (3.2 is the latest stable version) unless you have an explicit need for Python 2 (some major 3rd-party libraries have not been ported yet). Python

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

2012-07-17 Thread Sarbjit singh
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 = Tk() listbox = Listbox(master) listbox.pack() listbox.insert(END, "Text1")

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Roy Smith
In article <-8sdnvrxgqie25jnnz2dnuvz7qkdn...@bt.com>, Lipska the Kat wrote: > I'm not used to using variables without declaring their type If you truly wanted to recreate this type-bondage style of programming in Python, it's easy enough to do. Where you would write in C++: // Type matching

Python 2.6 on Mac 10.7 doesn't work

2012-07-17 Thread Naser Nikandish
Hi, I am trying to install Python 2.6 on Mac OS Lion. Here is what I did: 1- Download Mac Installer disk image (2.6) (sig) from http://www.python.org/getit/releases/2.6/ 2- Install it 3- Run Python Luncher, go to Python Luncher preferences, and change the interpreter to Library/Framewor

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Mark Lawrence
On 17/07/2012 12:44, Lipska the Kat wrote: You're not kidding, the 'duck' example at http://en.wikipedia.org/wiki/Duck_typing made me check I hadn't overdone the medication this morning. That is just plain ...weird. It will take me a while to form non knee jerk opinions of this for sure. Lipska

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Mark Lawrence
On 17/07/2012 12:01, Lipska the Kat wrote: Anyway, I'm looking at Python as a rapid prototyping language. Lipska One of the huge advantages of Python here is that you can simply blast stuff into the interactive prompt and see what happens, no need to write a script. -- Cheers. Mark Lawr

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ulrich Eckhardt
Am 17.07.2012 13:01, schrieb Lipska the Kat: On 17/07/12 10:30, Ulrich Eckhardt wrote: Am 17.07.2012 10:45, schrieb Lipska the Kat: I was expecting (hoping) to see in depth documentation relating to Class construction, extension mechanisms and runtime polymorphism. In addition to this forum f

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Laszlo Nagy
Not really. It doesn't quack like anything. Actually, there is no "it". So we cannot talk about how it quacks. :-D -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Laszlo Nagy
On 2012-07-17 10:23, Andrew Berg wrote: I don't want that, but I am suggesting that it would be consistent with the idea of "something or nothing". Don't confuse names and objects. You can only test the truth value of objects. If you don't have a name in a namespace, then it means you don't hav

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Ethan Furman
Andrew Berg wrote: To put it in duck-typing terms, why should everything have to quack like True or False? Sure, I can see why 1 quacks like True or [] quacks like False, but I don't see why say, a Logger or function should quack like either. Should a Thread object be True if it's been started an

Re: Style question: metaclass self vs cls?

2012-07-17 Thread Michele Simionato
The standard is to use `cls`. In the __new__ method you can use `mcl` or `meta`. -- http://mail.python.org/mailman/listinfo/python-list

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 09:45, Lipska the Kat wrote: Pythoners Python 2.7.3 Ubuntu Linux 12.04 LTS I've been taking a brief look at Python. snip 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 nam

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 6:44 AM, Lipska the Kat wrote: > I'll check it out, thanks. I forgot to add this: http://wiki.python.org/moin/Python2orPython3 It's a little outdated (there is more progress toward py3k by 3rd-party libraries every day), but still quite helpful. -- CPython 3.3.0b1 | Windows NT 6.1.76

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 12:37, Andrew Berg wrote: On 7/17/2012 6:01 AM, Lipska the Kat wrote: Anyway, I'm looking at Python as a rapid prototyping language. snip "Pythonic" is (or at least should be) a word you encounter frequently in discussions of Python code. Learn what is considered Pythonic and the

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 6:01 AM, Lipska the Kat wrote: > 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 aging brain... I'm not used to > using variables without declaring their t

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 11:03, Devin Jeanpierre wrote: On Tue, Jul 17, 2012 at 4:45 AM, Lipska the Kat wrote: Is Python truly OO or is it just one way to use the language. I see some documentation relating to classes but nothing on instantiation .. in fact the documentation appears to say that classes are

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Dave Angel
On 07/17/2012 07:01 AM, Lipska the Kat wrote: > > > 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 aging brain... I'm not used > to using variables without declaring th

Re: assertraises behaviour

2012-07-17 Thread Ulrich Eckhardt
Am 17.07.2012 11:06, schrieb andrea crotti: import unittest class TestWithRaises(unittest.TestCase): def test_first(self): assert False def test_second(self): print("also called") assert True if __name__ == '__main__': unittest.main() in this case als

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
On 17/07/12 10:30, Ulrich Eckhardt wrote: Welcome! Am 17.07.2012 10:45, schrieb Lipska the Kat: I was expecting (hoping) to see in depth documentation relating to Class construction, extension mechanisms and runtime polymorphism. In addition to this forum for direct help and discussion, two s

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ulrich Eckhardt
Welcome! Am 17.07.2012 10:45, schrieb Lipska the Kat: I was expecting (hoping) to see in depth documentation relating to Class construction, extension mechanisms and runtime polymorphism. In addition to this forum for direct help and discussion, two suggestions: Firstly, it could help if you

Re: code review

2012-07-17 Thread Albert van der Horst
In article , Duncan Booth wrote: >Steven D'Aprano wrote: > >> On Fri, 13 Jul 2012 12:30:47 +, Albert van der Horst wrote: >>> The worst of is, of course, = for assignment instead of := . This is >>> a convention that Python follows, to my dismay. >> >> *shrug* >> >> The worst is to use = for

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 4:45 AM, Lipska the Kat wrote: > Is Python truly OO or is it just one way to use the language. I see some > documentation relating to classes but nothing on instantiation .. in fact > the documentation appears to say that classes are used in a static way e.g > ClassName.met

Re: jython lacks working xml processing modules?

2012-07-17 Thread Stefan Behnel
Matej Cepl, 17.07.2012 11:39: > On 17/07/12 10:35, gaodexiaozh...@gmail.com wrote: >>> > I'm trying to parse an xml file with jython (not through java >>> parsers >>> > like xerces). > > https://code.google.com/p/jython-elementtree/ ??? Note that this ships with Jython 2.5. Stefan -- http://ma

Re: jython lacks working xml processing modules?

2012-07-17 Thread Matej Cepl
On 17/07/12 10:35, gaodexiaozh...@gmail.com wrote: > I'm trying to parse an xml file with jython (not through java parsers > like xerces). https://code.google.com/p/jython-elementtree/ ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt QCalendarWidget events question

2012-07-17 Thread tinnews
John Posner wrote: > On 7/16/2012 12:28 PM, tinn...@isbd.co.uk wrote: > > tinn...@isbd.co.uk wrote: > >> I am trying to use the PyQt4 calendar widget to perform some different > >> actions on specific dates. There are three events available:- > >> > >> selectionChanged() > >> activated(QD

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 2:25 AM, Steven D'Aprano wrote: > It already is part of the collection interface: it is spelled __nonzero__ > (Python 2) or __bool__ (Python 3), and like all dunder methods, it is > called automatically for you when you use the right syntax: You're still ignoring what I ac

Re: jython lacks working xml processing modules?

2012-07-17 Thread Stefan Behnel
gaodexiaozh...@gmail.com, 17.07.2012 10:35: > hi,do you know the PyXML whether can be supported by Jython ? PyXML is a dead project, don't use it. You can use ElementTree in Jython, just as in Python. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: assertraises behaviour

2012-07-17 Thread andrea crotti
2012/7/16 Peter Otten <__pete...@web.de>: > No, I don't see how the code you gave above can fail with an OSError. > > Can you give an example that produces the desired behaviour with nose? Maybe > we can help you translate it to basic unittest. > > -- > http://mail.python.org/mailman/listinfo/pytho

OpenHatch - Chicago Python Workshop

2012-07-17 Thread Aisha Halim
Hi, I'm not sure if it's ok to post regarding a small local workshop (based on Railsbridge and the Boston Python Workshop) here so please direct me elsewhere if I am mistaken: OpenHatch's first Chicago Python workshop is heading our way, on August 17th - 18th. These events are tailored for women a

Encapsulation, inheritance and polymorphism

2012-07-17 Thread Lipska the Kat
Pythoners Python 2.7.3 Ubuntu Linux 12.04 LTS I've been taking a brief look at Python. From the tutorial documentation I get the following 'Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-ori

Re: jython lacks working xml processing modules?

2012-07-17 Thread gaodexiaozheng
在 2003年11月24日星期一UTC+8下午7时42分31秒,Paul Boddie写道: > janeaustin...@hotmail.com (Jane Austine) wrote in message > news:;... > > I'm trying to parse an xml file with jython (not through java parsers > > like xerces). > > > > I tried minidom in jython 2.1 a

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Chris Angelico
On Tue, Jul 17, 2012 at 6:23 PM, Andrew Berg wrote: > On 7/17/2012 2:08 AM, Steven D'Aprano wrote: >> The default behaviour is that every object is something, hence true-like, >> unless explicitly coded to be treated as false-like. Since both loggers >> and functions are objects, they are true-lik

Re: Simulation Results Managment

2012-07-17 Thread moogyd
On Sunday, July 15, 2012 6:20:34 PM UTC+2, rusi wrote: > On Jul 15, 11:35 am, Dieter Maurer wrote: > > moo...@yahoo.co.uk writes: > > > ... > > > Does pickle have any advantages over json/yaml? > > > > It can store and retrieve almost any Python object with almost no effort. >

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Andrew Berg
On 7/17/2012 2:08 AM, Steven D'Aprano wrote: > The default behaviour is that every object is something, hence true-like, > unless explicitly coded to be treated as false-like. Since both loggers > and functions are objects, they are true-like unless the default is > overridden. I am aware of the

Re: PyXML 0.8.2 is released

2012-07-17 Thread gaodexiaozheng
在 2003年1月26日星期日UTC+8下午10时01分02秒,"Martin v. Löwis"写道: > Tim C wrote: > > I've been trying pyxml from jython and fell into the problem when > trying to > > create executables that pyxml's mechanisms for importing modules > confound > > the compiler. > > What do you mean by "executable", and which

Re: No more Python support in NetBeans 7.0

2012-07-17 Thread jussij
On Thursday, March 24, 2011 7:32:44 AM UTC-7, Kees Bakker wrote: > Sad news (for me, at least), in the upcoming version 7.0 of NetBeans > there will be no Python plugin anymore. FWIW on the Windows platform the Zeus IDE has support for python: http://www.zeusedit.com/python.html Zeus is a l

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread John Nagle
On 7/15/2012 1:34 AM, Andrew Berg wrote: This has probably been discussed before, but why is there an implicit conversion to a boolean in if and while statements? if not None: print('hi') prints 'hi' since bool(None) is False. If this was discussed in a PEP, I would like a link to it. T

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Steven D'Aprano
On Tue, 17 Jul 2012 00:19:48 -0500, Andrew Berg wrote: > To put it in duck-typing terms, why should everything have to quack like > True or False? Sure, I can see why 1 quacks like True or [] quacks like > False, but I don't see why say, a Logger or function should quack like > either. The defaul