Re: basic questions on cmp, < and sort

2006-10-25 Thread Hendrik van Rooyen
"Ben Finney" <[EMAIL PROTECTED]> wrote: To: Sent: Thursday, October 26, 2006 4:44 AM Subject: Re: basic questions on cmp, < and sort Schüle Daniel <[EMAIL PROTECTED]> writes: 8<--- > third question > > sort([[1,2,3],["ABC"],['Z','A'], X(), 4) >>> sor

Re: question about True values

2006-10-25 Thread Hendrik van Rooyen
"Robert Kern" <[EMAIL PROTECTED]> wrote: 8<-- > It's a bit of an abuse on the English language, but what isn't in software? jumps used not to be - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: basic questions on cmp, < and sort

2006-10-25 Thread Fredrik Lundh
Schüle Daniel wrote: > first question > > In [117]: cmp("ABC",['A','B','C']) > Out[117]: 1 > > against what part of the list is the string "ABC" compared? http://docs.python.org/lib/comparisons.html "Objects of different types, except different numeric types and different string

Re: Sorting by item_in_another_list

2006-10-25 Thread Cameron Walsh
Paul McGuire wrote: > "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> ZeD wrote: >>> Paul Rubin wrote: >>> > A = [0,1,2,3,4,5,6,7,8,9,10] > B = [2,3,7,8] > > desired_result = [2,3,7,8,0,1,4,5,6,9,10] How about: desired_result = B

Re: How the event list be sent to EventManager?

2006-10-25 Thread Fredrik Lundh
steve wrote: > The example code from: http://sjbrown.ezide.com/games/example1.py.html > ... > def Notify( self, event ): > if not isinstance(event, TickEvent): Debug( " > Message: " + event.name ) > for listener in self.listeners.keys(): > #I

Re: The format of filename

2006-10-25 Thread Tim Roberts
Neil Cerutti <[EMAIL PROTECTED]> wrote: > >Some experimentation shows that Python does seem to provide >*some* translation. Windows lets me use '/' as a path separator, >but not as the name of the root of a partition name. But perhaps >this a peculiarity of the commands themselves, and not of Windo

Re: To remove some lines from a file

2006-10-25 Thread Sebastian Busch
Steve Holden wrote: > Sebastian Busch wrote: >> [EMAIL PROTECTED] wrote: >>> ... I would like to remove two lines from a file. ... >> ... grep -v ... > ... show ... grep -v "`grep -v "commentsymbol" yourfile | head -2`" yourfile i frankly admit that there is also 'head' invoved ;) i really have

How the event list be sent to EventManager?

2006-10-25 Thread steve
The example code from: http://sjbrown.ezide.com/games/example1.py.html ... def Notify( self, event ): if not isinstance(event, TickEvent): Debug( " Message: " + event.name ) for listener in self.listeners.keys(): #If the weakref has died, remo

Re: How to get each pixel value from a picture file!

2006-10-25 Thread Tim Roberts
"Lucas" <[EMAIL PROTECTED]> wrote: > >2) I want to put a number into the picture for encryption(replace least >significant bit (LSB) of image intensity with message bit). What formats are your images? Remember that JPEG images are compressed when they are written. It is rather unlikely that your

Re: basic questions on cmp, < and sort

2006-10-25 Thread Martin v. Löwis
Schüle Daniel schrieb: > first question > > In [117]: cmp("ABC",['A','B','C']) > Out[117]: 1 > > against what part of the list is the string "ABC" compared? The names of the types are compared: py> cmp("string", "list") 1 > second question > > In [119]: class X(object): >.: pass >

Re: Embedded python loading .so files?

2006-10-25 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > However, I would like to be able to import this package dynamically > within the application running on the host machine. When I attempted > to import the package within the already loaded python modules, I would > get errors that the C portions of the package could no

RE:What's the best IDE?

2006-10-25 Thread Éric Daigneault
/What's your favorite IDE?/ Eclipse with pydev and extentions, and subclipse for subversion / What do you like about it? /When I started Python I tried a whole bunch of IDEs, Komodo, Idle, active state but got tired by having to learn to navigate through a new environment, so I settled for PyDev

Re: What's the best IDE?

2006-10-25 Thread Kenneth McDonald
With the most recent edition of PyDev, I find Eclipse works quite well for me. Ken [EMAIL PROTECTED] wrote: > Recently I've had some problems with PythonWin when I switched to > Py2.5, tooka long hiatus, and came back. So now I'm without my god sent > helper, and I'm looking for a cool replaceme

Re: How to identify generator/iterator objects?

2006-10-25 Thread Kenneth McDonald
Thanks for all the feedback. Yes the original post was incorrect, it was an intellectual burp that had me asking about a instead of f(something). Boy, that answer's something I would never have known... Thanks, Ken Leo Kislov wrote: > Michael Spencer wrote: > >> Kenneth McDonald wrote: >>

Re: using mmap on large (> 2 Gig) files

2006-10-25 Thread Paul Rubin
"sturlamolden" <[EMAIL PROTECTED]> writes: > However, "memory mapping" a file by means of fseek() is probably more > efficient than using UNIX' mmap() or Windows' > CreateFileMapping()/MapViewOfFile(). Why on would you think that?! It is counterintuitive. fseek beyond whatever is buffered in std

Re: using mmap on large (> 2 Gig) files

2006-10-25 Thread Tim Roberts
"sturlamolden" <[EMAIL PROTECTED]> wrote: > >However, "memory mapping" a file by means of fseek() is probably more >efficient than using UNIX' mmap() or Windows' >CreateFileMapping()/MapViewOfFile(). My goodness, do I disagree with that! At least on Windows, I/O on a file mapped with MapViewOfFil

Embedded python loading .so files?

2006-10-25 Thread jefishman
I have a Python (2.3.x) interpreter running embedded in a C++ application on a host machine. I would like to run a specific package on that host machine (numpy). I have managed to compile (cross-compile) the library, so that I have the python modules and the compiled .so files. I am relatively

Re: question about True values

2006-10-25 Thread Carl Banks
John Coleman wrote: > Paul Rubin wrote: > > "John Coleman" <[EMAIL PROTECTED]> writes: > > > > then "x == 3" is false, but "int(x) == 3" is true. > > > But then why is 3.0 == 3 true? They are different types. > > > > The 3 gets converted to float, like when you say > > > > x = 3.1 + 3 > > > > th

Re: What's the best IDE?

2006-10-25 Thread BartlebyScrivener
>> Vim >> you'll be frustrated for about a week, You'll be frustrated for at least two weeks. But you'll use it forever for everything from writing to programming, so who cares? Auto completion is called omni completion in VIM type ':h new-omni-completion' at the command line after two weeks of

Re: Computer locks up when running valid stand alone Tkinter file.

2006-10-25 Thread faulkner
> But, when I call it from another module it locks methinks this "other module" has the answer. jim-on-linux wrote: > py help, > > The file below will run as a stand alone file. > It works fine as it is. > > But, when I call it from another module it locks > my computer, The off switch is the only

Re: question about True values

2006-10-25 Thread Ben Finney
Paul Rubin <"http://phr.cx"@NOSPAM.invalid> writes: > Max Erickson <[EMAIL PROTECTED]> writes: > > > [Steve:] There's still a very obvious omission ... > > > > bool. > > > > unicode and long if you are fussy. > > There's another. Imagine a datatype for Discordian religious > leaders and conside

Re: question about True values

2006-10-25 Thread Paul Rubin
Max Erickson <[EMAIL PROTECTED]> writes: > > [Steve:] There's still a very obvious omission ... > > bool. > > unicode and long if you are fussy. There's another. Imagine a datatype for Discordian religious leaders and consider what a genderless one would be called. -- http://mail.python.org/ma

Re: basic questions on cmp, < and sort

2006-10-25 Thread Ben Finney
Schüle Daniel <[EMAIL PROTECTED]> writes: > Hello, > > first question > > In [117]: cmp("ABC",['A','B','C']) > Out[117]: 1 > > against what part of the list is the string "ABC" compared? Why "part"? There are two objects; they are compared to each other. How this comparison is implemented is a m

Re: What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
Before that, I mentioned I was trying to make a text adventure, from scratch to add more clarity. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best IDE?

2006-10-25 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > this has revieled I no nothing about parsing or classes. Both are > required to make an IDE I believe. Are you trying to make an IDE, or choose an existing one? -- \ "This sentence contradicts itself -- no actually it doesn't." | `\

Re: question about True values

2006-10-25 Thread Max Erickson
Steve Holden <[EMAIL PROTECTED]> wrote: > Gabriel Genellina wrote: >> At Wednesday 25/10/2006 22:29, Terry Reedy wrote: >> >>> >> the string class's "nil" value. Each of the builtin types >>> >> has such an "empty" or "nil" value: >>> >> >>> >> string "" >>> >> list

Re: question about True values

2006-10-25 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Gabriel Genellina wrote: > > Just for fun: > > buffer('') > > frozenset() > > iter(()) > > xrange(0) I get that iter(()) is True (Python 2.3.4). > [Steve:] There's still a very obvious omission ... Hehehe... -- http://mail.python.org/mailman/listinfo/p

Re: question about True values

2006-10-25 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > Each of the builtin types has such an "empty" or "nil" value: > > > > string "" > > list[] > > tuple () > > dict{} > > int 0 > >

Re: question about True values

2006-10-25 Thread Steve Holden
Gabriel Genellina wrote: > At Wednesday 25/10/2006 22:29, Terry Reedy wrote: > >> >> the string class's "nil" value. Each of the builtin types has such an >> >> "empty" or "nil" value: >> >> >> >> string "" >> >> list[] >> >> tuple () >> >>

basic questions on cmp, < and sort

2006-10-25 Thread Schüle Daniel
Hello, first question In [117]: cmp("ABC",['A','B','C']) Out[117]: 1 against what part of the list is the string "ABC" compared? second question In [119]: class X(object): .: pass .: In [120]: X() < X() Out[120]: True In [121]: X() < X() Out[121]: False In [122]: X() < X

Re: What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
That's surely an idea, but I'm not to that point yet. Right not I'm struggling to understand a text adventure, and because I wanted to try it my own at it (before using a tutorial), this has revieled I no nothing about parsing or classes. Both are required to make an IDE I believe. As for UliPad .

Re: Dealing with multiple sets

2006-10-25 Thread Brian Beck
John Henry wrote: > What's the cleanest way to say: > > 1) Give me a list of the items that are in all of the sets? (3 in the > above example) > 2) Give me a list of the items that are not in all of the sets? (1,2 in > the above example) > > Thanks, If you have an arbitrary list of sets, reduce

Re: question about True values

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 22:29, Terry Reedy wrote: >> the string class's "nil" value. Each of the builtin types has such an >> "empty" or "nil" value: >> >> string "" >> list[] >> tuple () >> dict{} >> int

Re: What's the best IDE?

2006-10-25 Thread tom arnall
Ben Finney wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >> After researching Komodo, I found it's not free. The only funds I >> have are a college fund, and I can't start diping into that until >> I'm going to college. Any free AND good IDEs? > > Please consider trying Python with

Re: Fatal Python error: deallocating None

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 21:28, George Sakkis wrote: It's the first time in the three years I've been using python that a program crashes without a nice traceback to give me a clue of what might be wrong. After searching a little, it seems it's one of those hard to get down to cases, so I've no i

Re: question about True values

2006-10-25 Thread Terry Reedy
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> the string class's "nil" value. Each of the builtin types has such an >> "empty" or "nil" value: >> >> string "" >> list[] >> tuple () >> dict

Re: Fatal Python error: deallocating None

2006-10-25 Thread Chetan
"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> writes: > George Sakkis wrote: > > > What makes the problem worse is that it's not deterministic; I can > > restart it from (a little before) the point of crash and it doesn't > > happen again at the same point, but it might happen further down. Now, >

Re: cleaner way to write this?

2006-10-25 Thread Paul Rubin
Roy Smith <[EMAIL PROTECTED]> writes: > Isn't this the kind of thing that the new-fangled "with" statement is > supposed to solve? 1) that would require rewriting the wx.TextEntryDialog to have an exit method. 2) It's not necessarily always the case that you want to destroy the dialog when the f

Re: What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
> What's your favorite IDE? Vim > What do you like about it? If you are a very good typist you can rock with Vim. Vi and variants are on _every_ Unix system. It's highly configurable, syntax highlighting, supports scripting with Python. > It would be fine for a begginer, right? Not really, you'

Re: What's the best IDE?

2006-10-25 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > After researching Komodo, I found it's not free. The only funds I > have are a college fund, and I can't start diping into that until > I'm going to college. Any free AND good IDEs? Please consider trying Python with a powerful editor, instead of

Re: question about True values

2006-10-25 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > s is not equal to the boolean object True, but it also doesn't > > evaluate to the string class's "nil" value. Each of the builtin > > types has such an "empty" or "nil" value: > > > > string "" > > list

Re: What's the best IDE?

2006-10-25 Thread Duncan Smith
[EMAIL PROTECTED] wrote: > After researching Komodo, I found it's not free. The only funds I have > are a college fund, and I can't start diping into that until I'm going > to college. Any free AND good IDEs? > http://wiki.python.org/moin/IntegratedDevelopmentEnvironments Duncan -- http://mail.

Re: What's the best IDE?

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 21:20, [EMAIL PROTECTED] wrote: After researching Komodo, I found it's not free. The only funds I have are a college fund, and I can't start diping into that until I'm going to college. Any free AND good IDEs? There is a list at http://wiki.python.org/moin/PythonEditors

RE: Fatal Python error: deallocating None

2006-10-25 Thread Delaney, Timothy (Tim)
George Sakkis wrote: > What makes the problem worse is that it's not deterministic; I can > restart it from (a little before) the point of crash and it doesn't > happen again at the same point, but it might happen further down. Now, > I wouldn't mind restarting it manually every time since the cra

Re: What's the best IDE?

2006-10-25 Thread limodou
On 25 Oct 2006 17:20:32 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > After researching Komodo, I found it's not free. The only funds I have > are a college fund, and I can't start diping into that until I'm going > to college. Any free AND good IDEs? > I think most of wxPython IDE are good

Re: Dealing with multiple sets

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 21:12, John Henry wrote: Oops. Forgot to mention, I am still using 2.3. try: set except NameError: from sets import Set as set and the code will work almost exactly the same in 2.3/2.4 > 1) Give me a list of the items that are in all of the sets? (3 in the > above e

Fatal Python error: deallocating None

2006-10-25 Thread George Sakkis
It's the first time in the three years I've been using python that a program crashes without a nice traceback to give me a clue of what might be wrong. After searching a little, it seems it's one of those hard to get down to cases, so I've no idea where to look for. Briefly what I do is, select som

Re: ZODB for inverted index?

2006-10-25 Thread robert
[EMAIL PROTECTED] wrote: > Hello, > > While playing to write an inverted index (see: > http://en.wikipedia.org/wiki/Inverted_index), i run out of memory with > a classic dict, (i have thousand of documents and millions of terms, > stemming or other filtering are not considered, i wanted to underst

Re: What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
After researching Komodo, I found it's not free. The only funds I have are a college fund, and I can't start diping into that until I'm going to college. Any free AND good IDEs? -- http://mail.python.org/mailman/listinfo/python-list

Re: cleaner way to write this?

2006-10-25 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > John Salerno <[EMAIL PROTECTED]> writes: > > > if dlg.ShowModal() == wx.ID_OK: > > db_name = dlg.GetValue() > > dlg.Destroy() > > return db_name > > else: > >

Re: Dealing with multiple sets

2006-10-25 Thread John Henry
Aye! I did a: a and b and c Bonk! Thanks, Tim Peters wrote: > [John Henry] > > If I have a bunch of sets: > > > > a = set((1, 2, 3)) > > b = set((2, 3)) > > c = set((1, 3)) > > > > > > What's the cleanest way to say: > > > > 1) Give me a list of the items that are in all of the sets? (3

Re: Dealing with multiple sets

2006-10-25 Thread Tim Peters
[John Henry] > If I have a bunch of sets: > > a = set((1, 2, 3)) > b = set((2, 3)) > c = set((1, 3)) > > > What's the cleanest way to say: > > 1) Give me a list of the items that are in all of the sets? (3 in the > above example) list(a & b & c) > 2) Give me a list of the items that are not

Re: Dealing with multiple sets

2006-10-25 Thread John Henry
Oops. Forgot to mention, I am still using 2.3. John Henry wrote: > Hi list, > > If I have a bunch of sets: > > a = set((1, 2, 3)) > b = set((2, 3)) > c = set((1, 3)) > > > What's the cleanest way to say: > > 1) Give me a list of the items that are in all of the sets? (3 in the > above examp

Computer locks up when running valid stand alone Tkinter file.

2006-10-25 Thread jim-on-linux
py help, The file below will run as a stand alone file. It works fine as it is. But, when I call it from another module it locks my computer, The off switch is the only salvation. This module when run as a stand alone, it will open a jpeg image and add a vertical and horizontal scrollbar

Dealing with multiple sets

2006-10-25 Thread John Henry
Hi list, If I have a bunch of sets: a = set((1, 2, 3)) b = set((2, 3)) c = set((1, 3)) What's the cleanest way to say: 1) Give me a list of the items that are in all of the sets? (3 in the above example) 2) Give me a list of the items that are not in all of the sets? (1,2 in the above exam

Re: What's the best IDE?

2006-10-25 Thread Neil Cerutti
On 2006-10-26, Neil Cerutti <[EMAIL PROTECTED]> wrote: > It seems like the holy wars are pretty. We disciples of Vim and > Emacs are now content merely being holier than all he others. > > Actually, I'm not sure there's been a good Emacs VS Vim holy war > in years. So... ya know what's I find to be

Re: What's the best IDE?

2006-10-25 Thread Neil Cerutti
On 2006-10-25, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : >> Recently I've had some problems with PythonWin when I switched to >> Py2.5, tooka long hiatus, and came back. So now I'm without my god sent >> helper, and I'm looking for a cool replacement, or some advo

Re: call Mac gcc -framework from CTypes how

2006-10-25 Thread p . lavarre
> > can I somehow call the IONotificationPortCreate in the > > Framework that Apple built instead, > > $ cd /System/Library/Frameworks/ > $ cd IOKit.framework/Versions/Current/ > $ file IOKit Also ctypes.util.find_library('CoreFoundation') -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
PS: Search engine . . . I knew this had probably come up very often, but I get it's pretty silly of me that I didn't utilize this. And while I was posting another mark for Komodo came. Nice, is it. -- http://mail.python.org/mailman/listinfo/python-list

Re: question about True values

2006-10-25 Thread Robert Kern
George Sakkis wrote: > Martin v. Löwis wrote: >> Not-so-obviously, arbitrary user-defined values can also be >> treated as false: If they implement __nonzero__, they are >> false if False is returned from __nonzero__; otherwise, >> if they implement __len__, they are false if 0 is returned >> from

Re: What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
> I don't really have a good answer here, but maybe a data point. I got > tired of waiting for ActiveState to put out a Python 2.5 and installed > the one from python.org instead, which doesn't include PythonWin. I > figured that I should take the opportunity to try out Komodo, which I'd > heard

Re: cleaner way to write this?

2006-10-25 Thread Ben Finney
Farshid Lashkari <[EMAIL PROTECTED]> writes: > Paul Rubin wrote: > > I like > > > > if dlg.ShowModal() == wx.ID_OK: > > db_name = dlg.GetValue() > > else: > > db_name = None > > dlg.Destroy() > > return db_name > > > > better than > > > > db_name = None > >

Re: question about True values

2006-10-25 Thread Grant Edwards
On 2006-10-25, John Coleman <[EMAIL PROTECTED]> wrote: > > Paul Rubin wrote: >> John Salerno <[EMAIL PROTECTED]> writes: >> > I'm a little confused. Why doesn't s evaluate to True in the first >> > part, but it does in the second? Is the first statement something >> > different? >> >> No. True and

Re: What's the best IDE?

2006-10-25 Thread mkPyVS
I perform python development for cross platform firmware integration and analysis on a daily basis and the IDE I use and recommend is Komodo from ActiveState. Our worldwide development group (30) has recently all purchased the professional version as it integrates with several version control syste

Converting Pascal syntax to Python

2006-10-25 Thread robert
I want to convert some algorithms from a Pascal dialect to Python. (Not embedding, but code itself) Its mainly only math and function calls and simple array access but lengthy. Think Pascal is quite simlar/simpler in logic for that kind of stuff (in comparison to C/C++), so maybe quite simple

Re: cleaner way to write this?

2006-10-25 Thread Ben Finney
John Salerno <[EMAIL PROTECTED]> writes: > if dlg.ShowModal() == wx.ID_OK: > db_name = dlg.GetValue() > dlg.Destroy() > return db_name > else: > dlg.Destroy() > return It's for reasons like this that I prefer to ha

Re: What's the best IDE?

2006-10-25 Thread Josh Bloom
I'm not going to call it the 'best' ide as thats just silly. But if your developing on Windows pyscripter http://mmm-experts.com/Products.aspx?ProductId=4 is a great IDE. -JoshOn 10/25/06, Bruno Desthuilliers <[EMAIL PROTECTED] > wrote:[EMAIL PROTECTED] a écrit :> Recently I've had some problems w

Re: What's the best IDE?

2006-10-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Recently I've had some problems with PythonWin when I switched to > Py2.5, tooka long hiatus, and came back. So now I'm without my god sent > helper, and I'm looking for a cool replacement, or some advocation to > reinstall/setup PyWin. But the Python website's list is

Re: What's the best IDE?

2006-10-25 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Recently I've had some problems with PythonWin when I switched to > Py2.5, tooka long hiatus, and came back. So now I'm without my god sent > helper, and I'm looking for a cool replacement, or some advocation to > reinstall/setup PyWin. But the Python website's list is ir

Re: question about True values

2006-10-25 Thread Steve Holden
Paul Rubin wrote: > John Salerno <[EMAIL PROTECTED]> writes: > >>if (10 > 5) >>would be the same as >>if (10 > 5) == True > > > Yes. Though it would be bad style to write it in the latter way, not to mention less efficient. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3

What's the best IDE?

2006-10-25 Thread [EMAIL PROTECTED]
Recently I've had some problems with PythonWin when I switched to Py2.5, tooka long hiatus, and came back. So now I'm without my god sent helper, and I'm looking for a cool replacement, or some advocation to reinstall/setup PyWin. But the Python website's list is irrefutably long. It would take a m

Re: question about True values

2006-10-25 Thread Steve Holden
John Coleman wrote: > Martin v. Löwis wrote: > >>John Coleman schrieb: >> >>>Yes - it just seems that there isn't a principled reason for implicitly >>>converting 3 to 3.0 in 3.0 == 3 but not implicitly converting "cat" to >>>boolean in "cat" == true. >> >>Sure there is: equality should be transit

Re: win32com problem - Problem Solved

2006-10-25 Thread cfriedalek
Problem solved. Turns out it was a problem of mistranslating VBS code to Python. The PYTHON line "print str(tet)" casts tet to a string and prints. This is what I thought the VBS line "Str = Tet.ConvertToString()" was doing. But of course "ConvertToString()" is a method of a Tet instance. So in p

Re: question about True values

2006-10-25 Thread Steve Holden
[EMAIL PROTECTED] wrote: > John> I'm a little confused. Why doesn't s evaluate to True in the first > John> part, but it does in the second? Is the first statement something > John> different? > > >>> s = 'hello' > >>> s == True > False > >>> if s: > ... pri

Re: Using classes in python

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 16:19, trevor lock wrote: I've just started using python and have observed the following : class foo: a=[] def __init__(self, val): self.a.append ( val ) It's a common pitfall. As seen just a few days ago: http://groups.google.com/group/comp.lang.py

Re: cleaner way to write this?

2006-10-25 Thread Steve Holden
John Salerno wrote: > Paul Rubin wrote: > > >>Oh, I see. You really want something like repeat...while, which Python >>doesn't have. Anyway I start to prefer something like (untested): >> >> def create_db_name(self): >> try: >>while True: >> dlg = wx.TextEn

Re: question about True values

2006-10-25 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "John Coleman" <[EMAIL PROTECTED]> wrote: > Very good point, though one could argue perhaps that when one is > comparing an object with a truth value then one is implicitly asking > for the truth value of that object On the contrary -- since there is normally no n

FAQ - How do I declare that a CTypes function returns unsigned char?

2006-10-25 Thread p . lavarre
Now at http://pyfaq.infogami.com/suggest we have: FAQ: How do I declare that a CTypes function returns unsigned char? A: c_uchar = ctypes.c_ubyte This irregularity actually is doc'ed, it's just pointlessly annoying. Hope this helps (and of course I trust you'll dispute if I'm nuts), -- http:/

Re: cleaner way to write this?

2006-10-25 Thread Steve Holden
Paul Rubin wrote: > John Salerno <[EMAIL PROTECTED]> writes: > >> if dlg.ShowModal() == wx.ID_OK: >> db_name = dlg.GetValue() >> dlg.Destroy() >> return db_name >> else: >> dlg.Destroy() >> return > > > I like > > i

FAQ - How do I declare that a CTypes function returns void?

2006-10-25 Thread p . lavarre
Now at http://pyfaq.infogami.com/suggest we have: FAQ: How do I declare that CTypes function returns void? A: c_void = None is not doc'ed, but is suggested by: >>> ctypes.POINTER(None) >>> Remembering c_void = c_int from K&R C often works, but if you say a restype is c_int, then doctest's of th

Re: Getting a lot of SPAM from this list

2006-10-25 Thread Fredrik Lundh
TiNo wrote: > How do you send and receive this email? email? -- http://mail.python.org/mailman/listinfo/python-list

Tortoise, Hare, Hell, None

2006-10-25 Thread Clarence
Five and a half years ago, Tim Peters (glory be to his name) made the following statement: > In that respect, None is unique among non-keyword names, and for that reason > alone it should be a keyword instead of a global. I expect that will happen > someday, too. But it's a race between that and

Re: question about True values

2006-10-25 Thread George Sakkis
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: > > the string class's "nil" value. Each of the builtin types has such an > > "empty" or "nil" value: > > > > string "" > > list[] > > tuple () > > dict{} > > int

Re: 255 argument limit?

2006-10-25 Thread [EMAIL PROTECTED]
> >It appears that there is a 255 argument limit in Python 2.4.3? > maybe the argument limit is for the sake of not making functions too complicated. if your function takes more than 200 arguments it can probably go to thedailywtf.com, better be strict like i am and even avoid making a 100 arg

Re: Getting a lot of SPAM from this list

2006-10-25 Thread TiNo
How do you send and receive this email?24 Oct 2006 22:12:35 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid>: I've given up on email pretty much.  I no longer have a public emailaddress of any type.  I just give out a URL (including on my resume,business cards, etc), which leads to a HTTPS contac

Re: Is there a python development site for putting up python libraries that people might be interest in working on?

2006-10-25 Thread Steven Bethard
Kenneth McDonald wrote: > I would like to avoid putting this up on sourceforge as I think it would > do much better at a site aimed specifically at Python development. I've been using python-hosting.com for the argparse module and found it to be a pretty good solution. They offer free Trac/Subv

Re: How to identify generator/iterator objects?

2006-10-25 Thread Leo Kislov
Michael Spencer wrote: > Kenneth McDonald wrote: > > I'm trying to write a 'flatten' generator which, when give a > > generator/iterator that can yield iterators, generators, and other data > > types, will 'flatten' everything so that it in turns yields stuff by > > simply yielding the instances o

Re: Save/Store whole class (or another object) in a file

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 11:32, [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > thanks for the reply,but unfortunately this does not work with the type > > of classes I am dealing with. When trying to pickle the class I get the > > following error: > > > > File "/usr

Re: question about True values

2006-10-25 Thread John Coleman
Martin v. Löwis wrote: > John Coleman schrieb: > > Yes - it just seems that there isn't a principled reason for implicitly > > converting 3 to 3.0 in 3.0 == 3 but not implicitly converting "cat" to > > boolean in "cat" == true. > > Sure there is: equality should be transitive. So while we have > 3

Re: cleaner way to write this?

2006-10-25 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > But if the user doesn't enter any text, I don't want the method to > > return at all (even None). > > John, please re-read the FineManual(tm). None is the default return > value of a function - even if there's no return statement. Correct, but i

Re: cleaner way to write this?

2006-10-25 Thread Bruno Desthuilliers
John Salerno a écrit : > Paul Rubin wrote: > >> John Salerno <[EMAIL PROTECTED]> writes: >> >>> I just need some advice for how to structure >>> the check of the empty string. >> >> >> How about >> >> return db_name or None >> >> since the empty string taken as a boolean is False. > > > But

Re: How to identify generator/iterator objects?

2006-10-25 Thread Martin v. Löwis
Kenneth McDonald schrieb: > To do this, I need to determine (as fair as I can see), what are > Is there a way to do this? Or perhaps another (better) way to achieve > this flattening effect? itertools doesn't seem to have anything that > will do it. As others have pointed out, there is a proper te

Re: How to identify generator/iterator objects?

2006-10-25 Thread Michael Spencer
Kenneth McDonald wrote: > I'm trying to write a 'flatten' generator which, when give a > generator/iterator that can yield iterators, generators, and other data > types, will 'flatten' everything so that it in turns yields stuff by > simply yielding the instances of other types, and recursively

Re: How to identify generator/iterator objects?

2006-10-25 Thread Leo Kislov
Kenneth McDonald wrote: > I'm trying to write a 'flatten' generator which, when give a > generator/iterator that can yield iterators, generators, and other data > types, will 'flatten' everything so that it in turns yields stuff by > simply yielding the instances of other types, and recursively yi

Re: Using classes in python

2006-10-25 Thread Éric Daigneault
trevor lock wrote: > Hello, > > I've just started using python and have observed the following : > > class foo: > a=[] > def __init__(self, val): > self.a.append ( val ) > def getA(self): > print self.a > return self.a > > z = foo(5) > y = foo(4) > z.

Re: question about True values

2006-10-25 Thread Martin v. Löwis
John Coleman schrieb: > Yes - it just seems that there isn't a principled reason for implicitly > converting 3 to 3.0 in 3.0 == 3 but not implicitly converting "cat" to > boolean in "cat" == true. Sure there is: equality should be transitive. So while we have 3 == 3L == 3.0 == 3.0+0j and can there

Re: Is there a python development site for putting up python libraries that people might be interest in working on?

2006-10-25 Thread Martin v. Löwis
Kenneth McDonald schrieb: > I would like to avoid putting this up on sourceforge as I think it would > do much better at a site aimed specifically at Python development. As somebody else said: you should put the code and announce the package at the Cheeseshop: cheeseshop.python.org. This doesn't

Re: chained attrgetter

2006-10-25 Thread Alexey Borzenkov
On Oct 25, 10:00 pm, "David S." <[EMAIL PROTECTED]> wrote: > Does something like operator.getattr exist to perform a chained attr > lookup? Do you mean something like class cattrgetter: def __init__(self, name): self.names = name.split('.') def __call__(self, obj): for nam

Re: cleaner way to write this?

2006-10-25 Thread John Salerno
Paul Rubin wrote: > John Salerno <[EMAIL PROTECTED]> writes: >> Interesting idea to use try/finally to ensure that dlg.Destroy() runs >> even with a return earlier in the method. > > Note that the code is wrong, the dialog should either be created > outside the while loop, or destroyed inside it.

Re: cleaner way to write this?

2006-10-25 Thread Michael S
How about this? def create_db_name(self): dlg = wx.TextEntryDialog(self.frame, 'Enter a database name:', 'Create New Database') db_name = None #or db_name = "" if dlg.ShowModal() == wx.ID_OK: db_name = dlg.GetValue()

  1   2   3   >