Re: is there a better way?

2006-02-10 Thread Schüle Daniel
[...] > > What not > > for x in list: > if x == O: > break > storage.append(x) > i think this may take too long better aproach would be to test for zero from the end Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a better way?

2006-02-10 Thread Schüle Daniel
le" give me the heebies. Is > there a better approach? >>> lst = [1,2,3,4,5,0,0,0,0] >>> del lst[lst.index(0):] >>> lst [1, 2, 3, 4, 5] >>> Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a better way?

2006-02-10 Thread Schüle Daniel
Lonnie Princehouse wrote: > everybody is making this way more complicated than it needs to be. > > storage = list[:list.index(O)] the question is whether the old list is needed in the future or not if not then it would be easer/mor efficient to use del lst[lst.index(0):] Regard

Re: is there a better way?

2006-02-10 Thread Schüle Daniel
s = 1) lst.remove(item = 0, nItems = 2) lst.remove(item = 0, all = True) in last case nItems is ignored Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: arrays in python

2006-02-10 Thread Schüle Daniel
, '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>> Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonic exec* spawn*

2006-02-11 Thread Daniel Nogradi
> > >> os.fork() does that (on Mac and Unix). > > > > > >Okay, but how? > > > > Sorry, fork() is implemented strictly on a 'need to know' basis :-) > > > > >It seems to me that if the process which issued os.fork() ends, then > > >the forked process also ends. > > > > No, no, they're not a quantum

Re: Is Forth for real?

2006-02-12 Thread Daniel Ciesinger
sembly. I've got a > bunch of Forth books here, and when I'm bored I read them for > entertainment, and dream. I love the fact that Forth is still in use. But > I'm under no illusions that there are millions of Forth developers getting > paid to write in Forth. Maybe a few hundred - and then some thousands who write their utils in Forth during their paid time... Daniel -- http://mail.python.org/mailman/listinfo/python-list

Embedding an Application in a Web browser

2006-02-14 Thread Daniel Nogradi
> Is it possible to embed a Python application within Internet explorer? > If so how do people recommend going about it. > > As for the application it has to be able display simple animated > graphics such as circles, lines and squares. However if someone clicks > on a shape it should open up anoth

Re: low level data types

2006-02-15 Thread Daniel Dittmar
hon.org/lib/module-struct.html and search for "Alternatively, the first character of the format string can be used to indicate the byte order" Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Add a month

2006-02-17 Thread Daniel Dittmar
t; is date(2006,3,17), what's date(2006,1,31) plus one month? Traceback (most recent call last): File "", line 1, in ? ValueError: date domain error in analogy to math.sqrt (-2) Daniel -- http://mail.python.org/mailman/listinfo/python-list

Print a PDF transparently

2006-02-17 Thread Daniel Crespo
#x27;t know how to use it. Any help for printing a PDF transparently? Thank you Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Print a PDF transparently

2006-02-17 Thread Daniel Crespo
, my problem reduces to generate the .ps file. Comments please Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Print a PDF transparently

2006-02-17 Thread Daniel Crespo
install it on 70 offices. So I can't leave it to another installation process. All of these offices have a dot matrix printers Epson LX-300, which has PostScript level 3 built-in. Where can I find how to send a .ps directly to the printer? Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Does python have an internal data structure with functions imported from a module?

2006-02-17 Thread Schüle Daniel
with string->function mapping op = { "plus" : lambda x,y:x+y, "minus" : lambda x,y:x-y, "power" : lambda x,y:x**y, } op["power"](2,8) hth, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Print a PDF transparently

2006-02-20 Thread Daniel Crespo
> Have you seen this? > http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html > In particular, the section on using win32print directly. Yes, I have. The problems is that an external program is launched for handling the file and print it. In the case of PDF, acrobat is launched. In the

Re: Print a PDF transparently

2006-02-20 Thread Daniel Crespo
> Have you seen this? > http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html > In particular, the section on using win32print directly. Yes, I have. The problems is that an external program is launched for handling the file and print it. In the case of PDF, acrobat is launched. In the

Re: how to break a for loop?

2006-02-20 Thread Schüle Daniel
oop through del is asking for trouble try for i,coef in enumerate(coefs[:]): instead > P.S. I feel SO stupid asking this quastion... ;-) uda4i hth, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Print a PDF transparently

2006-02-21 Thread Daniel Crespo
with it is that one have to depend on the physical printer configuration. Daniel -- http://mail.python.org/mailman/listinfo/python-list

PDF on dot matrix printers

2006-02-21 Thread Daniel Crespo
atter of resolution, obviously not in the printer, but in the PDF. So I'm wondering if there are some tasks that I could do for accomplish it. Thanks for reading Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Lisp -- please explain

2006-02-22 Thread Daniel Harding
Steven D'Aprano wrote: > Who says Python is so slow? I've just got Python to count from 0 up to > 100,000, and it only took 7 milliseconds. That's at least 12 milliseconds > faster than I can count on my fingers. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Using repr() with escape sequences

2006-02-23 Thread Daniel Dittmar
g) 'bar\\foo\\12foobar' If you get the strings from an external source as suggested by your original post, then you really have no problem at all. No interpretation of escape sequences takes place when you read a string from a file. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Module written in C does not repond to Ctrl-C interruption.

2006-02-24 Thread Daniel Dittmar
ntering the C extension. This should abort the extension (tricky) and call the Python signal handler. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Module written in C does not repond to Ctrl-C interruption.

2006-02-25 Thread Daniel Dittmar
Bo Peng wrote: > Daniel Dittmar wrote: > >> >> You could set up your own signal handler when entering the C >> extension. This should abort the extension (tricky) and call the >> Python signal handler. > > > This can be done under linux using things in

Re: Why I chose Python over Ruby

2006-03-05 Thread Schüle Daniel
def d(z): ... q.append(x) ... q.append(y) ... q.append(z) ... d(1) ... c(2) ... b(3) ... return q ... >>> a() [3, 2, 1] As far as I know this snippet would

Re: Adding method at runtime - problem with self

2006-03-05 Thread Schüle Daniel
[EMAIL PROTECTED] wrote: > First of all, please don't flame me immediately. I did browse archives > and didn't see any solution to my problem. > > Assume I want to add a method to an object at runtime. Yes, to an > object, not a class - because changing a class would have global > effects and I wa

Re: lists in cx_Oracle

2005-05-03 Thread Daniel Dittmar
ement. And there are few predicates where a list parameter is useful. Expanding a list always yould lead to very bizarre error messages. Expanding them only where useful would require a SQL parser. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: lists in cx_Oracle

2005-05-10 Thread Daniel Dittmar
am variables to SQL parameters. Embedded SQL has fallen out of favour and new APIs (ODBC, JDBC) use the question mark as the placeholder. The principle remains the same for many databases: the SQL string is sent unchanged to the database. Additionally, a list of actual values is sent for each ex

mod_python and logging

2005-05-15 Thread Daniel Lichtenberger
out several forked apache processes running different (sub-)interpreters, logging to the same file? Other suggestions for logging (I really don't need most of logging.*'s facilities) are also welcome. Thanks, Daniel -- For mail replies please use my address from http://perplex.sch

Re: mod_python and logging

2005-05-16 Thread Daniel Lichtenberger
iver can log > received events to file. The online docs have an example socket > receiver: > > http://docs.python.org/lib/network-logging.html Thanks for the suggestion! Of course it's great to have a powerful and flexible logging package, and it's still pretty easy to use. D

Re: \r functionality

2005-05-17 Thread Daniel Schüle
Jake wrote: > in c and c++ there is a useful way to refresh an output line in printf > and cout using \r meta command. So for example in the wget application > the progress of the download is updated on the same output line of the > screen. From an intital investigation python seems to lack this. I

Re: passing arguments

2005-05-20 Thread Daniel Bickett
An even better way would be to use the optparse module.-- Daniel Bickettdbickett at gmail.comhttp://heureusement.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLDBAPI

2005-06-10 Thread Daniel Dittmar
message, the current default for the includes seems to be /usr/local/mysql/include/mysql 3) You can then delete the directories created in 1a or 1b Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLDBAPI

2005-06-14 Thread Daniel Dittmar
bly have to inspect the environment in your CGI run for LD_LIBRARY_PATH for a directory where you can copy mysqlclient*.so. (That's why it is easier to use the static library) Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Python Wiki engine?

2005-06-14 Thread Daniel Dittmar
pe programming is not really Python programming. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple instances of a python program

2005-06-17 Thread Daniel Dittmar
d be that the rules of the game explicitly forbid that bots of a group communicate other than through the server. And it is easier to cheat there when you have only one Python program running. Daniel -- http://mail.python.org/mailman/listinfo/python-list

ANN: Concurrence 0.0.5.2 Alpha

2005-06-17 Thread Daniel Bickett
net, or on the mailing list [EMAIL PROTECTED] -- Daniel Bickett dbickett at gmail.com http://heureusement.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

2007-06-11 Thread Daniel Barlow
Tim Bradshaw wrote: > I think it's just obvious that this is the case. What would *stop* > you writing maintainable Perl? A grudge against humanity, usually -dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Dive into Python 5.5

2007-06-13 Thread Daniel Nogradi
he > last statement should be self.data.update(dict). > > someone please explain to me what happen where? You are right, this code will not work, and your suggestion is a reasonable one. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Goto

2007-06-13 Thread Daniel Nogradi
> How does one effect a goto in python? I only want to use it for debug. > I dasn't slap an "if" clause around the portion to dummy out, the > indentation police will nab me. http://entrian.com/goto/ -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-20 Thread Daniel Dyer
of alternative interpretation for "EMACS". http://www.gnu.org/fun/jokes/gnuemacs.acro.exp.html My favourite: Elsewhere Maybe All Commands are Simple Dan. -- Daniel Dyer http//www.uncommons.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Python live environment on web-site?

2007-06-20 Thread Daniel Nogradi
the pypy people also put together a publicly available python console in javascript. Actually it's a whole xterm I think and one can start python in there. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Voluntary Abstract Base Classes

2007-06-29 Thread Daniel Nogradi
Hi list, Well, the short question is: what are they? I've read Guido's python 3000 status report on http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he mentions ABC's but don't quite understand what the whole story is about. Anyone has good use cas

Re: Voluntary Abstract Base Classes

2007-06-29 Thread Daniel Nogradi
; > about. > > The story is at PEP 3119: > http://www.python.org/dev/peps/pep-3119/ Thanks, I overlooked that somehow. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory leak in PyQt application

2007-07-01 Thread Daniel Nogradi
increases for ~70 KB. > > Sometimes the application crash on closing QWindow. (QtCore.dll) > > - One thing I ask me is weather garbage collection is done in the PyQt main > loop? > > What hints do you have to find the leak? Have a look at valgrind: http://valgrind.org/ HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: 15 Exercises to Know A Programming Language

2007-07-03 Thread Daniel Nogradi
> > > "Write a program that takes as its first argument one of the words > > > 'sum,' 'product,' 'mean,' or 'sqrt' and for further arguments a > > > series of numbers. The program applies the appropriate function to > > > the series." > > > > > My solution so far is this: > > > > >http://dpaste.co

Re: python 3.0 or 3000 ....is it worth waiting??? Newbie Question

2007-07-03 Thread Daniel Nogradi
> Chris 99% of what you would learn from python 2.x will be useful for python 3.0. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: standalone executables

2007-07-10 Thread Daniel Nogradi
> I need a reference to get all the programs which used to package Python > programs into standalone executables files. > Would you help me? windows: http://www.py2exe.org/ mac: http://cheeseshop.python.org/pypi/py2app/ linux: http://wiki.python.org/moin/Freeze linux/windows: http://python.n

Re: Dynamic method

2007-07-10 Thread Daniel Nogradi
> I have an issue I think Python could handle. But I do not have the knowledge > to do it. > > Suppose I have a class 'myClass' and instance 'var'. There is function > 'myFunc(..)'. I have to add (or bind) somehow the function to the class, or > the instance. Any help, info or point of reference is

Re: Dynamic method

2007-07-11 Thread Daniel Nogradi
ethod_for_instance > > > > inst.method( 'hello' ) > > This won't work as expected: > > class Bidule(object): >def __init__(self, name): > self.name = name > > def greet(self, who): >print "hello %s, my name is %s" % (who, sel

Re: how to call bluebit...

2007-07-13 Thread Daniel Nogradi
> how to import bluebit matrik calculator that result of singular value > decomposition (SVD) in python programming.. I'm not really sure I understand you but you might want to check out scipy: http://scipy.org/ HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: how to install pygame package?

2007-07-13 Thread Daniel Nogradi
> Im working in red hat linux 9.0. I've downloaded the pygame package > but i dont know how to install it. If anybody has the time to detail > the steps sequentially... thanx! > > P.S. I've downloaded both the tar and the rpm packages... First you can try the rpm package: su (give the root passwo

Re: how to install pygame package?

2007-07-14 Thread Daniel Nogradi
> There seems to be some problem. For the tar version, initial steps > execute OK, but after typing: > [EMAIL PROTECTED] pygame-1.7.1release]# ./configure > bash: ./configure: No such file or directory > > So i don't hav a configure file? What should i do now? Sorry, instead of ./configure do this

Re: standalone module

2007-07-15 Thread Daniel Nogradi
> I want to create a standalone program ( an exe file ) from my python files > which works on Windows and Linux. > > Could you please tell me how to do that? The same executable should work on both linux and windows? Not possible. But see: http://mail.python.org/pipermail/python-list/2007-July/4

Re: Python Threads -

2007-04-19 Thread Daniel Nogradi
> Can you please suggest a technique in Python where we can spawn few number > of worker threads and later map them to a function/s to execute individual > Jobs. Have a look at the threading module: http://docs.python.org/lib/module-threading.html HTH, Daniel -- http://mail.python.or

Re: Python un-plugging the Interpreter

2007-04-19 Thread Daniel Nogradi
the secret goal is being faster-than-C which is nonsense, isn't it?" Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
'failed' and things > like that, just to make it a little more presentable to the user. You might find that urwid, a console user interface library, meets your needs: http://excess.org/urwid/ Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
cess' in green, or red for 'failed' and > things > > like that, just to make it a little more presentable to the user. Something like this might also help on linux: def blue( text ): print '\033[1m' + text + '\033[0m' blue( 'this will be blue&

Re: Dictionaries and dot notation

2007-04-22 Thread Daniel Nogradi
se I would still have to > > plug in that __dict__ thing into my datastructure, which leads us to > > the same question as above. > > > > Can anyone tell me what I am missing here? What's wrong with creating a dummy class? class data: pass mydata = data( ) mydata.foo = 'foo' mydata.bar = 'bar' print mydata.foo print mydata.bar Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries and dot notation

2007-04-22 Thread Daniel Nogradi
d in a comment at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/361668 why the whole idea (attribute access of dictionaries) is a bad idea and I tend to agree. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: serializable object references

2007-04-22 Thread Daniel Nogradi
odule-pickle.html If you need to store objects and later look them up by some key I would recommend using a database. There are plenty: http://docs.python.org/lib/persistence.html HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket exceptions aren't in the standard exception hierarchy

2007-04-23 Thread Daniel Nogradi
> 2. File "D:\Python24\lib\socket.py", line 295, in read > data = self._sock.recv(recv_size) > error: (10054, 'Connection reset by peer') > > >>> That looks like M$ Windows version of UNIX/Linux error number 54 > >>> (pretty much all Windows socket errors are UNIX number+100

Re: Would You Write Python Articles or Screencasts for Money?

2007-04-24 Thread Daniel Nogradi
[Alex] > When cash is involved, it's important to avoid even the > slightest hint of a suggestion of a suspicion of a conflict of interest I propose the non-PSF sponsored Grand Prize For Successfully Squeezing 4 Of's In A Single Sentence should be received by Alex Martelli this month :) -- http:/

Re: If Dict Contains...

2007-04-25 Thread Daniel Nogradi
myDict: Do this. else: Do that HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Now()

2007-04-25 Thread Daniel Nogradi
> with the application that parses the log data, all I need is something like > this: > > 2007-04-25 11:06:53 Please see http://docs.python.org/lib/module-time.html Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Re-ocurring Events

2007-04-26 Thread Daniel Nogradi
nually. This will not solve all your problems, but a very convenient way of handling XML is the element tree module (that comes with python 2.5): http://docs.python.org/lib/module-xml.etree.ElementTree.html HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: if __name__ == 'main': & passing an arg to a class objec

2007-04-27 Thread Daniel Nogradi
o say what MaxQTest takes as an argument without seeing the code. If you post more details it might be easier to help you, but in any case this may be useful: http://python.org/doc/tut/ Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
# now the file 'name' is in 's' (in memory) # you can process it further # s.close( ) zipp.close( ) HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
le_from_your_server, 'r' ) > > for name in zipp.namelist( ): > > content = zipp.read( name ) > > s = StringIO( ) > > s.write( content ) > > # now the file 'name' is in 's' (in

Re: I/O Operations .....

2007-04-30 Thread Daniel Nogradi
= .. content2 = ... f = open( 'file1', 'w' ) f.write( content1 ) f.close( ) f = open( 'file2', 'w' ) f.write( content2 ) f.close( ) HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: I/O Operations .....

2007-04-30 Thread Daniel Nogradi
> > C:\Projects\ODX Import\Sample Files\Global _A_UHP_Low_0.7.xls > > > > If you only would like to know how to write files, this might help: > > > > content1 = .. > > content2 = ... > > > > f = open( 'file1', 'w&

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
> Does sqlite come in a mac version? > The interface (pysqlite) is part of the python 2.5 standard library but you need to install sqlite itself separately (as far as I remember) from www.sqlite.org Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile: grabbing whole directories

2007-05-01 Thread Daniel Nogradi
is the case you can use os.walk to iterate over all such files so you can archive all of them while the directory structure will be preserved. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
hat version of sqlite is supported by Python 2.5 I'm using sqlite 3.3.11 with python 2.5 (on linux) but I guess some earlier versions will also work. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
> > > Does sqlite come in a mac version? > > > > The interface (pysqlite) is part of the python 2.5 standard library > > but you need to install sqlite itself separately (as far as I > > remember) fromwww.sqlite.org > > > > Daniel > > I'm

Re: What do people use for code analysis.

2007-05-02 Thread Daniel Nogradi
> Lots of code, calls to, calls by, inheritance, multiple tasks, etc. > > What do people use to figure out what's happening? This is a pretty cool project just for that: http://codeinvestigator.googlepages.com/codeinvestigator HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite for mac?

2007-05-03 Thread Daniel Nogradi
7;s usually something like "from pysqlite2 import dbapi2 as sqlite" not simply "import sqlite". If you go to the test directory where everything works you can see how those modules import it and that should definitely work for you as well. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Mod Python Question

2007-05-08 Thread Daniel Nogradi
s probably much more than this (the python list). You can sign up here: http://mailman.modpython.org/mailman/listinfo/mod_python HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: __getattr__ and __getattribute__

2007-05-08 Thread Daniel Nogradi
ef/attribute-access.html HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: File modes

2007-05-10 Thread Daniel Nogradi
x27;a+' and possibly a 'b' or 'U' appended to these. So if you open it with 'rw' it will be interpreted as 'r'. For example this will not work: f = open( 'myfile', 'rw' ) f.write( 'hello' ) f.close( ) because python thinks you want to open 'myfile' in 'r' mode. I guess I agree that the thrown exception IOError: [Errno 9] Bad file descriptor is not very informative in this case. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic subclassing ?

2007-05-12 Thread Daniel Nogradi
label("k") > - b.sayHello() > > I can't find the trick, but i'm pretty sure it's possible in an easy > way. How about: class MoreMethods: def sayHello(self): print "hello" class myButton( gtk.Button, MoreMethods ): pass b = myButton( ) isinstance( b, gtk.Button ) # True b.sayHello( ) # "hello" Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic subclassing ?

2007-05-12 Thread Daniel Nogradi
pass > > > > b = myButton( ) > > > > isinstance( b, gtk.Button ) # True > > b.sayHello( ) # "hello" > > yes, but it needs to recreate an instance (of mybutton) ... > i can't do that, in my context. > The only things i've got is my instance "b" (which can be whatever > object). > i'd like to add methods/attributes to this instance, by adding a > heritage of another class. I think that is not possible, at least in a simple way (there might be a complicated way of messing with the MRO). Please anyone correct me if I was wrong. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: [Newbie] design question

2007-05-12 Thread Daniel Nogradi
print 'buy in buyer' self.cart.buy( ) print 'some extra stuff' acart = ShoppingCart( ) abuyer = Buyer( cart=acart ) abuyer.buy( ) HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

elementtree and entities

2007-05-13 Thread Daniel Nogradi
Hi list, How does one prevent elementtree converting & to & (and similarly for other entities)? >>> from xml.etree import ElementTree as et >>> x = et.Element( 'test' ) >>> x.text = '&' >>> et.tostring( x ) '&'

Re: elementtree and entities

2007-05-13 Thread Daniel Nogradi
> > How does one prevent elementtree converting & to & (and similarly > > for other entities)? > > > from xml.etree import ElementTree as et > x = et.Element( 'test' ) > x.text = '&' > et.tostring( x ) > > '&' > > > > Sometimes I would like to have the output '&' > > > > element

Re: Asyncore Help?

2007-05-14 Thread Daniel Nogradi
> I am working on the networking code for a small Multiplayer RPG I'm > working on. I currently have some basic code using threads, but it > seems like asyncore would be far better suited for my needs. However, > I have trouble finding a solid example for what I need. Python.org and > other sites p

Re: How do I count the number of spaces at the left end of a string?

2007-05-16 Thread Daniel Nogradi
> I don't know exactly what the first non-space character is. I know the > first non-space character will be * or an alphanumeric character. How about: >>> mystring = 'ksjfkfjkfjds ' >>> print len( mystring ) - len( mystring.lstrip( ) ) 4 HTH, Da

Re: cPickle.dumps differs from Pickle.dumps; looks like a bug.

2007-05-16 Thread Daniel Nogradi
8.9.1: Thu Feb 22 20:55:00 > > PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386 > > If you unpickle though will the results be the same? I suspect they > will be. That should matter most of all (unless you plan to compare > objects' identity based on their pickled version.) The OP was not comparing identity but equality. So it looks like a real bug, I think the following should be True for any function f: if a == b: f(a) == f(b) or not? Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: cPickle.dumps differs from Pickle.dumps; looks like a bug.

2007-05-16 Thread Daniel Nogradi
Right, sorry about that, posted too quickly :) I was thinking for a while about a deterministic > For certain inputs, cPickle doesn't print the memo information that is > used to support recursive and shared data structures. I'm not sure how > it tells the difference, perhaps it has something to do with > refcounts. In any case, it's an optimization of the pickle output, not > a bug. Caching? >>> from cPickle import dumps >>> dumps('0') == dumps(str(0)) True >>> dumps('1') == dumps(str(1)) True >>> dumps('2') == dumps(str(2)) True >>> dumps('9') == dumps(str(9)) True >>> dumps('10') == dumps(str(10)) False >>> dumps('11') == dumps(str(11)) False Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending a JavaScript array to Python script?

2007-05-17 Thread Daniel Nogradi
> Just wondering if there is any way of sending a JavaScript array to a > Python cgi script? A quick Google search didn't turn up anything > useful. Simplejson is what you want: http://cheeseshop.python.org/pypi/simplejson HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

[ANN] markup.py 1.7

2007-05-17 Thread Daniel Nogradi
A new release is available for markup.py, a module for generating HTML/XML output painlessly and practically without any learning curve. The goal of markup.py is to be able to quickly put together documents in an ad hoc basis so if you need anything for production look for something else, e.g. Elem

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
st wondering, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
> > >> For example, it HAS been published elsewhere that YouTube uses lighttpd, > > >> not Apache: . > > > > > > How do you explain these, then: > > > > > > http://www.youtube.com/results.xxx > > > http://www.youtube.com/results.php > > > http:/

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
> > >> For example, it HAS been published elsewhere that YouTube uses lighttpd, > > >> not Apache: . > > > > > > How do you explain these, then: > > > > > > http://www.youtube.com/results.xxx > > > http://www.youtube.com/results.php > > > http:/

model browser

2007-05-20 Thread Daniel Nogradi
; did anyone do something like this? Or does anyone know if catwalk was originally written for tg or was general purpose before and became integrated into tg later? Are there other options I overlooked? Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: model browser

2007-05-20 Thread Daniel Nogradi
And before you ask, yes, I did read http://mail.python.org/pipermail/python-list/2007-May/440337.html but there was nothing beyond django/tg :) -- http://mail.python.org/mailman/listinfo/python-list

Translating some Java to Python

2007-05-20 Thread Daniel Gee
A while ago I wrote a class in Java for all kinds of dice rolling methods, as many sides as you want, as many dice as you want, only count values above or below some number in the total, things like that. Now I'm writing a project in Python that needs to be able to make use of that kind of a class.

Re: Translating some Java to Python

2007-05-20 Thread Daniel Gee
Alright, sounds good. I'm just not as familiar with the preferred designs of python. As to wanting to have them in a class, sometimes I do. Persisting a roll in a class is only for the slightly more complicated rolls such as 3d6+5d4-1d12 or "4d6 (drop the lowest and re-roll ones)", things of that

dabo framework dependancies

2007-05-22 Thread daniel gadenne
Paul McNett wrote: > Shameless plug: consider using Dabo on top of wxPython - we feel it > makes wxPython even easier and more pythonic, but admittedly there's a > bit of a learning curve there too. Even though Dabo is a full > application framework originally meant for desktop database > appli

Re: model browser

2007-05-23 Thread Daniel Nogradi
> > Are there other options I overlooked? > > > > Daniel > > There is a CRUD template for TG: > http://docs.turbogears.org/1.0/CRUDTemplate > > Might be what you're looking for. I was looking for something that is not based on a framework such as django or tg

Re: dabo framework dependancies

2007-05-25 Thread daniel gadenne
Hi Paul, Peter, Uwe Thank to the three of you for your clear answers :) -- http://mail.python.org/mailman/listinfo/python-list

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