Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Chris Angelico
On Mon, Jul 16, 2012 at 12:58 PM, Steven D'Aprano wrote: > And that, the reason given in the sentence above, is the reason that we, > collectively all programmers, should prefer to be explicit, not merely > conveying meaning by implication about everything we, collectively all > programmers, write

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Chris Angelico
On Mon, Jul 16, 2012 at 2:53 PM, Ranting Rick wrote: > "if obj" is in essence doing "if bool(obj)" behind the scenes. My > question is: Why hide such valuable information from the reader? It's > obvious that "if bool(obj)" will return a boolean; whereas "if obj" is > ambiguous. Proves nothing. At

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Chris Angelico
On Mon, Jul 16, 2012 at 3:03 PM, Ranting Rick wrote: > But if you are going to argue that "if obj" is *explicit enough*, then > apply your argument consistently to "String"+1.75 also. Why must we be > explicit about string conversion BUT not boolean conversion? Can you > reduce this to the absurd?

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Chris Angelico
On Tue, Jul 17, 2012 at 11:57 AM, Andrew Berg wrote: > I could do: > > if has_message: > send('{command} {args} :{message}') > else: > send('{command} {args}') > > but then I'd have to make sure has_message stays accurate since message > won't necessarily be. Or maybe I could leave

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Chris Angelico
On Tue, Jul 17, 2012 at 2:18 PM, Ranting Rick wrote: > On Jul 16, 11:11 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > >> I imagine though that the Python dev's answer will basically be #2: "it >> isn't a container, it just behaves a little bit like a container, except >> when it d

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: 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 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-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 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!"). > > Actua

Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread Chris Angelico
On Fri, Jul 20, 2012 at 4:20 AM, Tim Chase wrote: > Sure it terminates...If you don't run out of RAM to represent the > number "i" in question, there's also this "heat death of the > universe" limit I keep hearing about ;-) I'd be more worried about the heat death of your computer, it's likely to

Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread Chris Angelico
On Fri, Jul 20, 2012 at 7:01 AM, John Gordon wrote: > In Dennis Lee Bieber > writes: > >> > Sure it terminates...If you don't run out of RAM to represent the >> > number "i" in question, there's also this "heat death of the >> > universe" limit I keep hearing about ;-) >> > >> Since the c

Re: Let child process to run while parent is out (multiprocessing)

2012-07-19 Thread Chris Angelico
On Fri, Jul 20, 2012 at 6:34 AM, John Wong wrote: > Here is output: > yeukhon@fermat:~$ python c2.py > abcd12345 > done [now hangs for 10 seconds] > I build things Side point: I just tried your code on Python 2.6 on Windows, and it produced all three lines of output before waiting the ten second

Re: reloading code and multiprocessing

2012-07-20 Thread Chris Angelico
On Thu, Jul 19, 2012 at 8:15 PM, andrea crotti wrote: > We need to be able to reload code on a live system. This live system > has a daemon process always running but it runs many subprocesses with > multiprocessing, and the subprocesses might have a short life... > ... > As long as I import the

Re: ANN: dbf.py 0.94

2012-07-20 Thread Chris Angelico
On Sat, Jul 21, 2012 at 12:56 PM, Temia Eszteri wrote: > On 21 Jul 2012 00:50:13 GMT, Steven D'Aprano > wrote: > >>> Latest version has a simpler, cleaner API, and works on PyPy (and >>> hopefully the other implementations as well ;), as well as CPython. >>> >>> Get your copy at http://python.org

Re: ANN: dbf.py 0.94

2012-07-20 Thread Chris Angelico
On Sat, Jul 21, 2012 at 1:34 PM, Steven D'Aprano wrote: > Unless the software is so well-known that everybody knows what it is... I've yet to meet ANY piece of software that's like that. Even with releases of CPython (arguably the primary point of this list) it wouldn't hurt to give an explanatio

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Chris Angelico
On Sat, Jul 21, 2012 at 5:33 PM, Jan Riechers wrote: > Block > #-- > if statemente_true: > doSomething() > else: > doSomethingElseInstead() > > #-- This means, to me, that the two options are peers - you do this or yo

Re: ANN: dbf.py 0.94

2012-07-21 Thread Chris Angelico
On Sat, Jul 21, 2012 at 6:02 PM, Ethan Furman wrote: > Works with CPython 2.4 - 2.7. (Tested) Have you considered supporting 3.2/3.3 at all? It's often not difficult to make your code compatible with both. Or is there some dependency that is locked to 2.X? ChrisA -- http://mail.python.org/mailm

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 4:16 AM, Rick Johnson wrote: > It was a nice run Google. We had good times and bad times. A few smiles and > cries. > > LMBTFY So, what... you reckon Microsoft is going to be the paragon of righteousness against the squalor of Google's information-grubbing tactics? Fascin

Re: ANN: dbf.py 0.94

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 4:15 AM, Ethan Furman wrote: > I'll support 3.3+, but not with the same code base: I want to use all the > cool features that 3.3 has! :) The trouble with double-codebasing is that you have double maintenance. But sure. So long as your time isn't under great pressure, it

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 9:07 AM, Devin Jeanpierre wrote: > People hold grudges against MS too strongly, and they believe too much > in Google's righteousness. They are both big companies that don't > necessarily care about you. Just to clarify, I'm not advocating the "Google is perfect" stance ei

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 10:20 AM, Steven D'Aprano wrote: > On Sun, 22 Jul 2012 04:25:21 +1000, Chris Angelico wrote: > >> Use whichever service you like, but don't seriously expect anything that >> you don't pay money for to be perfectly featured AND not spy

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 11:33 AM, Rick Johnson wrote: > On Saturday, July 21, 2012 6:16:24 PM UTC-5, Chris Angelico wrote: > >> Just to clarify, I'm not advocating the > [...snip...] > > Well. Well. Backpedaling AND brown-nosing in a single post. Nice! Absolutely. Ha

Re: My first ever Python program, comments welcome

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 11:56 AM, MRAB wrote: > Since the result is bound to the original name, the > result is the same. Yes, assuming there are no other refs. >>> a=[3,2,1] >>> b=a >>> a=sorted(a) >>> a [1, 2, 3] >>> b [3, 2, 1] ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: My first ever Python program, comments welcome

2012-07-22 Thread Chris Angelico
On Sun, Jul 22, 2012 at 6:49 PM, Andrew Berg wrote: > On 7/22/2012 3:37 AM, Lipska the Kat wrote: >> Many in >> the Linux world seem to use git. Seeing as I've been using Linux at home >> since the early days of slackware I suppose I'd better look into it. > There are Mercurial (aka Hg) and Bazaar

Re: default repr?

2012-07-22 Thread Chris Angelico
On Mon, Jul 23, 2012 at 8:48 AM, Dan Stromberg wrote: > If a class has defined its own __repr__ method, is there a way of getting > the default repr output for that class anyway? Methods are just functions, and you can call any method of any class with any object as its first parameter. object._

Re: default repr?

2012-07-22 Thread Chris Angelico
On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano wrote: >> Methods are just functions, and you can call any method of any class >> with any object as its first parameter. > > Not quite: they have to be an instance of that class. > >> Though this mightn't work with everything. I wasn't able to pai

Re: the meaning of r’.......‘

2012-07-23 Thread Chris Angelico
On Fri, Jul 20, 2012 at 5:56 PM, levi nie wrote: > the meaning of r’...‘? It's a raw string. http://docs.python.org/py3k/tutorial/introduction.html#strings Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: the meaning of rユ.......�¾

2012-07-23 Thread Chris Angelico
On Mon, Jul 23, 2012 at 10:55 PM, Roy Smith wrote: > Some day, we're going to have programming languages that take advantage > of the full unicode character set. Right now, we're working in ASCII > and creating silly digrams/trigrams like r'' for raw strings (and > triple-quotes for multi-line >

Re: the meaning of rユ.......ï¾

2012-07-23 Thread Chris Angelico
On Mon, Jul 23, 2012 at 11:24 PM, Henrik Faber wrote: > And if I think of PHP's latest fiasco that happened with unicode > characters, it makes me shudder to think you'd want that stuff in > Python. If I remember correctly, it was the Turkish locale that they > stuggled with: Turkey apparently doe

Re: reloading code and multiprocessing

2012-07-23 Thread Chris Angelico
On Mon, Jul 23, 2012 at 11:51 PM, andrea crotti wrote: > Anyway the only other problem which I found is that if I start the > subprocesses after many other things are initialised, it might happen > that the reloading doesn't work correctly, is that right? > > Because sys.modules will get inherited

Re: the meaning of rユ.......ï¾

2012-07-23 Thread Chris Angelico
On Mon, Jul 23, 2012 at 11:52 PM, Henrik Faber wrote: > What about × vs x? Or Ì vs Í vs Î vs Ï vs Ĩ vs Ī vs ī vs Ĭ vs ĭ vs Į vs > į vs I vs İ? Do you think if you need to maintain such code you'll > immediately know the difference between the 13 (!) different "I"s I just > happened to pull out ran

Re: the meaning of rユ.......ï¾

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 12:40 AM, Henrik Faber wrote: > No, you misunderstood me. I didn't say people are going to write > gibberish. What I'm saying is that as a foreigner (who doesn't know most > of these characters), it can be hard to accurately choose which one is > the correct one. This is es

Re: What's wrong with this code?

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 12:50 AM, Stone Li wrote: > > I'm totally confused by this code: > > Code: Boiling it down to just the bit that matters: c = None d = None x = [c,d] e,f = x c = 1 d = 2 print e,f When you assign "e,f = x", you're taking the iterable x and unpacking its contents. There's

Re: the meaning of rユ.......�¾

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 1:59 AM, Steven D'Aprano wrote: >> http://www.rexswain.com/rexx.html#operators > > Only one? Pfft. > > What's the difference between >> "Strictly greater than" and < "Greater > than"? The non-strict forms strip trailing spaces off strings before comparing. I can't remember

Re: Encapsulation, inheritance and polymorphism

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 2:18 AM, Albert van der Horst wrote: > Example from recipee's: > > Stirr until the egg white is stiff. > > Alternative: > Stirr egg white for half an hour, > but if the egg white is stiff keep your spoon still. > > (Cooking is not my field of expertise, so the wording may >

Re: dict: keys() and values() order guaranteed to be same?

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 1:20 AM, Steven D'Aprano wrote: > (Although if you think about the implementation of dicts as hash tables, > it does seem likely that it is trivial to enforce this -- one would have > to work *harder* to break that promise than to keep it.) However, it would be quite reaso

Re: the meaning of r’.......‘

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 7:07 AM, Terry Reedy wrote: > On 7/23/2012 3:59 AM, Chris Angelico wrote: >> >> On Fri, Jul 20, 2012 at 5:56 PM, levi nie wrote: >>> >>> the meaning of r’...‘? >> >> >> It's a raw string. >> >

Re: Freedom and Data (was Gender, Representativeness and Reputation in StackOverflow)

2012-07-23 Thread Chris Angelico
On Tue, Jul 24, 2012 at 1:56 PM, rusi wrote: > "How many of you use Linux?" I ask. The awkwardness is in the definition of the question. Many of the products that I buy will have, at some point, been carried by a truck, but I would answer "No" if someone asked me if I use a truck. Would you say t

Re: What's wrong with this code?

2012-07-24 Thread Chris Angelico
On Tue, Jul 24, 2012 at 5:47 PM, Ulrich Eckhardt wrote: > There is one model that has helped me much understanding how Python ticks > and that is the model of name tags. The code "a = 1" creates an integer with > value 1 and attaches a tag with "a" written on it using a small piece of > rope. A d

Re: the meaning of rユ.......ï¾

2012-07-24 Thread Chris Angelico
On Tue, Jul 24, 2012 at 1:56 AM, John Gordon wrote: > In Mark Lawrence > writes: > >> Sorry not with you is there something special about April 1st next year? > > In the United States, April 1st (also known as April Fool's Day) is an > occasion for practical jokes, faked 'news' stories, and gen

Re: Gender, Representativeness and Reputation in StackOverflow

2012-07-24 Thread Chris Angelico
On Tue, Jul 24, 2012 at 12:51 PM, Devin Jeanpierre wrote: > When people boycott a product, it isn't because not having the product > is better than having the product. That's clearly untrue: despite the > reasons for the boycott, the product has some value. That's because you don't call it boycot

Re: the meaning of rユ.......ï¾

2012-07-24 Thread Chris Angelico
On Wed, Jul 25, 2012 at 12:35 AM, Ben Finney wrote: > Chris Angelico writes: > >> […] Pi Day, has two different dates (the American and the European - >> of course, here in Australia, we celebrate both). > > What would be the two days? The 14th day of the 3rd month, and

Re: the meaning of rユ.......ï¾

2012-07-24 Thread Chris Angelico
On Wed, Jul 25, 2012 at 2:36 AM, Ian Kelly wrote: > On Tue, Jul 24, 2012 at 8:50 AM, Chris Angelico wrote: >> Americans celebrate March 14th as 3.14; some Europeans celebrate July >> 22nd as 22/7 (which is 3.142857, fairly close to 3.14159). We claim >> both, and also June

Re: howto do a robust simple cross platform beep

2012-07-24 Thread Chris Angelico
On Wed, Jul 25, 2012 at 7:39 AM, Gelonida N wrote: > On 07/15/2012 03:15 AM, rantingrickjohn...@gmail.com wrote:> On Friday, July > 13, 2012 8:00:05 PM UTC-5, gelonida wrote: >>> I just want to use a beep command that works cross platform. [...] I >>> just want to use them as alert, when certain e

Re: the meaning of rユ.......ï¾

2012-07-24 Thread Chris Angelico
On Wed, Jul 25, 2012 at 1:07 PM, Ben Finney wrote: > Which is appropriate, since 22/7 misses π by a wide margin. (355/113 is > my favourite approximation to π, and is far more accurate.) 22/7 is no worse than 3.14, though. Sure, 355/113 is closer still, but how often do really need more accuracy

Re: from future import pass_function

2012-07-25 Thread Chris Angelico
On Wed, Jul 25, 2012 at 6:40 PM, Ulrich Eckhardt wrote: > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, and similarly to the print() function, there > could be a pass() function that does and returns nothing. > > Example: >def pass():

Re: from future import pass_function

2012-07-25 Thread Chris Angelico
On Thu, Jul 26, 2012 at 1:30 PM, Ross Ridge wrote: > Steven D'Aprano wrote: >>I can't believe I actually have to point this out explicitly, but pass is >>not print. Apart from them both starting with the letter "P", they are >>nothing alike. There are good reasons for making print a function, an

Re: from future import pass_function

2012-07-26 Thread Chris Angelico
On Thu, Jul 26, 2012 at 7:16 PM, Devin Jeanpierre wrote: > On Thu, Jul 26, 2012 at 1:20 AM, Michael Hrivnak wrote: >> If we want pass(), then why not break() and continue()? And also >> def() and class()? for(), while(), if(), with(), we can make them all >> callable objects! > > No, you actual

Re: catch UnicodeDecodeError

2012-07-26 Thread Chris Angelico
On Thu, Jul 26, 2012 at 5:46 PM, Jaroslav Dobrek wrote: > My problem is solved. What I need to do is explicitly decode text when > reading it. Then I can catch exceptions. I might do this in future > programs. Apologies if it's already been said (I'm only skimming this thread), but ISTM that you

Re: from future import pass_function

2012-07-26 Thread Chris Angelico
On Fri, Jul 27, 2012 at 3:19 AM, Prasad, Ramit wrote: >> No offence to all the well meaning participants here, but this looks like >> trolling > > I thought Ranting Rick had sole dominion over trolling? Certainly not. We are well endowed with trolls here (Xah Lee isn't prolific, but is certainly

Re: from future import pass_function

2012-07-26 Thread Chris Angelico
On Fri, Jul 27, 2012 at 4:01 AM, Dennis Lee Bieber wrote: > On Thu, 26 Jul 2012 19:42:11 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > >> Well, if/while/for could be functions. So could with, probably. Now, >> def would be a little tricky...

OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-28 Thread Chris Angelico
On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence wrote: > I highly recommend the use of notepad++. If anyone knows of a better text > editor for Windows please let me know :) My current preference is SciTE, available on Linux and Windows both. It's configured using Lua, has lexers (and thus syntax

Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-28 Thread Chris Angelico
On Sun, Jul 29, 2012 at 3:43 AM, wrote: > On Saturday, July 28, 2012 5:51:48 PM UTC+2, Chris Angelico wrote: > > ... and has a few limitations (eg it only really supports >> >> UTF-8), > > ?! > > It's my daily plain text editor (Windows) since ? (I don

Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-28 Thread Chris Angelico
On Sun, Jul 29, 2012 at 7:43 AM, hamilton wrote: > On 7/28/2012 1:23 PM, wxjmfa...@gmail.com wrote: >> >> For info: http://scintilla.org/ > > > Just did a quick check on scintilla. > > This looks like a single file editor. > > Is there a project like capability in there that I did not notice ? Sc

Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-28 Thread Chris Angelico
On Sun, Jul 29, 2012 at 12:33 PM, hamilton wrote: > Ok, so the answer is no. In terms of the editor, it's fine; you need only worry about Scintilla itself if you're aiming to incorporate it in your own program. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Error

2012-07-29 Thread Chris Angelico
On Mon, Jul 30, 2012 at 12:36 AM, wrote: > If this kind of problems happen, --rare but in my 6 yrs Python experience > happened sometimes--then I take a new window, rewrite or copy the earlier > code module by module, give a new method name--believe it or not--- works. If that solves your prob

Re: Linux shell to python

2012-07-30 Thread Chris Angelico
On Mon, Jul 30, 2012 at 5:05 PM, Vikas Kumar Choudhary wrote: > > I was trying porting from bash shell to python. > > let me know if someone has tried to implement (grep and PIPE) shell commands > in python `lspci | grep Q | grep "$isp_str1" | grep "$isp_str2" | cut -c1-7' Welcome! While it's

Re: Is Python a commercial proposition ?

2012-07-30 Thread Chris Angelico
On Mon, Jul 30, 2012 at 4:07 PM, Stefan Behnel wrote: > Still, you may still get away with the above statement by providing a > sufficiently narrow definition of "standalone". By my definition, there > isn't much "standalone" code out there. Most code I know interfaces with a > couple of external

Re: Linux shell to python

2012-07-31 Thread Chris Angelico
On Tue, Jul 31, 2012 at 5:15 PM, Mark Lawrence wrote: > On 31/07/2012 02:20, Dennis Lee Bieber wrote: >> >> should be pecked to death by a dead parrot. >> > > Any particular species? I'm sure that, if you're in Norway, you could find an appropriate bird. But for those of us for whom that's not an

Re: profiling and optimizing

2012-07-31 Thread Chris Angelico
int is moot in this instance, since you're doing the profiling/optimization for education rather than performance :) Have fun with it! Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: simplified Python parsing question

2012-07-31 Thread Chris Angelico
On Tue, Jul 31, 2012 at 11:54 AM, Steven D'Aprano wrote: > Google Docs is, in my opinion, a nasty piece of rubbish > that doesn't run on any of my browsers. As far as I'm concerned, I'd > rather download a Word doc, because at least I can open that in > OpenOffice or Abiword and read it. Something

Re: The way to develope a graphical application to manage a Postgres database

2012-08-02 Thread Chris Angelico
On Fri, Aug 3, 2012 at 4:24 AM, Csanyi Pal wrote: > I'm searching for a way to develope a Python graphical application for a > Postgresql database. There's two quite separate parts to this: * Develop a Python graphical application * Develop a Python application [to access] a PostgreSQL database.

Re: unable to get simple html file up

2012-08-03 Thread Chris Angelico
On Sat, Aug 4, 2012 at 2:40 AM, Smaran Harihar wrote: > guys i m still waiting for a reply You may get more helpful results if you add more information to your question. Also, be aware that you're asking volunteers to donate their time to you; according to the timestamps, it's less than a day sin

Re: attribute is accessed from Nonetype

2012-08-03 Thread Chris Angelico
On Sat, Aug 4, 2012 at 8:20 AM, Dave Angel wrote: > I'm sorry, what's not clear? Nonetype is not the same as NoneType. > Python is case sensitive. There isn't a NoneType either. I get a NameError. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: On-topic: alternate Python implementations

2012-08-03 Thread Chris Angelico
On Sat, Aug 4, 2012 at 4:15 PM, Steven D'Aprano wrote: > CLPython, an implementation of Python written in Common Lisp. > > Berp - a compiler which works by translating Python to Haskell and > compiling that. Okay. WHY? CLPython gives some reason, but how often do you need to bridge that particula

Re: Intermediate Python user needed help

2012-08-06 Thread Chris Angelico
On Tue, Aug 7, 2012 at 5:22 AM, Dennis Lee Bieber wrote: > So am I beginner, intermediate, advanced, expert? I wonder would this sort of a scale help: http://www.geekcode.com/geek.html#perl Novice: P Intermediate: P+ or P++ Advanced: P+++ Master: P ChrisA -- http://mail.python.org/mailman

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Chris Angelico
On Tue, Aug 7, 2012 at 2:34 AM, rusi wrote: > BTW in "automatic garbage collection" which of the three words is most > important? Least? Most important is "garbage". I sure don't want any language I use to automatically collect non-garbage!! But in seriousness, the definition of "garbage" is one

Re: find out whether a module exists (without importing it)

2012-08-07 Thread Chris Angelico
On Tue, Aug 7, 2012 at 6:00 PM, Gelonida N wrote: > modulename = 'my.module' > cmd = 'import %s as amodule' > try: > exec(cmd) > print "imported successfully" Someone will doubtless correct me if I'm wrong, but I think you can avoid exec here with: amodule=__import__(modulename) ChrisA

Re: Looking for a good introduction to object oriented programming with Python

2012-08-07 Thread Chris Angelico
On Wed, Aug 8, 2012 at 3:00 AM, lipska the kat wrote: > I'm still undecided over the whole 'User' thing actually, I don't think I > can see a time when I will have a User Class in one of my systems but as I > don't want to get 'dogmatic' about this I remain open to any ideas that > might include s

Re: Looking for a good introduction to object oriented programming with Python

2012-08-07 Thread Chris Angelico
On Wed, Aug 8, 2012 at 12:14 PM, Steven D'Aprano wrote: > NoneType raises an error if you try to create a second instance. bool > just returns one of the two singletons (doubletons?) again. > > py> type(None)() > Traceback (most recent call last): > File "", line 1, in > TypeError: cannot creat

Re: Looking for a good introduction to object oriented programming with Python

2012-08-08 Thread Chris Angelico
On Thu, Aug 9, 2012 at 3:28 AM, Steven D'Aprano wrote: > (As they say: I'll believe that corporations are people when Texas > executes one.) If proper excuse you can trump any, You may wind up a Limited Company You cannot conveniently blow it up! -- WS Gilbert, "Utopia, Ltd" But not every "is-a

Re: Is there a clever way to pass arguments

2012-08-09 Thread Chris Angelico
On Thu, Aug 9, 2012 at 7:05 PM, Jean-Michel Pichavant wrote: > bruceg113...@gmail.com wrote: >> >> I cannot change the function definition. > > or better (imo) > testData(z) and make testData handle a list (8 parameters, that's a lot of > parameters). He can't change the function definition. Chr

Re: save dictionary to a file without brackets.

2012-08-09 Thread Chris Angelico
On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote: > On 08/09/2012 06:03 PM, Andrew Cooper wrote: >> O(n) for all other entries in the dict which suffer a hash collision >> with the searched entry. >> >> True, a sensible choice of hash function will reduce n to 1 in common >> cases, but it becomes

Re: save dictionary to a file without brackets.

2012-08-09 Thread Chris Angelico
On Fri, Aug 10, 2012 at 8:39 AM, Tim Chase wrote: > On 08/09/12 17:26, Dave Angel wrote: >> On 08/09/2012 06:03 PM, Andrew Cooper wrote: >> I'm glad you're wrong for CPython's dictionaries. The only time the >> lookup would degenerate to O[n] would be if the hash table had only one >> slot. CPyt

Re: save dictionary to a file without brackets.

2012-08-09 Thread Chris Angelico
On Fri, Aug 10, 2012 at 9:05 AM, Roy Smith wrote: > Python assumes you are a consenting adult. If you wish to engage in > activities which are hazardous to your health, so be it. ... you mean, Python lets you make a hash of it? *ducks for cover* ChrisA -- http://mail.python.org/mailman/listin

Re: save dictionary to a file without brackets.

2012-08-09 Thread Chris Angelico
On Fri, Aug 10, 2012 at 10:16 AM, Tim Chase wrote: > We apologise for the off-topicness in the thread. Those responsible > have been sacked... So if you take every mapping variable in your program and name them "dFoo", "dBar", "dQuux", etc, for "dict"... would that be a dirty Hungarian dictionar

Re: [newbie] A question about lists and strings

2012-08-10 Thread Chris Angelico
On Fri, Aug 10, 2012 at 8:12 PM, Mok-Kong Shen wrote: > Thanks for the explanation of the output obtained. But this means > nonetheless that parameters of types lists and strings are dealt with > in "inherently" (semantically) different ways by Python, right? It's nothing to do with parameters, b

Re: [newbie] A question about lists and strings

2012-08-10 Thread Chris Angelico
to change that string, and what you're really looking to accomplish. There may well be a better way. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: [newbie] A question about lists and strings

2012-08-10 Thread Chris Angelico
On Fri, Aug 10, 2012 at 8:56 PM, Dave Angel wrote: >> On Fri, Aug 10, 2012 at 8:07 PM, Dave Angel wrote: >>> But if you said c=651 and d=651, you'd have two >>> objects, and the two names would be bound to different objects, with >>> different ids. >> To be more accurate, you *may* have two diff

Re: [GENERAL] Postgres and Upstart

2012-08-10 Thread Chris Angelico
On Fri, Aug 10, 2012 at 11:56 PM, Albe Laurenz wrote: > Chris Angelico wrote: >> I'm looking for a reliable way to be sure that Postgres has finished >> its initialization and is ready to rumble. > > The normal way to test this is a connection attempt. > You could a

Re: dictionary into desired variable....

2012-08-10 Thread Chris Angelico
value = value[idx] At the end of that, 'value' will be the same as 'y[1][3][6][1][1]'. If that's not what you mean, you may want to clarify your question some. Hope that helps! Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic with Boolean values

2012-08-11 Thread Chris Angelico
On Sun, Aug 12, 2012 at 8:30 AM, John Ladasky wrote: > In [7]: 1 + not(len(L) % 2) > >File "", line 1 > 1 + not(len(L) % 2) >^ > SyntaxError: invalid syntax This appears to be a limitation of the parser; it's trying

Re: Arithmetic with Boolean values

2012-08-11 Thread Chris Angelico
On Sun, Aug 12, 2012 at 10:25 AM, Terry Reedy wrote: > On 8/11/2012 7:13 PM, Chris Angelico wrote: >> This appears to be a limitation of the parser; it's trying to >> interpret "not" as a binary operator. > > I think not. It is lower precedence than all arithme

Re: Official reason for omitting inspect.currentcallable() ?

2012-08-13 Thread Chris Angelico
On Mon, Aug 13, 2012 at 6:24 PM, Steven D'Aprano wrote: > On Sun, 12 Aug 2012 23:06:19 +, kj wrote: > >> Is there an *explicitly stated* reason (e.g. in a PEP, or in some python >> dev list message) for why the inspect module (at least for Python 2.7) >> does not include anything like a "curre

Re: Threading KeyError in Python 3.3 beta 2?

2012-08-13 Thread Chris Angelico
On Mon, Aug 13, 2012 at 8:36 PM, Blind Anagram wrote: > I thought I would try out Python 3.3 beta 2. > This works well so far but I keep getting the message: > > Exception KeyError: KeyError(6308,) in 'c:\\Program Files\\Python33\\lib\\threading.py'> ignored > > after some of my python code compl

Re: Threading KeyError in Python 3.3 beta 2?

2012-08-13 Thread Chris Angelico
On Mon, Aug 13, 2012 at 9:24 PM, Blind Anagram wrote: > > Here is a fairly short bit of code which produces the exception: > > for pre in ('12', '13', '14', '15', '21' ): > n = int(pre + '543') > s = str(n * n) > if len(set(s)) == 9: >print(n, s) Interesting. I just downloaded a clean 3.3

Re: Threading KeyError in Python 3.3 beta 2?

2012-08-13 Thread Chris Angelico
On Mon, Aug 13, 2012 at 9:38 PM, Steven D'Aprano wrote: > Since your code doesn't even import threading, let alone use it, I can't > imagine how you get an error in threading. Hey, I try not to get scornful until at least the sixth post :) ChrisA -- http://mail.python.org/mailman/listinfo/pytho

Re: Threading KeyError in Python 3.3 beta 2?

2012-08-13 Thread Chris Angelico
On Mon, Aug 13, 2012 at 9:51 PM, Blind Anagram wrote: > Thanks to you both for your responses. > > Its an IDE issue of some kind (I am using WING). > > When I run under a command prompt (or IDLE) all is well. Next time, do mention that sort of environmental consideration in the original post :)

Re: Sharing code between different projects?

2012-08-13 Thread Chris Angelico
On Tue, Aug 14, 2012 at 2:53 AM, andrea crotti wrote: > The problem is that there are functions/classes from many domains, so it > would not make much sense to create a real project, and the only name I > could give might be "utils or utilities".. There's actually much merit in a generic utilitie

Re: How to uncompress a VOB file? (Win XP)

2012-08-13 Thread Chris Angelico
On Tue, Aug 14, 2012 at 9:00 AM, Xantipius wrote: > Mark, in regard your last remark: > it's just a recreation for me. Nothing more in it. > I like to put some weird and useless problems before myself. In that case, I strongly recommend that you write some code instead of throwing zero-effort que

Re: pylagiarism -- Need help now! Please provide code...

2012-08-14 Thread Chris Angelico
On Tue, Aug 14, 2012 at 4:34 PM, Simon Cropper wrote: > I need help putting together some code; today preferably, my boss is on my > back. Can someone please contribute a functioning module showing me how to > do it? > Sure, old man, we'll help you out! *throws Maurice out of the tavern* ChrisA

Re: pylagiarism -- Need help now! Please provide code...

2012-08-14 Thread Chris Angelico
On Tue, Aug 14, 2012 at 9:46 PM, Mark Lawrence wrote: > Well I fell for it, there I was thinking you were serious and right at the > bottom you have a disclaimer saying it was tongue in cheek. You got me > hook, line and sinker. :) At least you had the grace to admit that you were tricked :) I

Re: [OT] Posting under ones full name (was: How to uncompress a VOB file? (Win XP))

2012-08-14 Thread Chris Angelico
On Wed, Aug 15, 2012 at 7:12 AM, Thomas 'PointedEars' Lahn wrote: > Probably you were asked that so that your postings could be distinguished > from that of the other potential Marks around here. I have my surname in my From address, but I tend to sign my posts "ChrisA" (no relation, btw, to Dave

Re: Strange behavior

2012-08-14 Thread Chris Angelico
onsider working with the current version - Python 2 won't get any more features added to it any more.) Python's an awesome language. You may have to get your head around a few new concepts as you shift thinking from PHP's, but it's well worth while. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Posting under ones full name (was: How to uncompress a VOB file? (Win XP))

2012-08-14 Thread Chris Angelico
On Wed, Aug 15, 2012 at 9:55 AM, Steven D'Aprano wrote: > On Wed, 15 Aug 2012 07:46:31 +1000, Chris Angelico wrote: > >> I have my surname in my From address, but I tend to sign my posts >> "ChrisA" (no relation, btw, to DaveA, though our surnames are similar). &g

Re: [OT] Posting under ones full name

2012-08-14 Thread Chris Angelico
On Wed, Aug 15, 2012 at 12:06 PM, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > >> I have my surname in my From address, but I tend to sign my posts >> "ChrisA" (no relation, btw, to DaveA, though our surnames are >> similar). That&#x

Re: [OT] Posting under ones full name

2012-08-14 Thread Chris Angelico
On Wed, Aug 15, 2012 at 12:06 PM, Thomas 'PointedEars' Lahn wrote: > Please use `[...]' or `[…]' to indicate omission instead. I could have > written `politeness...' myself. Incidentally, how _do_ the square brackets help? Can a reader know that you put square-bracketed dots and that I didn't om

Re: How to uncompress a VOB file? (Win XP)

2012-08-14 Thread Chris Angelico
On Wed, Aug 15, 2012 at 1:31 PM, Ben Finney wrote: > People have the right to ask to be known by a particular name, but they > are obliged to be reasonable about how successful their request will be > when they ask. Reminds me of what Torhelm said during one of our Dungeons and Dragons campaigns:

<    4   5   6   7   8   9   10   11   12   13   >