Re: while c = f.read(1)

2005-08-22 Thread Greg McIntyre
Donn Cave wrote: > Actually I'd make it a little less compact -- put the "break" > on its own line -- but in any case this is fine. It's a natural > and ordinary way to express this in Python. > > ... > | But I get a syntax error. > | > | while c = f.read(1): > |^ > | SyntaxError:

Re: while c = f.read(1)

2005-08-22 Thread Greg McIntyre
I've always accepted the None vs. 0 as a cavaet of the added convenience but I think it's ultimately worth it. Sorry, I didn't want to start a "nothing values evaluate to false" argument. I'll go read python-dev archives a bit and see if there's anything useful for me to know. Thanks -- http:/

Re: while c = f.read(1)

2005-08-22 Thread Greg McIntyre
quot;while ", is NOT restricted to being in > (True, False). See section 5.10 of the Python Reference Manual: I'm sorry! I realise that now and I'm sorry to have caused the traffic I did. Thank you for pointing it out to me though - it's pretty fundamental Python! *Greg th

Re: while c = f.read(1)

2005-08-22 Thread Greg McIntyre
That is both clever and useful! I never would have thought of doing that. This seems to me like a general way to "workaround" the Python statement/expression separation woes I've been having, in cases where I really really want it. Now, where can I copy this out to so I will be able to find it wh

Re: while c = f.read(1)

2005-08-22 Thread Greg McIntyre
> On the other hand, if you've already planned another pass over the code, that might be the time to look into this. Exactly. And when I do that pass I will definitely try buffering the data 10 or 100 meg at a time before entring the 1 char-at-a-time loop, or using mmap to similar ends. -- http:

Re: while c = f.read(1)

2005-08-24 Thread Greg McIntyre
John Machin wrote: > Sigh indeed. If you need to read it a character at a time to parse it, > the design is f***ed. There is always the potential to do 2k buffered reads and once in memory pick the contents apart character-wise. I assume something similar would happen for tokenising XML and HTML

Re: while c = f.read(1)

2005-08-24 Thread Greg McIntyre
Robert Kern wrote: > > Robert> Please quote the message you are replying to. We have no > > Robert> idea what "the 2nd option" is. > > > > I think he means the second option you presented > > > > If you must read one character at a time, > > > > def reader(fileobj, blocksize=1): > >

Re: same menu point is activated

2005-08-25 Thread Greg Krohn
OnOpen, id=ID_OPEN) ^^ etc. -greg -- http://mail.python.org/mailman/listinfo/python-list

Unnest tag ?

2005-09-05 Thread Greg. Nans
Hello, i am looking for an idea on how to handle un-nesting tags. i know i can use something build on top of a htmltidy, but i'm rather wondering if this could be done using only python standard library. my input tags can not be crossed (i mean " w1 w2 w3 " is impossible from my input) actuall

launching adobe reader with arguments from os.system call

2005-09-06 Thread Greg Miller
Currently I am launching adobe reader using the following call: os.system("path.file.pdf") this works fine for opening the pdf doc at the beginning. We would like to enhance this and open the document to either a page or a nameddest in the doc. The syntax for that in the DOS command prompt world i

Re: Django Vs Rails

2005-09-07 Thread Greg McIntyre
Diez B. Roggisch wrote: > I tried to find out if subway and > rails can do the same - that is, generate the sql. For subway the lack > of documentation prevented that, and I didn't find it in rails , too. In Rails you can do that with the command: $ rake db_structure_dump However I think it's n

Re: launching adobe reader with arguments from os.system call

2005-09-08 Thread Greg Miller
0_en.pdf"') I'm going to give your method a try to see if it launches any quicker. Thanks again. Greg Miller -- http://mail.python.org/mailman/listinfo/python-list

Re: launching adobe reader with arguments from os.system call

2005-09-08 Thread Greg Miller
Thank you for the information, when I launched the Reader on the actual hardware it launched quickly. I think I just have too much running on my application PC. I will consider starting an AcroReader app however. Greg -- http://mail.python.org/mailman/listinfo/python-list

Appending paths relative to the current file to sys.path

2005-09-11 Thread Greg McIntyre
== '__main__': import astandardmodule astandardmodule.appendRelativeIncludePath('..', '..') import mymodule Which, as you can see, is much shorter. ;) -- Greg McIntyre -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] python optimization

2005-09-15 Thread Greg Ewing
ntly isn't: >>> def f(): ... return 2+3 ... >>> import dis >>> dis.dis(f) 2 0 LOAD_CONST 1 (2) 3 LOAD_CONST 2 (3) 6 BINARY_ADD 7 RETURN_VALUE 8 LOAD_CONST

ANN: Pyrex 0.9.3.1

2005-09-16 Thread Greg Ewing
Giovanni Bajo has put together a Pyrex release incorporating patches to address the Python 2.4 distutils compatibility problem and the GCC 4 lvalue cast problem. http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ Thanks to Giovanni for filling a gap until I can get back to working on Pyrex

Re: newbie wants to compile python list of filenames in selected directories

2005-02-06 Thread Greg Krohn
use os.path.walk, although it's not quite as newb friendly. -greg -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame.mixer.music not playing

2005-02-06 Thread Greg Krohn
ode (except the mp3 filename, of course) on my machine and it worked fine. ActivePython 2.3.4 and Pygame 1.6. Could it be a hardware problem? -greg -- http://mail.python.org/mailman/listinfo/python-list

Python as a machine tool (Re: Is Python as capable as Perl for sysadmin work?)

2005-02-09 Thread Greg Ewing
Jeff Epler wrote: Unlike Perl, Python implements only a *finite turning machine* That's interesting -- I didn't know Python could be used as a lathe. You learn something new every day! I suppose an "infinite turning machine" would be a really *big* lathe... -- Greg Ewing, C

Re: turing machine in an LC

2005-02-09 Thread Greg Ewing
ursive function), both of which require statements. Lambdas can give you one-line functions, local variable binding, if-then-else capabilities, and recursion. Everything else should be possible from there. As a fellow named Church once pointed out, lambdas are really *all* you need in a language..

Re: Big development in the GUI realm

2005-02-09 Thread Greg Ewing
disallowing it. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

:-)

2005-02-10 Thread Greg Ewing
Sion Arrowsmith wrote: Greg Ewing <[EMAIL PROTECTED]> wrote: As a fellow named Church once pointed out, lambdas are really *all* you need in a language... ... where as others argue that it is impractical not to have some form of runtime data storage, thereby giving rise to the separat

Postgres and SSL

2005-02-11 Thread Greg Lindstrom
I'm on a Linux box running python 2.3 and would like to connect to a postgres database via SSL, but have not been able to find a module to do this (or haven't figured out the syntax). Can anyone help me out? Thanks, --greg -- Greg Lindstrom 501 975.4859 Computer

Re: segfault when calling Python from C thread

2005-02-20 Thread Greg Chapman
lback threads execute. (This call is made automatically if you are creating new threads using Python's thread module, but if the new threads are created by some C code, you need to call it yourself.) --- Greg Chapman -- http://mail.python.org/mailman/listinfo/python-list

Re: segfault when calling Python from C thread

2005-02-21 Thread Greg Chapman
Fredrik Lundh wrote: > Greg Chapman wrote: > > > Your callback function needs to hold the Python GIL (and have a > > vaild threadstate) before it calls any Python C-API functions. > > Change the last part of it to: > > > >PyGILState_STATE state; > >

Fonts and PIL

2005-02-23 Thread Greg Lindstrom
PIL application? Thanks again! --greg -- Greg Lindstrom 501 975.4859 Computer Programmer [EMAIL PROTECTED] NovaSys Health Little Rock, Arkansas "We are the music makers, and we are the dreamers of dreams." W.W. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to control a USB DISK?

2005-03-02 Thread Greg Fischer
I actually tried this last summer on linux and I think in order to make it work right I had to use the hotplug features AND udev. I had to use udev because I needed a specific mount path, otherwise it just picked the next in the list if there was more than one drive. I ended up skipping that proj

Recognizing the Arrival of a New File

2005-03-08 Thread Greg Lindstrom
more common/accepted way to perform this task? I'm using Python 2.3 on Linux. Thanks for your help, --greg -- Greg Lindstrom 501 975.4859 Computer Programmer [EMAIL PROTECTED] NovaSys Health Little Rock, Arkansas "We are the music makers, and we are the dreamers

Re: parameter name conflict. How to solve?

2005-03-08 Thread Greg Ewing
any other nonsense parameters. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

An Odd Little Script

2005-03-09 Thread Greg Lindstrom
irection. How can I perform the above task while keeping my sanity? Thanks! --greg -- Greg Lindstrom 501 975.4859 Computer Programmer [EMAIL PROTECTED] NovaSys Health Little Rock, Arkansas "We are the music makers, and we are the dreamers of dreams." W.W. --

Help Installing Python 2.3.5

2005-03-11 Thread Greg Lindstrom
n got the "Python installed correctly" screen). Reboot. When I open a dos window and type "python" I am told it doesn't know that that is! The file association with seems to work. Do I need to map the PATH myself? Everything's in the default directory (C:\Pytho

Re: Creating desktop icons for Innosetup file

2005-03-13 Thread Greg Ewing
don't have the working directory set, launches the app directly, etc. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

ElementTree/DTD question

2005-03-15 Thread Greg Wilson
changed. Anyone know what I'm doing wrong? (Note: minidom loads it just fine...) Thanks, Greg Wilson [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp-likeness

2005-03-16 Thread Greg Ewing
in CPython the way it currently works. Guido seems to be against this sort of thing, though, as he seems to regard it as a useful feature that the for-loop control variable is not local to the loop. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Ze

Re: super with only one argument

2005-03-17 Thread Greg Chapman
er.foo() This allows you to rename A and only have to change one super call to reflect the new name. --- Greg Chapman -- http://mail.python.org/mailman/listinfo/python-list

Re: super with only one argument

2005-03-17 Thread Greg Chapman
Greg Chapman wrote: > Steven Bethard wrote: > > > When would you call super with only one argument? The only examples > > I can find of doing this are in the test suite for super. > > > > I think it's to allow something like this: > > class A(B, C

Re: The use of :

2004-11-28 Thread Greg Ewing
Jeremy Bowers wrote: The only punctuation you *need* is whitespace. See Forth You don't even need that... see FORTRAN. :-) DOI=1TO10-ly, -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.pytho

Re: non blocking read()

2004-12-01 Thread Greg Ewing
no guaranteed relationship between the chunks of data written to one end of a pipe or socket and those returned by reading the other end. So you'd still need to be prepared to buffer and re-chunk the data. You'd end up doing all of what I outlined above, with the extra complication of

Re: non blocking read()

2004-12-01 Thread Greg Ewing
If so, it would seem that reading a non-blocking disk file would *never* return any data... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: non blocking read()

2004-12-02 Thread Greg Ewing
Donn Cave wrote: Yes, this looks right to me, but I think we're talking about os.read(), not fileobject.read(). Indeed, you shouldn't be mixing select() with buffered io, or all kinds of bad things can happen. Everything I said applies to OS-level reads and writes, not stdio-level one

Re: inheritance problem with 2 cooperative methods

2004-12-02 Thread Greg Ewing
st you keep the __init__ and setConfig operations separate, and live with having to call setConfig after creating an object. Factory functions could be provided if you were doing this a lot. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, N

Re: efficient intersection of lists with rounding

2004-12-02 Thread Greg Ewing
) algorithm instead of an O(n**2) one. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Trying to understand a little python

2004-12-06 Thread McCarty, Greg
ster.__init__ to fire, which it didn't.  What does 'klass=Tester' actually do on line 05?   Line 10 - Seems that the syntax 'Tester()' actually causes the __init__ method to fire.  Is this the only case?   Line 12 - At this point, I was thinking of Tester.stuff as a sta

Creating Fixed Length Records

2004-12-08 Thread Greg Lindstrom
then pass it a tuple with the values for that record. Just a thought. So, gurus, what are your suggestions to tame this record? Are there easier ways that I'm just not seeing? Thanks, --greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting Focus in WxTextCtrl

2004-12-08 Thread Greg Krohn
LutherRevisited wrote: I know in .NET text boxes have a focus method which will do this, but I can't find anything similar in the places I've looked so far. wxPython does, in fact have such a method. It's called SetFocus. It's actually a wx.Window method, so all control

Re: uptime for Win XP?

2004-12-11 Thread Greg Krohn
work for me, but if you have win32all installed, you can get it from Python: >>> import win32api >>> print "Uptime:", win32api.GetTickCount(), "Milliseconds" Uptime: 148699875 Milliseconds hth greg -- http://mail.python.org/mailman/listinfo/python-list

Re: PythonWin Not Updating

2004-12-14 Thread Greg Krohn
s.python.org/lib/built-in-funcs.html Otherwise, you'll have to explain a bit more--that's my best guess as to what your issue is. Robert Brewer MIS Amor Ministries [EMAIL PROTECTED] You might also try deleting any *.pyc files, Python will just recompile them next time around. greg -- http

Re: Import mechanism to support multiple Python versions

2005-03-20 Thread Greg Ewing
The directory structure is then yourpackage/ __init__.py python23/ cppmymodule.pyd (2.3 version) python24/ cppmymodule.pyd (2.4 version) but at run time it will appear as though one version or the other of cppmymodule is a direct submodule of yourpackage. -- Greg Ewing, Co

Re: How to create stuffit files on Linux?

2005-03-20 Thread Greg Ewing
Leif K-Brooks wrote: Noah wrote: The problem is that my users want to see .sit files. I know it's sort of silly. Zip files are foreign and frightening to them. Would Stuffit open zip files renamed to .sit? Yes! I just tried it, and it works. -- Greg Ewing, Computer Science Dept, Universi

Re: printing anomaly

2005-03-20 Thread Greg Ewing
str() and repr() on floats: Python 2.3.4 (#1, Jun 30 2004, 16:47:37) [GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> str(3.2) '3.2' >>> repr(3.

Re: exec src in {}, {} strangeness

2005-03-21 Thread Greg Ewing
-- you should be passing the same dictionary for both scopes: g = {} exec stuff_to_define in g, g # definitions are now in g -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-21 Thread Greg Ewing
, defaultfactory()) return defdict That looks really nice! I'd prefer a more elegant name than 'defaultdict', though. How about 'table'? -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg

Re: For loop extended syntax

2005-03-21 Thread Greg Ewing
confusion would result. Can you think of any situation in which surprising behaviour would occur through someone thinking the parallel was closer than it is? -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http

Re: missing? dictionary methods

2005-03-21 Thread Greg Ewing
George Sakkis wrote: As for naming, I would suggest reset() instead of set(), to emphasize that the key must be there. make() is ok; other candidates could be add() or put(). How about 'new' and 'old'? -- Greg Ewing, Computer Science Dept, University of Canterbury,

Re: Python scope is too complicated

2005-03-21 Thread Greg Ewing
a cell in this case, just passing the value of x as an implicit parameter to the generator. How do I disassemble the generator? You'd have to get hold of the code object for it and disassemble that. There should be a reference to it in one of the co_consts slots, I think. -- Greg Ewing, C

Re: Simple account program

2005-03-21 Thread Greg Ewing
cond statement is going to overwrite the first one. If you want to append data to an existing file, you need to open it in 'a' mode. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for a 10-14 years old?

2005-03-29 Thread Greg Ewing
, and give us a computing environment that's truly elegant from the ground up! :-) -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for a 10-14 years old?

2005-03-29 Thread Greg Ewing
If she's interested in creating web sites, maybe you could introduce her to some simple CGI programming? -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: mysteriously nonfunctioning script - very simple

2005-03-30 Thread Greg Ewing
Sean McIlroy wrote: I did try it, and it didn't work either. It appears there must be something wrong with my computer, hopefully something benign. Just a thought: Is your computer's clock set correctly? -- Greg Ewing, Computer Science Dept, University of Canterbury, Christc

Re: ossaudiodev full duplex

2005-03-30 Thread Greg Ewing
a single file object for independent reading and writing at the same time. C stdio implementations tend to get confused if you try to do that. You may have other problems as well, but you'll at least need to open two separate file objects. -- Greg Ewing, Computer Science Dept, University of C

Re: Turn of globals in a function?

2005-03-30 Thread Greg Ewing
globals at all, including other functions and classes defined in the same module -- which you may find rather inconvenient! -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listi

Re: Python List Issue

2005-03-30 Thread Greg Ewing
n be used as a truth value. Non-empty lists count as true; empty lists and None count as false. * The 'and' and 'or' operators short-circuit: if the first operand determines the result, the second operand is not evaluated. * Negative list indices are counted from the e

Re: Pre-PEP: Dictionary accumulator methods

2005-03-31 Thread Greg Ewing
Steven Bethard wrote: py> def defaultdict(*args, **kwargs): ... defaultfactory, args = args[0], args[1:] which can be written more succinctly as def defaultdict(defaultfactory, *args, **kwargs): ... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch,

Re: itertools to iter transition (WAS: Pre-PEP: Dictionary accumulator methods)

2005-03-31 Thread Greg Ewing
e parallel's a little weaker here because calling iter doesn't always produce objects of type iter: Indeed, I see iter() as being more like len(), which is clearly a function, not a constructor. Making iter() a type and giving it class methods would be strange. -- Greg Ewing, Computer Sc

Re: itertools to iter transition (WAS: Pre-PEP: Dictionary accumulator methods)

2005-03-31 Thread Greg Ewing
Ville Vainio wrote: The issue that really bothers me here is bloating the builtin space. We already have an uncomfortable amount of builtin functions. Maybe what we're really after here is the notion of a builtin module that's pre-imported into the builtin namespace. -- Greg Ewing

Re: Things you shouldn't do

2005-03-31 Thread Greg Ewing
Paul McGuire wrote: The code was filled with two key variables: t_1 and t_l. Printing out the source in a Courier font made these two vars completely indistinguishable, Are you sure it was Courier? I'm looking at it now in Courier, and they are different, although very similar. -- Greg

Re: Grouping code by indentation - feature or ******?

2005-03-31 Thread Greg Ewing
ing that you need to add 1. 3) You have a starting point and an ending point: lst[s:e+1]. Again, you don't really have an ending point. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.py

Unzipping Files

2005-04-01 Thread Greg Lindstrom
it easy on me if you please...I just don't see it and have a deadline rushing towards me. How do I read the data from a file in a zip archive? Thanks! --greg -- Greg Lindstrom 501 975.4859 (office) Senior Programmer501 219-4455 (fax) NovaSys Health [

Re: Making a DLL with python?

2005-04-03 Thread Greg Ewing
[EMAIL PROTECTED] wrote: I'd love to do the whole thing in Python, but I don't know how to make a DLL purely from Python. I don't think you can do it *purely* in Python. You'll at least need a C or Pyrex wrapper which dispatches to Python code. -- Greg Ewing, Computer Science

Re: property and virtuality

2005-04-03 Thread Greg Ewing
etter_name = intern('set_' + name) return property( lambda self: getattr(self, getter_name)(), lambda self, value: getattr(self, setter_name)(value), None, doc) Usage example: class MyClass(object): ... spam = overridable_property('spam

Re: string goes away

2005-04-03 Thread Greg Ewing
joined can be unicode, though: >>> str.join(" ", [u"a", u"b"]) u'a b' So it's probably not a serious problem, since in most cases you'll know whether the joining string is unicode or not when you write the code. If not, you'll just have to do it the "new" way. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: what's the use of __repr__?when shall I use it?

2005-04-03 Thread Greg Ewing
mal output of a program, to be seen by the user. * repr() is for debugging output, and should indicate reasonably unambiguously the *type* of the object. When debugging, it's often at least as important to know what type of object you have as what value it has. -- Greg Ewing, C

Re: Super Newbie Question

2005-04-04 Thread Greg Ewing
if you want. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Super Newbie Question

2005-04-05 Thread Greg Ewing
Joey C. wrote: the issue with the temporary file is that when I write something new to it, if the old contents of the file was larger, not all of it will be overwritten. Not if you open it with f = open(filename, "w") which will delete any previous contents the file may have had. --

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Greg Ewing
this purpose, as ?print "foo =", foo has a nice hint of "WT?%$%$ is going on at this point?" to it. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: boring the reader to death (wasRe: Lambda: the Ultimate Design Flaw

2005-04-06 Thread Greg Ewing
nce between unsurprising and boring. The coffee I drank this afternoon, for instance, did not surprise me, but I still enjoyed it. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda: the Ultimate Design Flaw

2005-04-06 Thread Greg Ewing
atomicity of the cake-ingestion operation will become apparent. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: richcmpfunc semantics

2005-04-07 Thread Greg Ewing
.) Maybe there is some good documentation available, but I cannot find it. I found most of this out by reading the source, I think. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling a Perl Module from Python ( future direction of Python)

2005-04-07 Thread Greg Ewing
gf gf wrote: Really! That's a pity... Instead of trying to recreate a repository the size of CPAN, a Python interface to Perl modules is really called for. When Parrot comes on line, this presumably will become trivial... -- Greg Ewing, Computer Science Dept, University of Cante

Re: Calling a Perl Module from Python ( future direction of Python)

2005-04-07 Thread Greg Ewing
By the way, is the Parrot project still alive, or has it been given up on? Not that I actually want it, but the idea is kind of morbidly fascinating. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http

Re: Using weakrefs instead of __del__

2005-04-07 Thread Greg Ewing
made the weak ref point to the Foo, not the RealFoo. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: wxwindows event function arguments

2005-04-07 Thread Greg Krohn
t like this: EVT_MENU(self, wxID_FIREFOX, curry(self.OnLaunch, path='D:\Program Files\Mozilla Firefox\Firefox.exe')) Then change your OnLaunch handler back to the way you originally wanted it: def OnLaunch (self, event, path): print event.GetString() os.startfile(path)

Re: within a class, redefining self with pickled file

2005-04-07 Thread Greg Ewing
f.__dict__, self.__class__, self.__class__.__dict__, or some other magic properties. such as def unpickle(self): new_self = pickle.load(open(self.getFilePath('pickle'))) self.__class__ = new_self.__class__ self.__dict__.update(new_self.__dict__) -- Greg Ewing, Computer S

Interpreter problem

2005-04-08 Thread Greg Lindstrom
If I remove the import sys and sys.exit(0) then type ./myotherfile.py at the command line it runs as expected. Both files have the same permission settings (744) and owner (me). I'm been looking at this for a couple of days and am at a loss. Have any of you seen anything like this and what

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Apr 11)

2005-04-13 Thread Greg Ewing
inally say something that gets into Quote of the Week, and it's attributed to someone else! :-) :-) :-) -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: The convenient database engine for a "Distributed" System

2005-04-13 Thread Greg Ewing
database copying. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming Language for Systems Administrator

2005-04-13 Thread Greg Ewing
Peter Maas wrote: This is only true for trivial bash scripts. I have seen bash scripts which were quite hard to read especially for beginners. I've seen shell scripts which are quite hard to read even for experts! -- Greg Ewing, Computer Science Dept, University of Canterbury, Christc

Re: Best editor?

2005-04-13 Thread Greg Ewing
Mike Meyer wrote: Gee, it's changed from eight to eighty. Probably because eight is a small app by todays standards. Then again, it's not like 80 is large these days. Yeah, it's probably time to upgrade it to 800. :-) -- Greg Ewing, Computer Science Dept, Universit

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Greg Lindstrom
> He says, > Do you know how I can get "base12 pi"? > Because the chromatic scale is base12. > c c# d d# e f f# g g# a a# b > > Dick It might feel more "natural" to do this with 'e' (2.718...) --greg -- http://mail.python.org/mailman/listinfo/python-list

Re: mySQL values not updating after query

2005-04-15 Thread Greg Miller
I just discovered that a few minutes ago, thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Inelegant

2005-04-18 Thread Greg Ewing
emented?) string. It spans multiple lines. """ print type(foo) print foo The output is: This is a dedented (or perhaps demented?) string. It spans multiple lines. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.c

Using Paramiko

2005-04-19 Thread Greg Lindstrom
aps I missed a section of the documentation; if I did, I apologize. Can anyone show me how to use this package? Thanks, --greg -- Greg Lindstrom 501 975.4859 (office) Senior Programmer501 219-4455 (fax) NovaSys Health [EMAIL PROTECTED] Little Rock, Arkansas &q

Re: eval function not working how i want it dag namn

2005-04-19 Thread Greg Ewing
is invisible at compile time, so the compiler misses it, and the run-time evaluation fails. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP: Simple Thunks

2005-04-19 Thread Greg Ewing
od syntax for this that isn't skewed towards one kind of use case. That's probably a large part of the reason why nothing like it has so far been seriously considered for adoption. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.

Re: Behaviour of str.split

2005-04-19 Thread Greg Ewing
'', '', ''] >>> "*".split("*") ['', ''] >>> "".split("*") [''] The split() method is really doing two somewhat different things depending on whether it is given an argument, and the end-cases come out differently. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a Function object from a Frame object

2005-04-19 Thread Greg Ewing
And there are probably some cases where this code still wouldn't work... Note that in general it's impossible to tell exactly which function object was involved, since there could be more than one function object sharing the same code object, and the frame only references the code object

Re: packages

2005-04-19 Thread Greg Ewing
, there wasn't any established convention. Hopefully the stdlib naming will gradually get ironed out as the oldest bits get deprecated. The tutorial could probably do with being updated, too. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand

Re: def a((b,c,d),e):

2005-04-19 Thread Greg Ewing
rned by using it. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating formatting strings

2005-04-19 Thread Greg Ewing
arguments to be in the form of a tuple, and if you give it something else, it wraps it up in a 1-element tuple and uses that instead. This seems to happen even with a custom subclass of tuple, so it must be doing an exact type check. So it looks like you'll have to parse the format string. --

Re: Enumerating formatting strings

2005-04-20 Thread Greg Ewing
Peter Otten wrote: Greg Ewing wrote: This seems to happen even with a custom subclass of tuple, so it must be doing an exact type check. No, it doesn't do an exact type check, but always calls the tuple method: I guess you mean len(). On further investigation, this seems to be right, except

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