Re: scared about refrences...

2006-10-31 Thread Gabriel Genellina
d this yet, you should: <http://www.effbot.org/zone/python-objects.htm> -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mai

Re: "best" rational number library for Python?

2006-10-31 Thread Gabriel Genellina
ry on a PC running Solaris 10 (won't compile with the default --host, fails "make check" if I go the no-assembly route). Before I invest a bunch of time into this, am I barking up the wrong tree? Try clnum included in: http://sourceforge.net/projects/calcrpnpy -- Gabr

Re: best way to check if a file exists?

2006-10-31 Thread Gabriel Genellina
just want to check if a file of a certain name exists before the user creates a new file of that name. Remember that things may change between you check the name and you actually create the file. -- Gabriel Genellina Softlab SRL __ Correo

__doc__ in compiled script

2006-11-02 Thread Gabriel Genellina
not supposed to be used as a module). --- begin test.py --- body = """ "This is a docstring" x=0 some(code).toBeExecuted("later") """ co = compile(body,'','exec') print co.__doc__ # what can I use for "something"

Re: __doc__ in compiled script

2006-11-02 Thread Gabriel Genellina
ferenced is a string, but it's good enough for me. Thanks! -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: scared about refrences...

2006-11-02 Thread Gabriel Genellina
list remains "the same" (look at id(foo)). The name a2 still refers to the int 2 (because nobody changed that). It's really easy once you get it - and then, just enjoy writing Python code! -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: __doc__ in compiled script

2006-11-02 Thread Gabriel Genellina
evel statements > that have to be executed only once (it's not supposed to be used as a > module). >>> co.co_consts[list(co.co_names).index("__doc__")] 'This is a docstring' Good! I'll buy this one :) thanks! -- Gabriel Genellina Softlab SRL _

Re: Projecting MUD maps

2006-11-06 Thread Gabriel Genellina
t;(north, east, west and south) that connects it to another room. So it >is very easy to model a MUD as a directed graph. But projecting the You could use dot www.graphviz.org I think there is a python wrapper -pydot maybe?- but anyway the dot file format is very easy to write.

Re: Wait for keyboard input

2006-11-06 Thread Gabriel Genellina
in python Use raw_input() and press ENTER. When replying, please edit your Subject line so it is more specific than "Re: Contents of Python-list digest..." Best if you follow that suggestion... -- Gabriel Genellina Softlab SRL __ Co

Re: Unicode/ascii encoding nightmare

2006-11-06 Thread Gabriel Genellina
er are true. Sometimes I even got the replies *before* the original post comes. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar --

Re: using split function

2006-11-06 Thread Gabriel Genellina
quot;NameError: name 'zeros' is not > defined". Oh, so *that's* why you build it using standard_normal and then overwrite the contents! -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus me

Re: But it was yesterday here!

2006-11-07 Thread Gabriel Genellina
rectory and perform the import base64MIME there. What may have happened? I bet you have an email.py somewhere in your sources... -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis!

Re: Character encoding

2006-11-07 Thread Gabriel Genellina
At Tuesday 7/11/2006 17:10, mp wrote: I'd prefer a more generalized solution which takes care of all possible ampersand characters. I assume that there is code already written which does this. Try the htmlentitydefs module -- Gabriel Genellina Softla

Re: C wrapper

2006-11-07 Thread Gabriel Genellina
must be called initfoo (*not* init_foo) And what are those non-static functions used for? The *only* purpose of your module should be to provide the Python bindings... -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tu

Re: C wrapper

2006-11-07 Thread Gabriel Genellina
sing the first part), or *embedding* python inside your application, mainly written in C (you would use something like the last code). -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡A

Re: C wrapper

2006-11-07 Thread Gabriel Genellina
appear in a section about extending!). I can see your confusion reading http://docs.python.org/ext/methodTable.html That is, you *don't* write a main() function, and you *don't* invoke Py_Initialize; just write your initXXX() function.

Re: __init__ function problem

2006-11-07 Thread Gabriel Genellina
class does not inherit from object" def __init__(self, value): print "OldStyle.__init__",value n = NewStyle(1) o = OldStyle(2) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus

Re: Cactching Stdout

2006-11-08 Thread Gabriel Genellina
ng to STDOUT; you could replace STDOUT with the write end of a pipe, and read from the other end. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya

Re: please help with optimisation of this code - update of given table according to another table

2006-11-08 Thread Gabriel Genellina
initial sorts) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem exiting application in Windows Console.

2006-11-08 Thread Gabriel Genellina
flag, and set the flag in your "quit.html" handler instead of sys.exit(0) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange re problem on OSX but Not Linux

2006-11-08 Thread Gabriel Genellina
mething trivial here - so please be gentle if it is on the stupid side of things. Dont use regex as a name. Also, do you have any script called "re.py" hidding that library module? or regex.py? -- Gabriel Genellina Softlab SRL __ Cor

Re: Is there a commas-in-between idiom?

2006-11-08 Thread Gabriel Genellina
pile time, so using items is a lot faster than looking for "items" inside self's namespace each time it's used. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡A

Re: Python c-api and reusing python-objects: works only once

2006-11-08 Thread Gabriel Genellina
invoke Py_Initialize again; and you shouldn't. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: help using smtplib to work ..

2006-11-08 Thread Gabriel Genellina
rs, msg) server.quit() send: 'mail FROM:<[EMAIL PROTECTED]> size=106\r\n' reply: '530 5.7.0 Must issue a STARTTLS command first s1sm7666914uge\r\n' What am I doing wrong ? gmail.com requires authentication before sending mail. Try this sequence: ehlo, starttls, ehlo (a

Re: Python to tell what is the IP of my PC .

2006-11-08 Thread Gabriel Genellina
ecipe/162994 import win32api raise the error "module not exsit" and socket.gethostbyname(name)the router doesn't have a hostname. Use the small script in the recipe's comments section. -- Gabriel Genellina Softlab SRL __ Corr

Re: Using Python from Cocoa App via PyObjc - numbers dont match...

2006-11-08 Thread Gabriel Genellina
] (and the second likewise) the first is 40.42 and the second is -40.42. Why does this happen? This is mostly independent on the language in use. Numbers like 40.4 don't have, in general, an exact binary representation. See http://docs.python.org/tut/node16.html -- Gabriel Genell

Re: substring search without using built in utils

2006-11-08 Thread Gabriel Genellina
At Wednesday 8/11/2006 22:29, zeal elite wrote: I am looking for substring search python program without using the built in funtions like find, or 'in'. The only reasonable usage for such a constraint would be a school assignment so: don't cheat and do your homework! -- Ga

Re: is this the right way to do subclasses?

2006-11-08 Thread Gabriel Genellina
is simple too. Also, class attributes provide default instance attributes - you don't have to provide an explicit value. Stats names are extensible as shown. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tu

Re: help using smtplib to work ..

2006-11-09 Thread Gabriel Genellina
hat's clearly stated on the docs for the starttls method: http://docs.python.org/lib/SMTP-objects.html -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta

Re: newbie class-building question

2006-11-09 Thread Gabriel Genellina
; should raise AttributeError when not found, not return a string. Just return getattr(self.wrapped, attrib) and let the error propagate. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡

Re: Lists of lists and tuples, and finding things within them

2006-11-09 Thread Gabriel Genellina
t = dict( password01='unk', host='dragonstone.org', port='1234', character01='Thessalus' ) And then you would look up host by: mydict[ 'host' ] You can even keep the original tuples, and create a dict when needed (if searches like this are seldom us

Re: directpython object move

2006-11-09 Thread Gabriel Genellina
At Thursday 9/11/2006 15:01, [EMAIL PROTECTED] wrote: How can I move objects in directpython??? I suggest you post directpython questions on its specific mailing list, see the SourceForge project page. -- Gabriel Genellina Softlab SRL

Re: cross connecting

2006-11-09 Thread Gabriel Genellina
g its output; use the subprocess module. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/lis

Re: urlretrieve get file name

2006-11-09 Thread Gabriel Genellina
gives you those headers. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: Having problems with urlparser concatenation

2006-11-09 Thread Gabriel Genellina
#x27; urllib treats the former as a file: request, here the \\ in the normalized path. You are parsing the link and then building a new URI using ONLY the hostname part; that's wrong. Use urljoin(ParsedURL, '/robots.txt') instead. You may try Beautiful Soup for a better HTML pa

Re: Tkinter check box behaviour - Windows / Linux discrepancy

2006-11-09 Thread Gabriel Genellina
the previous mouse down was over the same widget. Your code doesn't work either if the user presses SPACE to toggle the button state; using "command" works fine in this case too. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Es

Re: urlretrieve get file name

2006-11-09 Thread Gabriel Genellina
does not suggests a filen ame, the server is not providing one (there is no obligation to do so). -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http:/

Re: how is python not the same as java?

2006-11-09 Thread Gabriel Genellina
At Thursday 9/11/2006 21:44, gavino wrote: both are interpreted oo langauges.. I'd use Google to find thousands of references... -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y ant

Re: object data member dumper?

2006-11-09 Thread Gabriel Genellina
At Thursday 9/11/2006 22:16, tom arnall wrote: > I'd suggest you instead consider a mixin object that will add recursive > data dump functionality to any such classes you require. have googled a fair amount on 'mixin' but still stumped on it. Try again using "

Re: pack a three byte int

2006-11-09 Thread Gabriel Genellina
cii.hexlify(cdb) '080123458000' The only problem I can see is that this code is endianness-dependent; the suggested versions using pack(">...") not. But this may not be of concern to you. -- Gabriel Genellina Softlab SRL

Re: pack a three byte int

2006-11-09 Thread Gabriel Genellina
e ~1972) popularised convention, so only those do I construct with binascii.unhexlify. So you would have no problems. I stand corrected: the code above will always generate big-endian numbers. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: service windows avec py2exe

2006-11-10 Thread Gabriel Genellina
27;Syntaxe incorrecte', >None, None) Try with a small sample application then adding more functions, to see where it fails. (Pardonnez moi, je ne sais pas assez pour répondre en française) -- Gabriel Genellina Softlab SRL __ Correo Ya

Re: newbee I have an object how to check what's his class?

2006-11-10 Thread Gabriel Genellina
class, that is, you wrote: class X: blablabla instead of class X(object): blablabla For old-style class instances, type(x) is InstanceType, not the actual class. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensaj

Re: handling many default values

2006-11-10 Thread Gabriel Genellina
=None, z=None): A.__init__(self, x, y) if z is not None: self.z = z a = A(1) print "a.x=",a.x print "a.y=",a.y b = B(z=8) print "b.x=",b.x print "b.y=",b.y print "b.z=",b.z output: a.x= 1 a.y= 20 b

Re: urlretrieve get file name

2006-11-10 Thread Gabriel Genellina
ion header yourself. See the urllib documentation. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailma

Re: Inheritance Question

2006-11-10 Thread Gabriel Genellina
lid number of legs: %d" % number_of_legs If walking in general, have some common structure, you can put the "sketch" on Legs and let the derived classes "fill the gaps". This is known as "Template Method Pattern" - look for it. -- Gabriel Genellina Softl

Re: UnboundLocalError

2006-11-10 Thread Gabriel Genellina
inside the enclosing functions, then in the containing module's global namespace, and last in the builtin names. And yes, b is local to a, so it effectively hides any external b that could be in outer scopes. -- Gabriel Genellina Softlab SRL __

Re: Inheritance Question

2006-11-10 Thread Gabriel Genellina
ts. As above, they may inherit from a common base class (Walker, Eater, by example). -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.a

Re: Find how to embed the BitTorrent in my program

2006-11-13 Thread Gabriel Genellina
At Monday 13/11/2006 11:56, å¼ æ²ˆé¹ wrote: >Is there any module can easy embed the BitTorrent(both tracker and >client) in myself's program . >Or where can find the documents for reuse official BitTorrent . Tried downloading the source? -- Gabriel Genelli

Re: handling many default values

2006-11-13 Thread Gabriel Genellina
table are undefined." -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing database output in tabular form

2006-11-13 Thread Gabriel Genellina
repayment a') You get an *array* object from the database...? Which database? Is it stored as a BLOB field or similar? You could transform it to string using the tostring method, and decode it to unicode. -- Gabriel Genellina Softlab SRL __ Co

Re: Python app links in windows

2006-11-13 Thread Gabriel Genellina
n argument; see sys.argv[] -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: __cmp__ between dissimilar objects

2006-11-13 Thread Gabriel Genellina
So any comparison with datetime on the left and your GeneralizedTime on the right side will fail. If nobody has an explanation on *why* datetime does this, I'd say it's a bug. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio

Re: Unpacking sequences and keywords in one function call

2006-11-13 Thread Gabriel Genellina
in kw.iteritems(): print k, '=', v >>> f(1,2) arg: 1 arg: 2 >>> f(*[1,2]) arg: 1 arg: 2 >>> f(1,2, a=1) arg: 1 arg: 2 a = 1 >>> f(*[1,2], a=1) File "", line 1 f(*[1,2], a=1) ^ SyntaxError: invalid syntax

Re: How to check for instances of a class

2006-11-14 Thread Gabriel Genellina
it is much appreciated. isinstance -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/p

Re: __cmp__ between dissimilar objects

2006-11-14 Thread Gabriel Genellina
ibed in the documentation for the rich comparison or __cmp__ methods... PEP 207 http://www.python.org/dev/peps/pep-0207/ -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta

Re: __cmp__ between dissimilar objects

2006-11-14 Thread Gabriel Genellina
d? or read footnote 4 under "supported operations" on this page for info on how to implement mixed-type comparisions: http://docs.python.org/lib/datetime-datetime.html Ugh... I hope there were good reasons for doing things so convoluted... -- Gabriel Genellina Softlab SRL _

Re: __cmp__ between dissimilar objects

2006-11-14 Thread Gabriel Genellina
special in its implementation, a NotImplementedError (instead of TypeError) would have let your code a chance of being executed. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gra

Re: jython's future

2006-11-14 Thread Gabriel Genellina
that time. We used to call Java "Ya va!", which in spanish means something like "Wait, I'm coming!" :) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡

Re: modules and generated code

2006-11-15 Thread Gabriel Genellina
directories in the same package. But this is the obvious thing, so maybe I'm missing something. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! -

Re: wrapping existing instance in new interface

2006-11-15 Thread Gabriel Genellina
hods would be available on any datetime instance - you don't need myDateTime class. You can move "magicmethod" into a factory function used to construct datetime objects. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espaci

Re: pyRTF and Footers

2006-11-15 Thread Gabriel Genellina
I'll give it a try...) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: pyRTF and Footers

2006-11-15 Thread Gabriel Genellina
;t quite > >make sense to me. > So a better place to ask would be... well, it appears there is no better place except asking > the author directly :) Anyone got his number? You could try the address listed in the docs... I'm trying the examples and Example7 appears to be what

Re: Python v PHP: fair comparison?

2006-11-15 Thread Gabriel Genellina
o the report generator - a lot of PHP code duplicates the original class hierarchy (in delphi) - php sucks :) Of course there are a lot of unrelated issues here, but I think that it's such a braindead language which turns people into braindead programmers :) -- Gabriel Genellina Softl

RE: Python v PHP: fair comparison?

2006-11-15 Thread Gabriel Genellina
ussed here! Sure. But after you realize that a language is just a tool to complete a task, most of the discussions are meaningless. The original post didn't say "python is better than php", and I think the comparison is rather fair. -- Gabr

Re: Decimal() instead of float?

2006-11-16 Thread Gabriel Genellina
database from the outside, but that's another story). You could consider them like id() in python - an identifier that, although it's in fact a pointer, should not be dereferenced. -- Gabriel Genellina Softlab SRL __ Correo Yah

Re: deciding what is a dir (folder) in a zip file

2006-11-16 Thread Gabriel Genellina
d(fn)) ofile.close() # mantener fecha/hora dt = zf.getinfo(fn).date_time ft = time.mktime((dt[0],dt[1],dt[2],dt[3],dt[4],dt[5],0,0,-1)) os.utime(fullfn, (ft,ft)) finally: zf.close() --- cut --- -- Gabriel Genellina Softlab SRL

Re: Writing to Registry

2006-11-16 Thread Gabriel Genellina
want something Like -- SetValueEx(aKey,"MyNewSize",0, REG_SZ, 120 or some value) Usually when you don't know how to use a certain function, you begin by reading the documentation for it: http://docs.python.org/lib/module--winreg.html#l2h-5827

Re: cPickle problems

2006-11-16 Thread Gabriel Genellina
omeway, self.__getstate__ is a string, not a method... Since it fails inside a python module, you could print some debug information to see what happens, like repr(self), type(self), repr(getstate)... -- Gabriel Genellina Softlab SRL __ Correo

Re: Writing to Registry

2006-11-16 Thread Gabriel Genellina
At Thursday 16/11/2006 21:39, Samantha wrote: > http://docs.python.org/lib/module--winreg.html#l2h-5827 Thanks for the link. Notice that surely you already have the full Python documentation, it comes with the standard distribution. -- Gabriel Genellina Softlab

Re: Printing/writing an integer to a file

2006-11-16 Thread Gabriel Genellina
L)) fileobject1.close() = Enough for a good start. Happy pythoning! -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about numpy

2006-08-24 Thread Gabriel Genellina
n element-by-element multiplication. You want matrixmultiply: http://numpy.scipy.org/numpydoc/numpy-9.html#pgfId-36542 Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que quería

Re: sum and strings

2006-08-24 Thread Gabriel Genellina
predictable behavior according to duck-typing? sequences don't have to be homogeneous, and iterators cant go back. But let GvR say that in his own words: http://mail.python.org/pipermail/python-dev/2003-April/034854.html Gabr

Re: String formatting with nested dictionaries

2006-08-24 Thread Gabriel Genellina
foo is set to %(foo)s - Value One is: %(Value1)s and Value Two is: %(Value2)s -- Hammers are used to pound in %(Hammer)s" output = template % mydict['inner_dict'] output = output % mydict Both methods assume that the inner dict takes precedence in case of name clashes; reverse the order if

Re: array tofile to a socket?

2006-08-24 Thread Gabriel Genellina
At Thursday 24/8/2006 14:08, KraftDiner wrote: Can pythons array.tofile method be used for a TCP/IP Socket? ie can the socket be a file object? I've never tried, but usually any object with a write() method works fine in these cases. Gabriel Genellina Softla

Re: array tofile to a socket?

2006-08-24 Thread Gabriel Genellina
At Thursday 24/8/2006 14:08, KraftDiner wrote: Can pythons array.tofile method be used for a TCP/IP Socket? ie can the socket be a file object? I've never tried, but usually any object with a write() method works fine in these cases. Gabriel Genellina Softla

Re: When is a subclass not right?

2006-08-24 Thread Gabriel Genellina
cisely, a Car instance has an Engine instance). Gabriel Genellina Softlab SRL p5.vert.ukl.yahoo.com uncompressed Thu Aug 24 19:27:05 GMT 2006 __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni

Re: When is a subclass not right?

2006-08-24 Thread Gabriel Genellina
;is an" A instance. Using delegation, you have to delegate the desired method calls yourself (but there are ways to do that automatically, too). Delegation is a relationship between instances. If you add a method foo() to A, you have to add it to B2 too. A B2 instance "is not an&

Re: When is a subclass not right?

2006-08-24 Thread Gabriel Genellina
say foo: b1.foo() is OK b2.foo() raises AttributeError So you decide to override foo() too (in both implementations, B1 and B2) Let's say, A.bar() calls self.foo() b1.bar() calls B1.foo on b1 b2.bar() calls A.foo on t - B2.foo is *not* called. E

Re: lazy arithmetic

2006-08-24 Thread Gabriel Genellina
to the Item class, you could use a factory: def AddFactory(a,b): return Add(a,b) Item.__add__ = AddFactory (but as you've said yourself, that's a bit crazy...) Gabriel Genellina Softlab SRL __ P

Re: pickling and endianess

2006-08-24 Thread Gabriel Genellina
Serializable? Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas

Re: pickling and endianess

2006-08-24 Thread Gabriel Genellina
At Friday 25/8/2006 03:37, Chandrashekhar Kaushik wrote: I dont think i really need that much . Just need to be able to send data across the network and then retrieve it properly independent of the architecture at the remote end :) What about old ASCII? Gabriel Genellina Softlab SRL

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread Gabriel Genellina
ng a look at __slots__ is fine as long as you don't actually use them. Why? Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo!

Re: question about class, functions and scope

2006-08-28 Thread Gabriel Genellina
that *all* code be in class methods; using functions alone -as others have pointed out- is fine. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni

Re: about daemons and IPC

2006-08-28 Thread Gabriel Genellina
Then I found many solutions for forked processes (like posh), but that's not what I need right now. Perhaps you can tell what you are trying to do...? Gabriel Genellina Softlab SRL __ Preguntá. Respon

Re: newbe question about removing items from one file to another file

2006-08-28 Thread Gabriel Genellina
) method here I am pretty sure my code isn't close to what I want. I need to be able to skip html like commands from to and to key on another word in adition to to end the routine Good job for Beautiful Soup: http://www.crummy.com/softw

Re: unit test for a printing method

2006-08-28 Thread Gabriel Genellina
int out "---bla---" http://docs.python.org/lib/module-doctest.html When the output goes a bit more complicated, consider splitting such method in parts: some generate the output, others just print it. Then you can test the former using th

Re: Python web service ...

2006-08-28 Thread Gabriel Genellina
you don't have to use a full-blown web server to implement it. SimpleHTTPServer in the standard library may be enough. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías

Re: __str__ for large objects, would not c++ iostream be more efficient

2006-08-28 Thread Gabriel Genellina
At Tuesday 29/8/2006 00:04, alf wrote: is there any way in Python to have iostream like __str__ operator? Define a method writeTo(f) if you want, and instead of: f.write('%s' % obj) use: obj.writeTo(f) Gabriel Genellina S

Re: eval() woes

2006-08-28 Thread Gabriel Genellina
that the problem is with the way the list is being passed in... but I could be wrong) ...like above, where you missed a quote. Can anyone see something I can't? Not on the code fragment you posted. Gabriel Genellina Softlab SRL

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Gabriel Genellina
how this supports the original claim that strict type checking input params is good practice. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginaba

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Gabriel Genellina
that > strict type checking input params is good practice. I'm not defending that claim. I'm just putting question marks with the claim that strict type checking input parameters is bad practice. I think others have shown enough examples of good things that can be done by *not* enf

Re: a question about my script

2006-08-29 Thread Gabriel Genellina
ate over all of them, using another dir() to find the .pep files needed. directory = 'pub/kegg/genomes/ afm' Is that whitespace intentional? (If you just want to download the files and don't need really a Python

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-29 Thread Gabriel Genellina
of 2). In fact it's the other way - losing a factor of 2 is irrelevant, O(2N)=O(N). The logN factor is crucial here. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías s

Re: Generator chaining?

2006-08-29 Thread Gabriel Genellina
way to explain is by code example: Already done: itertools.chain Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas

Re: Split with python

2006-08-29 Thread Gabriel Genellina
or last field. Are there tools in the csv module that make this easier? Yes, just use the csv module and forget all that split&joins... Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo q

Re: Coding style and else statements

2006-08-30 Thread Gabriel Genellina
clear (but definitively I prefer an if statement), and the former simply sucks. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respue

Re: Python web service ...

2006-08-30 Thread Gabriel Genellina
need to know about sockets more than you need to know how a diesel engine works in order to drive a car. A webservice *uses* HTTP as a transport protocol - any HTTP server would do. PS: Top posting is not a good

Re: dictionary with object's method as thier items

2006-08-30 Thread Gabriel Genellina
as obj with sometiing like: (i know that this syntax wont work ) obj.(d['function one']) obj.(d['function two']) You can use dir(obj) to get its list of attributes (including method names) then use getattr to invoke the method. methodname='func1' getattr(obj,me

Re: all ip addresses of machines in the local network

2006-08-31 Thread Gabriel Genellina
r ZeroConf, UPnP or other techniques used for service discovery. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (

<    1   2   3   4   5   6   7   8   9   10   >