Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Steven D'Aprano
On Mon, 16 Jul 2012 11:13:33 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Sun, 15 Jul 2012 10:19:16 -0600, Ian Kelly wrote: On Sun, Jul 15, 2012 at 4:56 AM, Steven D'Aprano wrote: (For the record, I can only think of one trap for the unwary: time objects are false at *exactly*

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Steven D'Aprano
On Tue, 17 Jul 2012 00:18:28 -0400, Devin Jeanpierre wrote: On Mon, Jul 16, 2012 at 12:03 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 15 Jul 2012 22:15:13 -0400, Devin Jeanpierre wrote: For example, instead of if stack: or if bool(stack):, we could use if

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 default

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.

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

Re: PyXML 0.8.2 is released

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

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: 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 lt;die...@handshake.degt; wrote: gt; moo...@yahoo.co.uk writes: gt; gt; ... gt; gt; Does pickle have any advantages over json/yaml? gt; gt; It can store and retrieve almost any Python object with almost

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 bahamutzero8...@gmail.com 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

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:lt;ba1e306f.0311201805.9df...@posting.google.comgt;... gt; I#39;m trying to parse an xml file with jython (not through java parsers gt; like xerces). gt; gt; I tried minidom in

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

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

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/python-list

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: 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 steve+comp.lang.pyt...@pearwood.info 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

Re: PyQt QCalendarWidget events question

2012-07-17 Thread tinnews
John Posner jjpos...@optimum.net 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()

Re: jython lacks working xml processing modules?

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

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: gt; I#39;m trying to parse an xml file with jython (not through java parsers gt; like xerces). https://code.google.com/p/jython-elementtree/ ??? Note that this ships with Jython 2.5. Stefan --

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 4:45 AM, Lipska the Kat lip...@lipskathekat.com 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

Re: code review

2012-07-17 Thread Albert van der Horst
In article XnsA0927750022F4duncanbooth@127.0.0.1, Duncan Booth duncan.bo...@suttoncourtenay.org.uk wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 13 Jul 2012 12:30:47 +, Albert van der Horst wrote: The worst of is, of course, = for assignment instead of := .

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: 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

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 also

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Dave Angel
On 07/17/2012 07:01 AM, Lipska the Kat wrote: SNIP 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

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 Katlip...@lipskathekat.com 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

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 type

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 then

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

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

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: 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

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 have

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: 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

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

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.

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

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Roy Smith
In article -8sdnvrxgqie25jnnz2dnuvz7qkdn...@bt.com, Lipska the Kat lip...@lipskathekat.com 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

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 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

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 lt;hamil...@nothere.comgt; wrote: gt; Subject: Diagramming code gt; gt; Is there any software to help understand python code ? What sort of diagrams? Control flow diagrams? Class diagrams? Sequence

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

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 Katlip...@lipskathekat.com 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

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: 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 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 Katlip...@lipskathekat.com wrote: I'm not used to using variables without declaring their type If you truly wanted to recreate this type-bondage

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 Luncher

Re: Style question: metaclass self vs cls?

2012-07-17 Thread Ian Kelly
On Tue, Jul 17, 2012 at 6:23 AM, Michele Simionato michele.simion...@gmail.com 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: Style question: metaclass self vs cls?

2012-07-17 Thread Ian Kelly
On Tue, Jul 17, 2012 at 12:10 AM, alex23 wuwe...@gmail.com wrote: On Jul 17, 1:29 am, Steven D'Aprano steve +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

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()

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

Re: Blank TK Window

2012-07-17 Thread woooee
On Jul 17, 9:32 am, Shamefaced manengstud...@gmail.com 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 =

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

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

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

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: PyQt QCalendarWidget events question

2012-07-17 Thread Chris Angelico
On Tue, Jul 17, 2012 at 7:34 PM, tinn...@isbd.co.uk 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

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

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 case also the second test is

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 which tells sort

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

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

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Chris Angelico
On Wed, Jul 18, 2012 at 12:23 AM, Lipska the Kat lip...@lipskathekat.com 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

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 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 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

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

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

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__':

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

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 1:07 PM, Terry Reedy tjre...@udel.edu 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.

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

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

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

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

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: 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 han...@xs4all.nl 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

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 if __name__ == '__main__':

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: 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 instance of

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

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

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)

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ian Kelly
On Tue, Jul 17, 2012 at 4:57 PM, Ethan Furman et...@stoneleaf.us 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

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

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 checking and making code

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread alex23
On Jul 17, 6:23 pm, Andrew Berg bahamutzero8...@gmail.com 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

my email

2012-07-17 Thread Maria Hanna Carmela Dionisio
mmdionisio1...@yahoo.com.ph Just a newbhie here : From: python-list-requ...@python.org 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

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 et...@stoneleaf.us 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

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

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

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: 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

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: gt; On 17/07/12 10:35, gaodexiaozh...@gmail.com wrote: gt;gt;gt; amp;gt; Iamp;#39;m trying to parse an xml file with jython (not through java gt;gt;gt; parsers gt;gt;gt; amp;gt; like xerces). gt; gt;

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

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread rusi
On Jul 18, 5:46 am, Andrew Cooper am...@cam.ac.uk 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-bondage' is a strange

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-17 Thread Chris Jerdonek
Chris Jerdonek chris.jerdo...@gmail.com added the comment: I'd like to work on this if that's okay. I've already written test cases for issue 7559 and issue 15299 that required creating temporary packages, so I understand the need. And I'd also like to create test cases for issue 14787,

[issue15376] Refactor the create-package code in test_runpy into a helper module

2012-07-17 Thread Chris Jerdonek
New submission from Chris Jerdonek chris.jerdo...@gmail.com: This issue is to refactor the create-package code in test_runpy into a helper module, as suggested in issue 15358. This is a prerequisite to moving the pkgutil.walk_package() tests from test_runpy into test_pkgutil. --

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-17 Thread Chris Jerdonek
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- dependencies: +Refactor the create-package code in test_runpy into a helper module ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15358

[issue15374] venv environment variable should follow the conventions

2012-07-17 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Yes, there are a number of third-party utility packages (and many, many e.g. personal custom bash prompts) that check the value of the $VIRTUAL_ENV variable to detect whether one is currently active, and display its name. Unless there's an

  1   2   >