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 (

Re: a question about my script

2006-08-31 Thread Gabriel G
At Thursday 31/8/2006 10:01, alper soyler wrote: I changed the script as you wrote below: directory = 'pub/kegg/genomes' Sorry, in the original comment I said "change it to be an absolute path" but didn't write it well. This line should read: directory = '

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Gabriel Genellina
At Thursday 31/8/2006 12:44, Nico Grubert wrote: in a text with no carriage returns I need to look for all occurancies of this string: ... Try Beautiful Soup, or if your input is simple enough, the re module. Gabriel Genellina Softlab SRL

Re: re.compile() doesn't work under Windows?

2006-08-31 Thread Gabriel Genellina
d is on the path - for example, the following code works and doesn't cause any errors: import re re.compile('a') What else could cause such an error? Your *own* module is called re.py, right? Try another name... Gabriel Genellina Softlab SRL

Re: a question about ftplib

2006-09-01 Thread Gabriel G
lass) are not good, but for an utility script like yours I think it's fine. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo

Re: Incremental Progress Report object/closure?

2006-09-01 Thread Gabriel Genellina
lah blah blah\r" % whatever, (notice the \r and the final , ) Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas

Re: Reading config.ini in PythonWin.

2006-09-11 Thread Gabriel Genellina
ons as the former is portable, and does look to have a means of working... Just don't use defaults to be safe... Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber,

Re: testing for valid reference: obj vs. None!=obs vs. obj is not None

2006-09-11 Thread Gabriel Genellina
if obj: This checks whether obj is considered True, not whether it is None. e.g. obj=[] would not pass. if None!=obs: Would be OK, but the next one is better: if obj is not None: This is what you are looking for! :) Gabriel Genellina S

Re: Finding name of variable?

2006-09-11 Thread Gabriel Genellina
#x27;,first_name) because it's rather clear, and I think you would not use such things a lot. Remember that a single object may be known as many names, or even anonymous - they are not unique. Gabriel Genellina Softlab SRL

Re: are there any lib for receive hotmail ?

2006-09-11 Thread Gabriel Genellina
ops does that (and a lot more) - but it's not written in Python, it uses LUA. http://www.freepops.org/ It puts a POP server on top of the webmail, letting you use your favorite mail program. The Hotmail plugin works perfectly for me.

Re: Is it just me, or is Sqlite3 goofy?

2006-09-11 Thread Gabriel Genellina
any* object to *any* database column? Looks a lot more "pythonic" for me. Of course, a true object database (like ZODB) is better. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí

Re: 4 Simple Questions About Python/IDLE

2006-09-12 Thread Gabriel Genellina
Python tutorial which comes with the documentation? You can read it online at <http://docs.python.org/tut/tut.html> Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querí

Re: PILGraph Upgrade or Alternative Suggestion

2006-09-12 Thread Gabriel Genellina
At Thursday 7/9/2006 22:35, Roger wrote: Anyone have an updated version of PILGraph beyond 0.1a7 or a suggestion for a light-weight alternative? pychart Gabriel Genellina Softlab SRL __ Preguntá

Re: error

2006-09-12 Thread Gabriel Genellina
it's well written) and only then, try to embed it inside a C++ program. Even if you are not going to write the Python scripts yourself. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. T

Re: Is it just me, or is Sqlite3 goofy?

2006-09-12 Thread Gabriel Genellina
n minutes I spent looking > this up. I remember that one of my very first Python scripts was to convert the SQL92 grammar -unusable otherwise- into an html cross-referenced version... Gabriel Genellina Softlab SRL ___

Re: python reference counting and exceptions

2006-09-12 Thread Gabriel Genellina
is always executed, whether or not an exception is raised. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta

Re: How to compare to directories?

2006-09-13 Thread Gabriel Genellina
? Look at filecmp.dircmp in the standard library 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

Re: time-based point system

2006-09-13 Thread Gabriel Genellina
choose whatever tastes you more. 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://w

Re: parameter files

2006-09-13 Thread Gabriel Genellina
c=4.0 [run_two] a=456 b=Whatever c=0.1 config = ConfigParser.ConfigParser() config.read(filename) a = config.getint('run_two','a') # a==456 b = config.get('run_name_one','b') # b=='Test' section

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-14 Thread Gabriel Genellina
and easy to follow. 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/r

Re: Algorithm Question

2006-09-14 Thread Gabriel Genellina
://www.cs.sunysb.edu/~algorith/files/set-cover.shtml Full text (not-so-legal, I presume): http://www2.toki.or.id/book/AlgDesignManual/BOOK/BOOK/NODE4.HTM Gabriel Genellina Softlab SRL __ Preguntá. Respondé. D

Re: Pre-defining an action to take when an expected error occurs

2006-09-14 Thread Gabriel Genellina
the Python Tutorial: http://docs.python.org/tut/node10.html Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo

Re: float questions

2006-09-15 Thread Gabriel Genellina
an error, just a very small number i want to be able to round this number to 3 places, but round() does not work Does not work, or you get 0.000? That's normal. Gabriel Genellina Softlab SRL _

Re: strange result with json-server & zope

2006-09-16 Thread Gabriel Genellina
ay, why are you using dtml-mime and such? Using the email package is easier and a lot more powerful. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imagin

Re: strange result with json-server & zop

2006-09-16 Thread Gabriel Genellina
e and such? Using the email package is easier and a lot more powerful. i'm using zope & jsonserver & maildrop to develop this part , so the main problem how to send mail with json-rpc structure. You can use the email package from inside Zope; an external method will do. Gabrie

Re: How to Send the Message using win32gui?

2006-09-18 Thread Gabriel Genellina
At Monday 18/9/2006 02:07, =?GB2312?B?0vzP6cH6?= wrote: I want to send LVM_SETITEMSTATE message using win32gui. But I don't know how to do in Python. The obvious way is win32api.PostMessage - but I feel you have another, higher-level, problem... Gabriel Genellina Softla

Re: win32com InvokeTypes is None

2006-09-18 Thread Gabriel Genellina
At Monday 18/9/2006 12:32, SS Hares wrote: I'm encountering an issue where the InvokeTypes method is returning None and I'm unable to Dispatch a particular COM object from I think you will get better responses if you post on http://mail.python.org/mailman/listinfo/python-win32

Re: Single character input without pressing 'Enter'

2006-09-19 Thread Gabriel Genellina
t/355683.html> 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/respu

Re: include statement

2006-09-20 Thread Gabriel Genellina
able in the imported module; this way you import exactly what is needed (and the rest is kept as "private") Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y

Re: Pyglade, gtk, howto write more efficiently, and waste less code?

2006-09-20 Thread Gabriel Genellina
t_widget("path2") self.paths[3] = self.wTree.get_widget("path3") self.paths[4] = self.wTree.get_widget("path4") self.paths[5] = self.wTree.get_widget("path5") what about if i have 30 widgets? how can i "get" them all? Is this what you wa

Re: new string method in 2.5 (partition)

2006-09-20 Thread Gabriel Genellina
, so I don't think the above is true... Nope, a python string has both a length *and* a null terminator (for ease of interfacing C routines, I guess) so you can't just share a substring. Gabriel Genellina S

Re: "list index out of range" error

2006-09-20 Thread Gabriel Genellina
emove(temp_str) is fairly slow - it has to *scan* the list to locate temp_str. Just keep its index instead, and use del list_initial[index] - as a general sorting routine, that 'zzz' does not look very good, try to avoid it. Gabriel Genell

Re: byte count unicode string

2006-09-20 Thread Gabriel Genellina
- like the unicode object, it has no "encoding" by itself. You can go back and forth between an integer number and its decimal representation - like astring.decode() and ustring.encode() Gabriel Genellina Softlab SRL

Re: Trying to run an external program

2006-09-20 Thread Gabriel Genellina
is as follows: import commands x = commands.getstatusoutput('dir') According to the documentation: Availability: Unix. Try the subprocess module, which intents to replace it. Gabriel Genell

Re: access to xml_rpc server problem

2006-09-20 Thread Gabriel Genellina
At Wednesday 20/9/2006 21:30, Ted Zeng wrote: But if I use server's ip address instead of localhost in the client, then it could not access the server. Maybe you have a firewall blocking access? Gabriel Genellina Softla

Re: naming objects from string

2006-09-21 Thread Gabriel Genellina
namespace: class X: pass x = X() a = 'hello' b = (1,2,3,4) setattr(x, a, b) print x.hello # prints (1,2,3,4) getattr(x, a) # returns the same but perhaps if you explain better what you want, we can figure out how to do that... Gabriel G

Re: view page source or save after load

2006-09-21 Thread Gabriel Genellina
porary variable to be able to close it. 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!

Re: how to use timer in python

2006-09-21 Thread Gabriel Genellina
At Thursday 21/9/2006 06:03, yxh wrote: how to use timer in python. the functionnality is like the MFC SetTimer() Use the Timer class. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo

Re: Can I inherit member variables?

2006-09-21 Thread Gabriel Genellina
things about the language. You can read it online at <http://docs.python.org/tut/tut.html> [1] kinda... remember that classes don't determine the available attributes; class attributes are inherited, and any attribute you set on an instance will be accessible by any method of the

Re: Can I inherit member variables?

2006-09-21 Thread Gabriel Genellina
ionship). Hope it becomes clearer now. 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

Re: Can I inherit member variables?

2006-09-21 Thread Gabriel Genellina
xplain that to a beginner would just make things worse... You must grab the inheritance concept first. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginaba

Re: parsing java files

2006-09-21 Thread Gabriel Genellina
I would get the needed info using javadoc (in Java) and then process the output in Python. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Y

Re: new string method in 2.5 (partition)

2006-09-22 Thread Gabriel Genellina
the string? This is for simple char* strings, ASCIIZ. If your C code can accept embedded nulls, surely has made other provisions - like receiving the buffer length as a parameter. If not, it will see only a truncated string. Gabriel Genellina

Re: Application logging to screen and file - any favorite modules (no luck on cheeseshop)

2006-09-23 Thread Gabriel Genellina
nce at 033C8290) (/Softlab/otros) [328] denied. Your user account, softlab, exists at /acl_users. Access [328] requires one of the following roles: ['Softlab']. Your roles in this [328] context are ['Authenticated', &

Re: IDLE - Customizing output format

2006-09-25 Thread Gabriel Genellina
bj): print '' + repr(obj) >>> sys.displayhook = f Sometimes I enable a similar approach on my sitecustomize.py, using the pprint module. But I don't *always* like the outpu

Re: ctypes question about call by reference

2006-09-25 Thread Gabriel Genellina
r. That is, if you never have to access its fields, or create/destroy it in the "python" code (using an external function would be ok). Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí.

Re: Python CTypes translation of (pv != NULL)

2006-09-25 Thread Gabriel Genellina
At Monday 25/9/2006 21:27, [EMAIL PROTECTED] wrote: Q: The C idea of (pv != NULL) is said most directly in Python ctypes how? Perhaps reading the ctypes tutorial? (both in the 2.5 docs and in <http://starship.python.net/crew/theller/ctypes/tutorial.html>) Gabriel Genellina Softl

Re: A critique of cgi.escape

2006-09-25 Thread Gabriel G
y and pretend it said quote=True: import cgi cgi.escape.func_defaults = (True,) del cgi Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está

Re: accepts decorator

2006-09-26 Thread Gabriel Genellina
s the Python docs. 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/respu

Re: How to run in background?

2006-09-26 Thread Gabriel Genellina
th an .exe file compiled with py2exe extension? Do I have to write a batch script separately? I don't remember the details, but in your setup.py replace: console=myscript.py to windows=myscript.py (or maybe noconsole=myscript.py? I dont remember, but look at the distutils docs) Gabriel G

Re: does anybody earn a living programming in python?

2006-09-26 Thread Gabriel Genellina
At Monday 25/9/2006 20:09, walterbyrd wrote: I do. If so, I doubt there are many. That's why they get well paid :) (uhm, not really... :( ) Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Des

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Gabriel Genellina
and a bunch of BASIC/Pascal/FORTRAN legacy code which I wish I could throw away ... Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, e

Re: A critique of cgi.escape

2006-09-26 Thread Gabriel G
documentation of a published standard module? Just modify the behavior in *your* own cgi.escape and all of us will be happy... Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo

Re: A critique of cgi.escape

2006-09-26 Thread Gabriel G
r kind of tests, and really should not depend on the details of cgi.escape - as the usability test of an MP3 player does not care about some transitor's hFE used inside... Gabriel Genellina Softlab SRL __

Re: IDLE - Customizing output format

2006-09-26 Thread Gabriel Genellina
*always* like the output format. Can you please show this approach using "pprint"? Sure. Put these two lines into your sitecustomize.py: import sys, pprint sys.displayhook = pprint.pprint and see what happens when you eval things inside the interpreter. Gabriel Genellina Softlab S

Re: IDLE - Customizing output format

2006-09-26 Thread Gabriel Genellina
he original PEP for details http://www.python.org/dev/peps/pep-0217/ And notice that this replaces the output of *evaluated* expressions, not any print statement executed inside your code. Gabriel Genellina Softlab SRL

Re: Python CTypes translation of (pv != NULL)

2006-09-26 Thread Gabriel Genellina
- It's really the same as bool([])==False, bool(any_non_empty_list)==True: L = [1,2,3] while L: print L.pop() You don't say: while bool(L)==True: (do you?) Gabriel Genellina Softlab SRL

Re: releasing memory to malloc

2006-09-26 Thread Gabriel Genellina
available to the extension in step 3 (which uses malloc). Can you modify the C source? If you can, use the Python memory allocation functions PyMem_Malloc/PyMem_Realloc/PyMem_Free. Gabriel Genellina S

Re: releasing memory to malloc

2006-09-26 Thread Gabriel Genellina
for use with or without Python. 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

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread Gabriel Genellina
to (or use --color=always) auto means "use colors *only* when *not* redirected" Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yah

Re: Starting Win32 Service

2006-09-27 Thread Gabriel Genellina
At Wednesday 27/9/2006 01:39, placid wrote: Using Tim Golden's wmi module you can get the service names but how do i start services that are stopped? Surely there are fancier ways: >net start servicename Gabriel Genellina Sof

Re: a query on sorting

2006-09-27 Thread Gabriel Genellina
zip(*sorted([(a[i],i) for i in range(len(a))])) 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! htt

Re: Battlefield Weapon Popularity Trend

2006-09-27 Thread Gabriel Genellina
the Samurai] did not resist"? The "resisted" believing all the buzz, e.g.: "armies made of dudes with guns" ... From the name I guess Ramon speaks Spanish; "resistir" in Spanish has a similar mean

Re: IDLE - Customizing output format

2006-09-27 Thread Gabriel Genellina
place it. I've looked a little at the code, but get immediately demotivated seeing 72 files within a flat directroy: http://svn.python.org/view/python/trunk/Lib/idlelib/?rev=52013 Remember that packages have not existed forever... I've seen worse things :) Gab

Re: Extra Newby question - Trying to create md5 File Listing

2006-09-27 Thread Gabriel Genellina
- in fact, you are iterating along the *letters* in the file name, that explains your error that "c" doesn't exist. Just say: filelist = glob.glob(fileData) Gabriel Genellina Softlab SRL __ Pre

Re: Fwd: Recursive Tree in Python

2006-09-27 Thread Gabriel Genellina
At Wednesday 27/9/2006 13:35, Fred Kitoogo wrote: I wish to create a recursive tree and test in Python for combining classifiers, below are the two Algorithms (Training & Testing):- Can somebody please help? Sure. See <http://www.catb.org/~esr/faqs/smart-questions.html#homework>

Re: Python CTypes translation of (pv != NULL)

2006-09-27 Thread Gabriel Genellina
es into python: if ptr1: ... if ptr2: ... if not ptr3: ... Oh that's exactly how my newbie innocence led me astray. Don't apologize, it's not easy to learn Python *and* learn to link an external library at the same time... Gabriel Genellina Softlab SRL

Re: Python CTypes translation of (pv != NULL)

2006-09-27 Thread Gabriel Genellina
None is *not* a pointer (neither any other kind of ctypes object), it's an object -a singleton, i.e., there exist exactly a single one instance of None). If you want to check if some kind of pointer is NULL or not, do *not* check if it is None or not, check its Boolean value, again: if p

Re: Computer Language Popularity Trend

2006-09-27 Thread Gabriel Genellina
ith me, using Zope. The scripting language or machinery used is an implementation detail, so it should not appear on a URL, if you want them to be more or less permanents. Gabriel Genellina Softlab SRL __

Re: Auto color selection PIL

2006-09-27 Thread Gabriel Genellina
At Wednesday 27/9/2006 20:43, Leif K-Brooks wrote: > I'm trying to plot some points in an image. Each point has an > associating type and I'd like to have different colors (preferrably of > high contrast) for different types. The number of types in the data > file is unknown a priori. Is ther

Re: ctypes pointer to pointer

2006-09-27 Thread Gabriel Genellina
ll_foo dll_foo.argtypes = [POINTER(c_char_p), POINTER(c_long)] status = dll_foo(byref(data), byref(size)) Are you sure your function is compiled using the stdcall calling convention? I'm not sure what

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-28 Thread Gabriel Genellina
> > But, can string formatting be used to convert an integer to its binary > form ? a = 199 a_bin_str = pack('L', a) Notice that the OP was looking for another thing, given the examples. Perhaps a better wording would h

Fwd: RE: [Python-Help] Python Help

2006-09-28 Thread Gabriel Genellina
x27; whatever = value.strip().lower() Here we split the line on the ":" character; key is the text on the left, value the remaining text on the right. If you are using Python 2.5, the partition() string method would be useful here. Gabriel Genellina Softlab SRL

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-28 Thread Gabriel G
hon, having the built-in dict type which is rather efficient? I would not use Python to teach *basic* data structures, instead, I'd use it as a second stage to teach more complex structures and how to design algorithms. Gabriel G

Re: Recursive descent algorithm able to parse Python?

2006-09-28 Thread Gabriel Genellina
complex. This idea extends to the parser. Restricting Python's grammar to an LL(1) parser is a blessing, not a curse. It puts us in handcuffs that prevent us from going overboard and ending up with funky grammar rules like some other dynamic languages that will go unnamed, like Perl.&

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-28 Thread Gabriel Genellina
e a binary string you have to import the math module, convert the integer to float, compute a non-standard logarithm, and then... What if n<=0? Too much, don't you think? :) Gabriel Genellina Softlab SRL ___

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Gabriel Genellina
combining characters. For example é can be represented in Unicode as U+0065 (Latin small letter e) followed by U+0301 (combining acute) but it can also be represented as the precomposed character U+00E9 (Latin small letter e with acute)." Gabriel Genellina Softlab SRL

RE: Python

2006-10-02 Thread Gabriel Genellina
ole (that is, using file.read()) you'll get something like 'one\ntwo\nthree\n' As I said before, make sure your script works fine testing it *alone*, after then, try it with CVSNT. If it doesnt work, maybe what you get is not what you expect it to be - use print r

Re: Python

2006-10-02 Thread Gabriel Genellina
#x27;\\n') (I'm not sure if all involved parties interpret \n the same way...) -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imagina

Re: where the extra space comes from on the stdout

2006-10-02 Thread Gabriel G
lag is reset, but in this case the newline was provided by the input, so you get a space at the start of the next output. You could try using print '\rQuestion?', Gabriel Genellina Softlab SRL __ P

Re: Making posts to an ASP.NET webform.

2006-10-02 Thread Gabriel Genellina
s missing in your code. 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

Re: saving an exception

2006-10-03 Thread Gabriel G
o much, except in cases like yours). You can get the values using sys.exc_info() (Don't store the traceback more than needed because it holds a reference to all previous stack frames...) Gabriel Genellina Softlab SRL

Re: Overriding builtin getattr method

2006-10-03 Thread Gabriel Genellina
rations should make you to change your data, or the way you access your data. You invoke them at the presentation stage, depending on the final target. Gabriel Genellina Softlab SRL __ Preguntá. Resp

Re: Howto pass Array/Hash into Function

2006-10-03 Thread Gabriel G
return; } In Python your functions have formal arguments: def myfunc(plain_var, some_dict, some_list): # ... return You also have positional and keyword arguments, and default values. Read the Python tutorial <http://www.python.org/doc/current/tut/tut.html> Gabriel Gen

Re: split()

2006-10-03 Thread Gabriel Genellina
At Tuesday 3/10/2006 11:53, Bryan Leber wrote: Gabriel, actually what I did was go ahead and write the whole sequence of the commit(i.e. PATCH_NUMBER, BUG_NUMBER, etc) to a file, and then I read in that file and put them into a list. Then I used line.startswith() to go through and pull out

Re: PEP 358 and operations on bytes

2006-10-03 Thread Gabriel G
ce types. Perhaps there needs to be a 'seq' type containing those common methods, that is the superclass of 'str', 'bytes', 'list', 'tuple' et cetera. find() could be useful sometimes. But

Re: function for allocating memory for string array

2006-11-17 Thread Gabriel Genellina
At Friday 17/11/2006 11:14, Sheldon wrote: Can someone tell me how to remove the conflicts here ? Wrong group! Anyway, there is no need to reinvent the wheel, there are many array libraries for C... -- Gabriel Genellina Softlab SRL

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