Re: if the else short form

2010-10-05 Thread Antoon Pardon
On Wed, Oct 06, 2010 at 01:45:51PM +1300, Lawrence D'Oliveiro wrote: > In message , Antoon > Pardon wrote: > > > On Tue, Oct 05, 2010 at 06:55:33PM +1300, Lawrence D'Oliveiro wrote: > > > >> In message , Antoon > >> Pardon wrote: > >> > >> > On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksi

Re: if the else short form

2010-10-05 Thread Lawrence D'Oliveiro
In message <20101005223520.3f5d9...@geekmail.invalid>, Andreas Waldenburger wrote: > On Tue, 05 Oct 2010 18:54:42 +1300 Lawrence D'Oliveiro > wrote: > >> “boolnoob” > > Bwahahahah! Nice! And of course, an instance of such boolnoobery can be referred to as a boolnoobism. :) -- http://mail.p

Re: meta-class review

2010-10-05 Thread Ethan Furman
MRAB wrote: On 06/10/2010 00:17, Ethan Furman wrote: > [snip] > Any comments appreciated, especially ideas on how to better handle > class- and staticmethods > I think that's a bit of overkill. The problem lies in the printing part, but you're spreading the solution into the rest of the appli

Re: Re: How to save a binary file?

2010-10-05 Thread Chris Rebert
> On Oct 5, 2010 8:03pm, MRAB wrote: >> On 05/10/2010 23:50, hid...@gmail.com wrote: >> I did but the mistake is: Error interpreting JPEG image file (Not a JPEG >> file: starts with 0x5c 0x6e) >> >> I think the problem is maybe in the binary code here is: >>  > On Oct 5, 2010 6:18pm, "Jonas H." j

Re: Re: How to save a binary file?

2010-10-05 Thread hidura
I has to use repr to convert in this string: ÿØÿà\x00\x10JFIF? On Oct 5, 2010 8:03pm, MRAB wrote: On 05/10/2010 23:50, hid...@gmail.com wrote: I did but the mistake is: Error interpreting JPEG image file (Not a JPEG file: starts with 0x5c 0x6e) I think the problem is maybe in the bina

Re: help!!!

2010-10-05 Thread Jason Swails
This looks like homework. There's very little to be gained by having an anonymous forum poster do your HW for you. (it looks like all it does is fill an array from a file, anyway, not terribly difficult). If you want to learn python, google the necessary tasks (i.e. opening a file and parsing it

Free download: Hot HD movies: Torrent, RAPIDSHARE, megaupload .... LINK, update daily...

2010-10-05 Thread Sheila maria
HD Family Club -- download HD DVD Movies with rapidshare, megaupload, torrent link ... 100% free .. The Expendables (2010), hot movie!!! Sylvester Stallone, Jason Statham, Jet Li, Dolph Lundgren http://hd-family.blogspot.com/2010/09/expendables-2010.html Redline (2007) RAPIDSHARE LINK; t

Re: help!!!

2010-10-05 Thread James Mills
On Wed, Oct 6, 2010 at 1:54 PM, wrote: > plz can u convert this cpp file into python i need that badly as soon as > possible... I am new to python. I just wanna learn it Should take you 10 minutes to convert this to Python assuming you know a little C/C++. Doing this yourself will teach you

help!!!

2010-10-05 Thread fkrafi
plz can u convert this cpp file into python i need that badly as soon as possible... I am new to python. I just wanna learn it#include int main() { int a[100], n; freopen("input.txt", "r", stdin); scanf("%d", &n); for(int i=1; i<=n; i++) scanf(

www.dating4url.blogspot.com

2010-10-05 Thread roshini begum
Hi visit my website "www.dating4url.blogspot.com" for hot dating images, real dating tips -- http://mail.python.org/mailman/listinfo/python-list

Re: if the else short form

2010-10-05 Thread Andreas Waldenburger
On Tue, 05 Oct 2010 18:54:42 +1300 Lawrence D'Oliveiro wrote: > “boolnoob” Bwahahahah! Nice! I'd love to say that I'll add this to my active vocabulary, but I don't think there will be enough opportunities to use it. :-/ /W -- INVALID? DE! -- http://mail.python.org/mailman/listinfo/python-

Re: Module loading trickery

2010-10-05 Thread Dave Angel
On 2:59 PM, Thomas Jollans wrote: % cat a.py foo = 'Meh.' import b % cat b.py from a import foo print(foo) % python a.py Meh. % But there are now two modules containing separate items foo, one is called __main__, and the other is called a. The former is the script you ran, and the la

Re: if the else short form

2010-10-05 Thread Lawrence D'Oliveiro
In message , Antoon Pardon wrote: > On Tue, Oct 05, 2010 at 06:55:33PM +1300, Lawrence D'Oliveiro wrote: > >> In message , Antoon >> Pardon wrote: >> >> > On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksic wrote: >> > >> >> BTW adding "==True" to a boolean value is redundant and can even br

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Lawrence D'Oliveiro
In message <87d3rorf2f@web.de>, Diez B. Roggisch wrote: > Lawrence D'Oliveiro writes: > >> What exactly is the point of a BOM in a UTF-8-encoded file? > > It's a marker like the "coding: utf-8" in python-files. It tells the > software aware of it that the content is UTF-8. But if the softw

Re: Best Git library for Python?

2010-10-05 Thread Lawrence D'Oliveiro
In message , Dun Peal wrote: > On Oct 4, 7:23 pm, Lawrence D'Oliveiro > wrote: > >> You can already check the exit status from the subprocess. What more do >> you need? > > A robust mechanism to deal with said issues... You haven’t explained what “issues” will not be reported via a failure exi

Re: meta-class review

2010-10-05 Thread MRAB
On 06/10/2010 00:17, Ethan Furman wrote: > On one the many mini-reports we use, we have a bunch of counts that > are frequently zero; because the other counts can also be low, it > becomes easy to miss the non-zero counts. For example: > > Code Description > > Conv Errors :

Re: How to save a binary file?

2010-10-05 Thread MRAB
On 05/10/2010 23:50, hid...@gmail.com wrote: I did but the mistake is: Error interpreting JPEG image file (Not a JPEG file: starts with 0x5c 0x6e) I think the problem is maybe in the binary code here is: [snip] Sorry for the last send. > On Oct 5, 2010 6:18pm, "Jonas H." jo...@lophus.org> wrote

meta-class review

2010-10-05 Thread Ethan Furman
On one the many mini-reports we use, we have a bunch of counts that are frequently zero; because the other counts can also be low, it becomes easy to miss the non-zero counts. For example: Code Description Conv Errors : 6 31,N DPV Failure : 4 10:

Re: Re: Re: How to save a binary file?

2010-10-05 Thread hidura
I did but the mistake is: Error interpreting JPEG image file (Not a JPEG file: starts with 0x5c 0x6e) I think the problem is maybe in the binary code here is: \xff\\xd8\\xff\\xe0\\x00\\x10JFIF\\x00\\x01\\x01\\x01\\x00H\\x00H\\x00\\x00\\xff\\xdb\\x00C\\x00\\x05\\x03\\x04\\x04\\x04\\x03\\x05\\x04

Re: How to save a binary file?

2010-10-05 Thread Jonas H.
On 10/05/2010 11:11 PM, hid...@gmail.com wrote: Hello, how i can save a binary file, i read in the manual in the IO area but doesn' t show how to save it. Here is the code what i am using: s = open('/home/hidura/test.jpeg', 'wb') s.write(str.encode(formFields[5])) s.close() So where's the probl

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread chaoticcran...@gmail.com
Ah, very good, it's working perfectly now. Thank you so much for your help - regular expressions are very powerful! On Oct 5, 4:26 pm, MRAB wrote: > [snip] > > Additional: I forgot to mention that you should understand the > difference between the .match() and .search() mthods. .match() is > anc

Re: Best Git library for Python?

2010-10-05 Thread Ben Finney
Dun Peal writes: > Of course I can write it myself, but it would save much time and > effort if I could use something that's already written. You don't mention which ones you've already evaluated or are aware of, so I'll point out that Bazaar and Mercurial both use the Dulwich library http://pyp

How to save a binary file?

2010-10-05 Thread hidura
Hello, how i can save a binary file, i read in the manual in the IO area but doesn' t show how to save it. Here is the code what i am using: s = open('/home/hidura/test.jpeg', 'wb') s.write(str.encode(formFields[5])) s.close() If needs the binary code i could upload. -- http://mail.python.org/

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread Arnaud Delobelle
"chaoticcran...@gmail.com" writes: > So, I have a rather tricky string comparison problem: I want to search > for a set pattern in a variable source. > > To give you the context, I am searching for set primer sequences > within a variable gene sequence. In addition to the non-degenerate A/G/ > C/

Re: Help with sets

2010-10-05 Thread Terry Reedy
On 10/5/2010 3:39 AM, Steven D'Aprano wrote: Sets aren't an alternative to dictionaries. They have a completely different purpose. A dict/mapping is a specialized set -- a set of ordered pairs in which each first member (the 'key') only appears once as a first member. The set union of two ma

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-05 Thread Chris Rebert
On Tue, Oct 5, 2010 at 1:31 PM, Wolfgang Rohdewald wrote: > On Dienstag 05 Oktober 2010, MRAB wrote: >> > About notation, even if loved right-hand-half-open >> > intervals, I would wonder about [a,b] noting it. I guess >> > 99.9% of programmers and novices (even purely amateur) have >> > learnt ab

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-05 Thread Nobody
On Tue, 05 Oct 2010 13:57:11 +1100, Ben Finney wrote: > Here's your problem. Don't ever use a bare ‘except’ unless you know > exactly why you're doing so. Rather, figure out what exception types you > want to catch, and catch *only* those types. If I use a bare except, I usually have a good reaso

Re: Help with sets

2010-10-05 Thread Terry Reedy
On 10/5/2010 3:01 AM, Ian Kelly wrote: self._pos = {predicate: {object: {subject: None}}} That's a bit ugly because the None serves no purpose here; the value associated with the subject has no meaning in this context. This is what we did in Python before sets were added. > It also useless

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Terry Reedy
On 10/5/2010 5:13 AM, TheOne wrote: It's a MS-specific thing that makes a file identifieable as UTF-8-encoded under windows. The name BOM is obviously BS, but it's the way it is. I didn't know that it's a MS-thing. (Is it really?) Yes, who else would 'customize' an international standard by

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-05 Thread Wolfgang Rohdewald
On Dienstag 05 Oktober 2010, MRAB wrote: > > About notation, even if loved right-hand-half-open > > intervals, I would wonder about [a,b] noting it. I guess > > 99.9% of programmers and novices (even purely amateur) have > > learnt about intervals at school in math courses. Both > > notations I kno

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread MRAB
[snip] Additional: I forgot to mention that you should understand the difference between the .match() and .search() mthods. .match() is anchored to the starting position, so you'll want to use .search() instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread MRAB
On 05/10/2010 21:06, chaoticcran...@gmail.com wrote: On Oct 5, 3:38 pm, MRAB wrote: On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching

Re: PyQt imageViewer does not working properly...

2010-10-05 Thread Hans-Peter Jansen
On Tuesday 05 October 2010, 00:29:04 Polimeno wrote: > Hello guys, > > I have been looking throughout the web for some PyQt Image Viewer : > > http://nullege.com/codes/show/src%40pyformex-0.8.2%40pyformex%40gui%40ima >geViewer.py/78/PyQt4.QtGui.QImage# > > > Unfortunately, everytime I input any kin

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread Tim Chase
On 10/05/10 15:06, chaoticcran...@gmail.com wrote: On Oct 5, 3:38 pm, MRAB wrote: On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching fo

Double Clicking on .pyw File Doesn't Work in Windows 7

2010-10-05 Thread Saul Spatz
When I double-click on a file with a .pyw extension, nothing appears to happen. Control panel shows that pythonw is associated with this extension, and if I right-click on the filename, the program suggested to open it is pythonw.exe. If I make a desktop shortcut with the target pythonw.exe myScr

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread chaoticcran...@gmail.com
On Oct 5, 3:38 pm, MRAB wrote: > On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: > > > > > So, I have a rather tricky string comparison problem: I want to search > > for a set pattern in a variable source. > > > To give you the context, I am searching for set primer sequences > > within a var

Re: Fastest technique for string concatenation

2010-10-05 Thread Will Hall
On Oct 5, 2:39 pm, Will Hall wrote: > On Oct 3, 8:19 am, Roy Smith wrote: > > > > > My local news feed seems to have lost the early part of this thread, so > > I'm afraid I don't know who I'm quoting here: > > > > My understanding is that appending to a list and then joining > > > this list when

Re: Please help: pylint does not work with Emacs23 on Windows

2010-10-05 Thread Dsrt Egle
On Oct 4, 3:53 am, Alexandre Fayolle wrote: > Alexandre Fayolle wrote: > >DsrtEglewrote: > > >> Hi, > > >> I am trying to use Pylint with Emacs on Windows XP. My Emacs version > >> is EmacsW32 23.1, pylint is 0.21.3 with Python 2.5. After easy_install > >> pylint, I added the code block below to E

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-05 Thread MRAB
On 05/10/2010 20:23, spir wrote: On Tue, 05 Oct 2010 13:45:56 +0200 Boris Borcic wrote: Nick Coghlan wrote: [...] Being able to say things like "10:00"<= x< '12:00", 10.0<= x< 12.0, "a"<= x< "n" are much clearer than trying to specify their closed range equivalents. makes one wonder a

Re: Fastest technique for string concatenation

2010-10-05 Thread Will Hall
On Oct 3, 8:19 am, Roy Smith wrote: > My local news feed seems to have lost the early part of this thread, so > I'm afraid I don't know who I'm quoting here: > > > My understanding is that appending to a list and then joining > > this list when done is the fastest technique for string > > concaten

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread MRAB
On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching for set primer sequences within a variable gene sequence. In addition to the non-degenerate

Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread chaoticcran...@gmail.com
So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching for set primer sequences within a variable gene sequence. In addition to the non-degenerate A/G/ C/T, the gene sequence could have degenerate bases

Re: How to convert a string into a list

2010-10-05 Thread Matteo Landi
What about using the json library? It could handle errors for you: >>>import json >>>s = '["1", "2"]' >>>json.loads(s) [u'1', u'2'] Now you can convert then to integer values. Best regards, Matteo On Tue, Oct 5, 2010 at 3:41 PM, Mark Phillips wrote: > Thanks to everyone for their suggestions.

Re: Module loading trickery

2010-10-05 Thread Jonas Galvez
Thanks a million, runpy is exactly what I was looking for! I will send you a link to what I'm using it for when it's done. Then you'll understand ;) -- Jonas On Tue, Oct 5, 2010 at 1:06 PM, Thomas Jollans wrote: > On Tuesday 05 October 2010, it occurred to Jonas Galvez to exclaim: > > Is there

Re: Help with sets

2010-10-05 Thread nn
> Semantic web.  I did get a bit confused in reading about the concept of > sets in python and why you would use them instead of a dictionary for Sets are faster and more convenient to do intersections, unions, differences. They also use less space than dictionaries. Finally they also help conveyi

Re: Module loading trickery

2010-10-05 Thread Thomas Jollans
On Tuesday 05 October 2010, it occurred to Jonas Galvez to exclaim: > Is there a way to "inject" something into a module right before it's > loaded? > > For instance, a.py defines "foo". b.py print()s "foo". > > I want to load b.py into a.py, but I need to let b.py know about "foo" > before it ca

Re: subclass constructor problem

2010-10-05 Thread Diez B. Roggisch
Nikola Skoric writes: > I have a superclass Element and a subclass Family. All Family.__init__() does > is run Element.__init__() and self.__parse(). For some reason it seems like > self.__parse() isn't run. Here is the code: > http://github.com/dijxtra/simplepyged/blob/8d5a6d59268f6760352783cc

Re: Module loading trickery

2010-10-05 Thread Jean-Michel Pichavant
Jonas Galvez wrote: Is there a way to "inject" something into a module right before it's loaded? For instance, a.py defines "foo". b.py print()s "foo". I want to load b.py into a.py, but I need to let b.py know about "foo" before it can execute. Is this any way to achieve this? -- Jonas

Module loading trickery

2010-10-05 Thread Jonas Galvez
Is there a way to "inject" something into a module right before it's loaded? For instance, a.py defines "foo". b.py print()s "foo". I want to load b.py into a.py, but I need to let b.py know about "foo" before it can execute. Is this any way to achieve this? -- Jonas -- http://mail.python.org/

Re: Best Git library for Python?

2010-10-05 Thread Dun Peal
On Oct 4, 7:23 pm, Lawrence D'Oliveiro wrote: > You can already check the exit status from the subprocess. What more do you > need? A robust mechanism to deal with said issues... Of course I can write it myself, but it would save much time and effort if I could use something that's already writt

Re: Global hoykey on windows

2010-10-05 Thread Alex Hall
On 10/5/10, Sebastian Alonso wrote: > Hey everyone, I've been working on an app that uses global hotkey and > it's a very important part of the app, so far I have been using > python-keybinder [0] and it's been working great on linux, but now I want to > make it work under windows and there wa

Re: direct print to log file

2010-10-05 Thread Benjamin Kaplan
On Tue, Oct 5, 2010 at 10:41 AM, Dave Angel wrote: > On 2:59 PM, Dirk Nachbar wrote: > >> How can I direct all print to a log file, eg some functions have their >> own print and I cannot put a f.write() in front of it. >> >> Dirk >> >> > When code does a print() without specifying a file, it goe

Re: direct print to log file

2010-10-05 Thread Dave Angel
On 2:59 PM, Dirk Nachbar wrote: How can I direct all print to a log file, eg some functions have their own print and I cannot put a f.write() in front of it. Dirk When code does a print() without specifying a file, it goes to sys.stdout So you just have to create a new file object and b

Re: [C-API] Weird sys.exc_info reference segfault

2010-10-05 Thread Jonas H.
On 10/04/2010 11:41 PM, Antoine Pitrou wrote: Well, it should work, but you have to call PyType_Ready() to fill in the NULL fields with default values (for those where it's necessary). Does it solve it for you? Yes, thank you! Although I do not understand which fields I have to provide. I want

Re: direct print to log file

2010-10-05 Thread Diez B. Roggisch
Dirk Nachbar writes: > How can I direct all print to a log file, eg some functions have their > own print and I cannot put a f.write() in front of it. you can replace sys.stdout with something that performs logging. class MyWriter(object): def __init__(self, old_stream): self.o

Global hoykey on windows

2010-10-05 Thread Sebastian Alonso
Hey everyone, I've been working on an app that uses global hotkey and it's a very important part of the app, so far I have been using python-keybinder [0] and it's been working great on linux, but now I want to make it work under windows and there was no way to make it work. Any other library I

Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

2010-10-05 Thread Pascal Polleunus
On 05/10/10 10:18, Alex Willmer wrote: On Oct 5, 7:41 am, Pascal Polleunus wrote: On 05/10/10 00:11, Diez B. Roggisch wrote: Install the python-dev-package. It contains the Python.h file, which the above error message pretty clearly says. Usually, it's a good idea to search package description

direct print to log file

2010-10-05 Thread Dirk Nachbar
How can I direct all print to a log file, eg some functions have their own print and I cannot put a f.write() in front of it. Dirk -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a string into a list

2010-10-05 Thread Mark Phillips
Thanks to everyone for their suggestions. I learned a lot from them! Mark On Mon, Oct 4, 2010 at 11:54 PM, Chris Rebert wrote: > On Mon, Oct 4, 2010 at 10:33 PM, Arnaud Delobelle > wrote: > > MRAB writes: > >> On 05/10/2010 02:10, Mark Phillips wrote: > >>> I have the following string - "['1'

Pydev 1.6.3 Released

2010-10-05 Thread Fabio Zadrozny
Hi All, Pydev 1.6.3 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * Improved editor preferences page when using Aptana themes * Icons updated to work better with dark backgrounds *

Re: force coredump from child created by subprocess

2010-10-05 Thread David Sveningsson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/05/2010 02:37 PM, Christian Heimes wrote: > Am 05.10.2010 14:15, schrieb David Sveningsson: >> Hi, I am running a process using subprocess and detect if the process >> crashes using .returncode. I would like to force coredumps being created >> re

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Diez B. Roggisch
Lawrence D'Oliveiro writes: > In message > <2752e2e4-76fe-475a-a476-e5458bbfd...@z30g2000prg.googlegroups.com>, TheOne > wrote: > >> Anyway, it would be great if I could make my eclipse/pydev to >> understand the BOM character and suppress the lexical error msg. > > What exactly is the point of

Re: force coredump from child created by subprocess

2010-10-05 Thread Christian Heimes
Am 05.10.2010 14:15, schrieb David Sveningsson: > Hi, I am running a process using subprocess and detect if the process > crashes using .returncode. I would like to force coredumps being created > regardless of the system settings, eg run "ulimit -c unlimited" in the > childprocess. > > I've had n

force coredump from child created by subprocess

2010-10-05 Thread David Sveningsson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I am running a process using subprocess and detect if the process crashes using .returncode. I would like to force coredumps being created regardless of the system settings, eg run "ulimit -c unlimited" in the childprocess. I've had no luck using

add bitbucket repo url to install_requires

2010-10-05 Thread Julian
Hi, I'm developing a django app which depends on an app in a private bitbucket repository, for example ssh://h...@bitbucket.org/username/my-django-app. is it possible to add this url to the list of install_requires in my setup.py? tried various possibilities, but none worked. -- http://mail.pyth

subclass constructor problem

2010-10-05 Thread Nikola Skoric
I have a superclass Element and a subclass Family. All Family.__init__() does is run Element.__init__() and self.__parse(). For some reason it seems like self.__parse() isn't run. Here is the code: http://github.com/dijxtra/simplepyged/blob/8d5a6d59268f6760352783cce6b97c0b5e75b8be/simplepyged/sim

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Lawrence D'Oliveiro
In message <2752e2e4-76fe-475a-a476-e5458bbfd...@z30g2000prg.googlegroups.com>, TheOne wrote: > Anyway, it would be great if I could make my eclipse/pydev to > understand the BOM character and suppress the lexical error msg. What exactly is the point of a BOM in a UTF-8-encoded file? -- http://

Re: "Strong typing vs. strong testing"

2010-10-05 Thread Pascal Costanza
On 05/10/2010 05:36, salil wrote: On Sep 30, 1:38 pm, Lie Ryan wrote: The /most/ correct version of maximum() function is probably one written in Haskell as: maximum :: Integer -> Integer -> Integer maximum a b = if a> b then a else b Integer in Haskell has infinite precision (like python'

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread TheOne
On Oct 5, 5:10 pm, de...@web.de (Diez B. Roggisch) wrote: > Lawrence D'Oliveiro writes: > > In message > > , TheOne > > wrote: > > >> I want the source files to have BOM character. > > > What exactly is the point of a BOM in a UTF-8-encoded file? > > It's a MS-specific thing that makes a file iden

Re: That interesting notation used to describe how long a loop will take.

2010-10-05 Thread Niklasro
On 4 Okt, 20:38, Tobiah wrote: > It gets used here frequently, but not > having majored in programming, I'm not > familiar with it.  One might say: > > Don't do it that way, it will result in O(n**2)! > > Or something like that.  I read this to mean > that the execution time varies with the square

Re: if the else short form

2010-10-05 Thread Antoon Pardon
On Tue, Oct 05, 2010 at 06:55:33PM +1300, Lawrence D'Oliveiro wrote: > In message , Antoon > Pardon wrote: > > > On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksic wrote: > > > >> BTW adding "==True" to a boolean value is redundant and can even break > >> for logically true values that don't

unable to mkvirtualenv

2010-10-05 Thread Julian
Hi, when creating a virtualenv with mkvirtualenv, I receive an error: http://pastebin.com/1N8yRZUv I've updated the relating packages (virtualenv, virtualenvwrapper, distutils, distribute, pip) and couldn't solve my problem via google. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

2010-10-05 Thread Alex Willmer
On Oct 5, 7:41 am, Pascal Polleunus wrote: > On 05/10/10 00:11, Diez B. Roggisch wrote: > > Install the python-dev-package. It contains the Python.h file, which the > > above error message pretty clearly says. Usually, it's a good idea to > > search package descriptions of debian/ubuntu packages f

Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

2010-10-05 Thread Diez B. Roggisch
Pascal Polleunus writes: > On 05/10/10 00:11, Diez B. Roggisch wrote: >> Pascal Polleunus writes: >> >>> Hi, >>> >>> I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04. >>> >>> >>> My problem is also explained on stackoverflow: >>> http://stackoverflow.com/questions/3847536/instal

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Diez B. Roggisch
TheOne writes: > On Oct 4, 9:26 pm, de...@web.de (Diez B. Roggisch) wrote: >> TheOne writes: >> > Hi. >> >> > I installed eclipse/pydev today. >> > I created a pydev project and added python source files with utf-8 >> > BOM. >> > Eclipse/Pydev reports lexical error : >> >   Lexical error at line

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Diez B. Roggisch
Lawrence D'Oliveiro writes: > In message > , TheOne > wrote: > >> I want the source files to have BOM character. > > What exactly is the point of a BOM in a UTF-8-encoded file? It's a MS-specific thing that makes a file identifieable as UTF-8-encoded under windows. The name BOM is obviously BS,

Re: Help with sets

2010-10-05 Thread Paul Rudin
"B. M. Whealton" writes: > I did get a bit confused in reading about the concept of sets in > python and why you would use them instead of a dictionary for example. Use a set when something is naturally modelled as a set... it's a collection of unordered objects that you can test for membership,

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-05 Thread Steven D'Aprano
On Tue, 05 Oct 2010 11:13:53 +0800, Von wrote: > Try to use sys.exit(0) > Maybe you should print out the error in your except block. Not exiting with a status-code of 0 is no more helpful than not exiting with a status-code of 1. It's actually *less* helpful, if the intention is actually to exi

Re: Help with sets

2010-10-05 Thread Steven D'Aprano
On Mon, 04 Oct 2010 22:31:50 -0400, B. M. Whealton wrote: > I did get a bit confused in reading about the concept of > sets in python and why you would use them instead of a dictionary for > example. Why would you use a spoon instead of a paper clip? Why would you use a hat-stand instead of a pe

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-05 Thread Lawrence D'Oliveiro
In message , Seebs wrote: > On 2010-10-05, Lawrence D'Oliveiro > wrote: > >> In message <87iq1hz6rc@benfinney.id.au>, Ben Finney wrote: >> >>> Don't ever use a bare ‘except’ unless you know exactly why you're doing >>> so. >> >> In other news, don’t ever put a loaded gun in your mouth and pul

Re: Help with sets

2010-10-05 Thread Chris Rebert
On Tue, Oct 5, 2010 at 12:01 AM, Ian Kelly wrote: > On Mon, Oct 4, 2010 at 8:31 PM, B. M. Whealton > wrote: >> >> self._pos = {predicate:{object:set([subject])}} >> >>       We have the first dictionary keyed off the first term, the second >> dictionary keyed off the second term, and the set cont

Re: Help with sets

2010-10-05 Thread Ian Kelly
On Mon, Oct 4, 2010 at 8:31 PM, B. M. Whealton < bwheal...@futurewavedesigns.com> wrote: > self._pos = {predicate:{object:set([subject])}} > > We have the first dictionary keyed off the first term, the second > dictionary keyed off the second term, and the set containing the third > terms(no