Re: Need advice on how to improve this function

2006-08-22 Thread Gabriel Genellina
ds haven't changed very much lately :) ) 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: how do you get the name of a dictionary?

2006-08-22 Thread Gabriel Genellina
tandard OO, and there is no need to modify the Python language... Gabriel Genellina Softlab SRL p4.vert.ukl.yahoo.com uncompressed Tue Aug 22 17:27:05 GMT 2006 __ Preguntá. Respondé. Descubrí. Todo lo que querías s

Re: Job Jar

2006-08-22 Thread Gabriel Genellina
to be used for almost anything... It has nothing to do with version control. Gabriel Genellina Softlab SRL p5.vert.ukl.yahoo.com uncompressed Tue Aug 22 18:27:05 GMT 2006 __ Preguntá. Respondé. Descubrí. Todo lo q

Re: What are decorated functions?

2006-08-22 Thread Gabriel Genellina
it works OK but assume it's slow. So you "decorate" it with @memoized to improve performance. (This is just an example, of course - I'm not saying memoizing is the right thing to do here, nor this is the best way to do it... just to demonstrate what a deco

Re: Can I do this with list comprehension?

2006-08-22 Thread Gabriel Genellina
p(a,b) if aelem==1] print [belem for i,belem in enumerate(b) if a[i]==1] Or itertools.izip... Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, es

Re: find, replace and save string in ascii file

2006-08-23 Thread Gabriel Genellina
is my code Better create a new file with the new contents, and then rename it. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en

Re: How to download a web page just like a web browser do ?

2006-08-23 Thread Gabriel Genellina
links to conrespond local disk links and ... This tool already exists: wget Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yah

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Gabriel Genellina
where start resides, which I'm unable to find. On Windows NT, XP, 2003 and others, there is no "start.exe" executable; it's an internal command. It only exists on 95, 98, maybe ME. Try the subprocess module. Gabriel G

Re: swapping numeric items in a list

2006-08-23 Thread Gabriel Genellina
00, 0x7800]) You can see it byteswapped within each item. Use array('b') or 'B'. 'H' are two-byes integers. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Tod

Re: swapping numeric items in a list

2006-08-23 Thread Gabriel Genellina
quot;H" was the right typecode. But your input array should be: aa = array('H', [0x1234, 0x5678]) which should give: array('H', [0x3412, 0x7856]) Gabriel Genellina Softlab SRL __

Re: Class instantiation

2006-08-23 Thread Gabriel Genellina
ne the job at locations 0 and 20? Don't blame the code generator... fileId != fileID Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas

Re: in-memory-only file object from string

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 18:56, bobrik wrote: how to create a file object whose contents I initialize from a string and which is purely in memory? See the standard modules: StringIO and cStringIO Gabriel Genellina Softlab SRL

Re: range of int() type.

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 18:53, KraftDiner wrote: > |>> import sys > |>> sys.maxint > 2147483647 > So what type / class should one use to represent a 16 bit integers (signed or unsigned)? Plain int. If you need the overflow at 32K/64K, try: x & 0x G

Re: can't open chm files all of a sudden

2006-10-04 Thread Gabriel Genellina
I even reset but that didn't help. AppName: hh.exe AppVer: 5.2.3790.2453 ModName: itss.dll ModVer: 5.2.3790.2453 Offset: 6bec Try this: <http://support.microsoft.com/kb/275539/en-us> G

Re: Urlnames in urllib2

2006-10-04 Thread Gabriel Genellina
doubt you could get much more info about the actual object retrieved - there are proxies, rewrite rules, virtual hosts... Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías s

Re: Definition of '1j'?

2006-10-04 Thread Gabriel Genellina
only option would be to modify the Python sources. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Pr

Re: Hands on Documentation for Python methods and Library

2006-10-04 Thread Gabriel Genellina
At Thursday 5/10/2006 01:54, Wijaya Edward wrote: One can do the following with Perl $ perldoc -f chomp $ perldoc -f function_name or $ perldoc List::MoreUtils $ perldoc Some::Module Can we do the same thing in Python? s/perl/py/g See the pydoc module. Gabriel Genellina Softlab SRL

Re: Assertion in Python

2006-10-05 Thread Gabriel Genellina
x27;,1)[0].strip() # up to the next "," assertEqual(ipReadStr, ipExpected) break else: fail('"Designated Router (ID)" not found') Gabriel Genellina Softlab SRL __ Pregu

Re: Asychronous execution *with* return codes?

2006-10-05 Thread Gabriel Genellina
] + lstArgs).pid Is there some magic elixir which will get me both? Use the async way, and then, os.waitpid() Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni

Re: What value should be passed to make a function use the default argument value?

2006-10-05 Thread Gabriel Genellina
true. In the Queue Module is isn't explicitly written that maxsize is a keyword argument yet Queue.Queue(maxsize=9) works just fine. This is true for most python code, unless the arguments are get as *args. But it's not the same for the C code, where the argument parsing must be done exp

Re: weakSet

2006-10-05 Thread Gabriel Genellina
pe(s) for &: 'int' and 'A' >>> class B(object): ... def __init__(self, value): self.value = value ... def __repr__(self): return 'B(%s)' % self.value ... de

Re: MIMEMultipart() and CRLF vs RFC 2046

2006-10-05 Thread Gabriel Genellina
t http://sourceforge.net/tracker/?group_id=5470 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: ctypes and setjmp

2006-10-06 Thread Gabriel Genellina
would suffice. If you encounter one such thing in the function.argtypes list, that means a setjmp is needed before calling the actual function. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubr

Re: Can't get around "IndexError: list index out of range"

2006-10-06 Thread Gabriel Genellina
t exist? if 2 in [1,2,3]: print "Use the same (in) operator" elif 'E' in ('E','r','i','k'): print "Works for any sequence" elif 'o' in 'hello': print "Even strings" Gabriel Genellina Softlab SRL

Re: Names changed to protect the guilty

2006-10-06 Thread Gabriel Genellina
3) is False: print "3 is odd" ... else: print "3 is even" ... 3 is even Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imagin

Re: Debugging question: Print out program state (Variables)

2006-10-06 Thread Gabriel Genellina
variables. Is there a handy module that can do something like that? Yes, look at the cgitb module (the name is a bit misleading...) Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo q

Re: Subclassing built-in classes

2006-10-07 Thread Gabriel Genellina
BCD')) Certainly would slow down the whole execution time *a*lot*, with no benefit for almost nobody, if *every* reference to *any* literal in the code calls a python function at run time. And unless you return *exactly* the same object as now, almost all code would break! Do

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread Gabriel Genellina
At Saturday 7/10/2006 02:15, MonkeeSage wrote: On Oct 6, 8:23 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > if 2 in [1,2,3]: print "Use the same (in) operator" > elif 'E' in ('E','r','i','k'): print "Works for

Re: Subclassing built-in classes

2006-10-09 Thread Gabriel Genellina
builtin__ module, I > >didn't say it works actually (I'm aware it's not the case). Somehow, I missed Python's round() function and came up with convoluted solution involving decimal. Gee duh, Theerasak Ah! So this is applicable: Describe the goal, not the step http:

Re: Help with first script please. files, directories, autocomplete

2006-10-09 Thread Gabriel Genellina
Use instead 'c:\\home' or r'c:\home' or 'c:/home' (forward slashes are fine in Windows too) from ... import * is not the recommended way; use instead: from os import listdir listdir(d) or import os os.listdir(d) -- Gabriel Genellina Softlab SRL

Re: doesNotUnderstand?

2006-10-09 Thread Gabriel Genellina
ct() p = Proxy(o) p.method(1,2,3) finally calls o.method(1,2,3) p acts like o: it has the same attributes and so. Of course __getattr__ may do a lot more: it can forward the request using xmlrpc to another server, by example, or whatever you want. If you look at the Python Cookbook surely you´ll f

Re: Encode differences between idle python and python

2006-10-10 Thread Gabriel Genellina
xed\xf3\xfa' > >>> print a >ßÚݾ· > >>> type(a) > > >>> type(u) > > >>> Because the console code page != windows code page. Exit Python. At the console prompt, type: >chcp If it says 850 - your console is using codepage 850. Enter Python

Re: How to find a file or a device is currently used by which process or which program ?

2006-10-10 Thread Gabriel Genellina
ython, but Process Explorer from www.sysinternals.com will show you all open files from all running processes. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y

Re: A problem about File path encode

2006-10-10 Thread Gabriel Genellina
t;D:/Downloads/1.xml" (I wrote this same message a few hours ago...!) -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yaho

Re: A problem about File path encode

2006-10-10 Thread Gabriel G
t to parse > an xml file. > xmldoc=minidom.parse("D:\Downloads\1.xml") >IOError: [Errno 2] No such file or directory: 'D:\\Downloads\x01.xml' -- Gabriel Genellina Softlab SRL __ Preguntá. Re

Re: Can pdb be set to break on warnings?

2006-10-11 Thread Gabriel Genellina
At Wednesday 11/10/2006 07:31, LorcanM wrote: > > python -m pdb -Werror myprogram.py > It sounds like what I want, but it doesn't work for me. When I try the above line of code, it replies: Error: -Werror does not exist Try: python -h -- Gabriel Genelli

Re: nntplib tutorial

2006-10-11 Thread Gabriel Genellina
At Wednesday 11/10/2006 14:46, hg wrote: Is there such a thing ? Trying to understand the various strings I get hereunder A basic understanding of the protocol would help a lot. The RFC 977 itself is not so hard to read, but you could find some tutorials using google. -- Gabriel

Re: error handling

2006-10-11 Thread Gabriel Genellina
is way too old! -- 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: python 2.5 & sqlite3

2006-10-11 Thread Gabriel Genellina
om http://sourceforge.net/projects/pywin32/ -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo y

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Gabriel Genellina
lue which sits just in the middle of the list when ordered: median(3,5,12,1,2)=median(1,2,3,5,12) = 3 -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Gabriel Genellina
At Thursday 12/10/2006 21:54, Paul Rubin wrote: Gabriel Genellina <[EMAIL PROTECTED]> writes: > That explains all. Finding the median in an efficient way (that is, > without sorting the data first) isn't trivial, so your claim of "I can > do that using only one

Re: wxPython installation interferes with win32ui/win32gui

2006-10-13 Thread Gabriel Genellina
eliably across Windows versions. Just delete the .manifeest file and forget about it... -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas,

Re: dynamic module loading via __import__, nonetype?

2006-10-17 Thread Gabriel Genellina
the cyberspace... -- 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/respue

Re: OT: What's up with the starship?

2006-10-17 Thread Gabriel Genellina
(But hackers can be very clever...) Someone made years ago an UUDecode executable program consisting entirely of printable ASCII characteres (.COM, for DOS, might still work on XP...) -- Gabriel Genellina Softla

Re: where to I find:

2006-10-17 Thread Gabriel Genellina
At Tuesday 17/10/2006 13:50, [EMAIL PROTECTED] wrote: Can somebody tell me where to I find module name: "tele" It's not a standard module. Look on the documentation for the application/packages you are using. -- Gabriel Genell

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 11:26, abcd wrote: is there a way to make animated GIFs with python? vnc2swf is to much for what i was hoping. i have no problem with installing python packages, but having to use VNC is a bit much. A VNC server is about 400K in size... -- Gabriel Genellina Softlab

Re: Flushing standard input

2006-10-18 Thread Gabriel Genellina
): getch() # consume any pending keypresses print input = raw_input('Your input: ') print 'Your input: ', input For Unix you could look at the tty/termios modules. This recipe shows a portable getch() function: <http://aspn.activesta

Re: Getting method name from within the class method

2006-10-18 Thread Gabriel Genellina
atement (the ".a_method." part). Imagine having about 100 of the above print statements in the function and then you change the name of the function. I want all 100 of the print statements to work without having to change every one of them to reflect the new function name. Use the inspe

Re: Flexable Collating (feedback please)

2006-10-18 Thread Gabriel Genellina
7;a5', 'a10.2', 'a40', 'b2'] From the name "NUMERICAL" I would expect this sorting: b2, 4abc, a5, a10.2, 13.5b, 20abc, a40 (that is, sorting as numbers only). Maybe GROUP_NUMBERS... but I dont like that too much either... -- Gabriel Genellina Softlab

Re: Getting method name from within the class method

2006-10-18 Thread Gabriel Genellina
resources are not too important, but correct information is. Imagine a logfile that says that you were at function_a but instead you were at function_b (because of copy&paste without replacing the names) -- Gabriel Genellina Softlab SRL __

Re: Flexable Collating (feedback please)

2006-10-18 Thread Gabriel Genellina
a10.2, 13.5b, 20abc, a40 (that is, sorting as numbers only). > Maybe GROUP_NUMBERS... but I dont like that too much either... How about 'VALUE_ORDERING' ? The term I've seen before is called natural ordering, but that is more general and can include date, roman numerals, as well as oth

Re: Converting existing module/objects to threads

2006-10-18 Thread Gabriel Genellina
ncore module instead of threads. -- 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: Cannot import a module from a variable

2006-10-18 Thread Gabriel Genellina
rn"? That could make some things easier, and some things harder... Note that moving the return statement after the finally does *exactly* the same thing, generates shorter code, and is a lot more readable (IMHO). -- Gabriel G

Re: How to use python in TestMaker

2006-10-18 Thread Gabriel Genellina
t and need some help. What do you mean by "use python in TestMaker"? TestMaker is written in Python, but you dont need to know Python to use it at all. Do you want to modify TestMaker itself? Then you should learn the Python language first. -- Gabriel G

Re: Converting existing module/objects to threads

2006-10-19 Thread Gabriel Genellina
avoid threads whenever possible, at least because debugging the application becomes harder. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni im

Re: Decorators and how they relate to Python - A little insight please!

2006-10-19 Thread Gabriel Genellina
n of decorators (preferrably explained with Python)? These links may be useful: http://www.phyast.pitt.edu/~micheles/python/documentation.html > http://soiland.no/software/decorator > http://wiki.python.org/moin/PythonDecoratorLibrary > -- Gabri

Re: Calling a definition

2006-10-19 Thread Gabriel Genellina
returning the first file that it finds. What am I doing wrong? Someone else has shown how to make your code work. But notice that you don't even need the findFileExt function: see the glob module. -- Gabriel Genellina Softla

Re: proper format for this database table

2006-10-19 Thread Gabriel Genellina
Depending on your needs, later university and degreesEarned may become entities instead of simple text attributes. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber,

Re: Restricting import file lookup for pyd, dll, ...

2006-10-19 Thread Gabriel Genellina
we can change in Python? Or would it be doable by recompiling the sources? You can't; part of the standard library are .pyd/.dll files. Those existence checks should be fairly fast - why are you worried about them? -- Gabriel Genellina Softla

Re: Lead Software Engineer

2006-10-19 Thread Gabriel Genellina
tions" on 1996? -- 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: invert or reverse a string... warning this is a rant

2006-10-19 Thread Gabriel Genellina
.html>). (BTW, integers -except two of them- are not inversible in Z). So "invert" is not a bad name "per se". But having the reversed() builtin and reverse() list method implies that a similarly rooted name would be better (just to be coherent!) - perhaps reversed_string()?

Re: Restricting import file lookup for pyd, dll, ...

2006-10-19 Thread Gabriel Genellina
ize this overhead so the users of this application waste less time waiting after the startup. Try to shorten the PYTHONPATH to the really required directories (deleting those locations "that don't make sense"). -- Gabriel Genellina Softlab SRL

Re: Restricting import file lookup for pyd, dll, ...

2006-10-19 Thread Gabriel Genellina
artup. Are you sure that *this* behavior is what causes your slow startup? What OS/filesystem are you using? Are you loading your application across the network, using a file share, samba or something like that? -- Gabriel Genellina Softlab SRL ___

Re: Default location while open an Excel file

2006-10-19 Thread Gabriel Genellina
Why don't you want to use an absolute path? It's safe, will always work... What if Excel, for whatever reason, decides to start the Open dialog pointing to another location? What if your script does not have permission to write on such location? -- Gabr

Re: Decorators and how they relate to Python - A little insight please!

2006-10-19 Thread Gabriel Genellina
At Friday 20/10/2006 02:38, [EMAIL PROTECTED] wrote: it's handy for doing things like validation of parameter and return types. Like... @accepts(int,int) @returns(int) def add(a,b): return a+b So, it's handy for converting Python into another language :) -- Gabriel Genelli

Re: Using Python scripts in Windows Explorer

2006-10-20 Thread Gabriel Genellina
ppear in the Send To menu after the usual steps are taken to get it there. Same here: put a shortcut to the script on your SendTo folder (wherever it resides) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, ant

Re: why does this unpacking work

2006-10-20 Thread Gabriel Genellina
whatever" The other concept involved is unpacking: >>> w = (1,2,3) >>> x,y,z = w >>> x 1 When you say "for x,y in t:" there is an implicit unpacking, it means "for each element contained in t, unpack it into x and y and do whatever" What seems

Re: doctest and exposing internals.

2006-10-20 Thread Gabriel Genellina
? - what you have done - modify the interfase to allow that kind of checking - use a standard unit test -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta

Re: why does this unpacking work

2006-10-20 Thread Gabriel Genellina
uivalent. The left part of a for statement is like an assignment. With this in mind, it's not surprise that for (x,y) in t: pass for x,y in t: pass are exactly the same. <http://docs.python.org/ref/exprlists.html> <http://docs.python.

Re: Why can't you pickle instancemethods?

2006-10-20 Thread Gabriel Genellina
ch reference using im_self and im_func.func_name For instance methods use im_class and im_func.func_name Then define your own __getstate__ and __setstate__. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes,

Re: Inheriting property functions

2006-10-20 Thread Gabriel Genellina
Use instead: b = property(A.get_a, A.set_a) -- 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: Python Source

2006-10-21 Thread Gabriel Genellina
please let me know how to begin. If its not then pardon me. Python is free software - you can read, study, and modify it to your own taste (as far as you respect the license). Start at http://www.python.org -- Gabriel Genellina Softlab SRL

Re: multythreading app memory consumption

2006-10-23 Thread Gabriel Genellina
le. On the next turn the variable is Consider using asyncore or the Twisted framework instead of threads. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta

Re: Using Python scripts in Windows Explorer

2006-10-23 Thread Gabriel Genellina
erever it resides) That is what I meant by 'the usual steps'. :) It doesn't work. Same as above! I think you should ask on a Windows newsgroup. -- 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: Getting a lot of SPAM from this list

2006-10-23 Thread Gabriel Genellina
another one. -- 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: python class instantiation

2006-10-23 Thread Gabriel Genellina
5. And <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://mail.python.or

Re: Trouble with property

2006-10-23 Thread Gabriel Genellina
_size, _set_linear_size ) By adding some logging I found out that _set_linear_size never is called, so the rectangle remains the default size forever. You must use a new-style class for properties to work. That is: class ConstrainedBox(object): -- Gabriel Genellina Softla

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

2006-10-23 Thread Gabriel Genellina
o version 1.1.6 - and I presume you're using 1.1.5. (And please, don't top post...!) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - htt

Re: Sorting by item_in_another_list

2006-10-24 Thread Gabriel Genellina
At Tuesday 24/10/2006 04:35, Cameron Walsh wrote: > c = set(B) > a.sort(key=c.__contains__, reverse=True) > > Tim Delaney Depressingly simple. I like it. ...and fast! -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espaci

Re: How to find out the directory that the py file is in?

2006-10-24 Thread Gabriel Genellina
atter what the working directory is. print os.path.abspath(__file__) -- 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.

Re: Want to reduce steps of an operation with dictionaries

2006-10-24 Thread Gabriel Genellina
ou correctly - or maybe you're confusing yourself. If you're going to "re-sequence" the values, the original values are not relevant at all; so maybe you need a list instead of a dict. Perhaps this is what you want (something like swapping keys<->values): a = ['a&#x

Re: win32com problem

2006-10-24 Thread Gabriel Genellina
At Tuesday 24/10/2006 22:15, [EMAIL PROTECTED] wrote: Set Tet = Synergy.StudyDoc.GetFirstTet() tet = Synergy.StudyDoc.GetFirstTet Can you see the difference...? -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus

Re: win32com problem

2006-10-24 Thread Gabriel Genellina
om or the 3rd party app? Run it on the debugger step by step, and inspect all the intermediate objects. Synergy.StudyDoc might be a function, by example, so you should add another pair of (). This is not obvious looking at the VB code. -- Gabriel Genellin

Re:

2006-10-24 Thread Gabriel Genellina
all a Python function which in turn updates the progress bar (and keep it simple!) -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.c

Re: ZODB for inverted index?

2006-10-25 Thread Gabriel Genellina
At Wednesday 25/10/2006 03:54, [EMAIL PROTECTED] wrote: anyway can someone help me on how to "rewrite" and "reload" a class instance when using ZODB ? What do you mean? -- Gabriel Genellina Softlab SRL __ Correo Yahoo

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

2006-10-25 Thread Gabriel Genellina
me, that there is absolutely no way to do that. Maybe there is, maybe there is not. Thats why I am posting it here! "A man who wears a hat without buying a ticket cannot enter the theatre" You wear a hat, you want to enter: either buy your ticket or forget about your hat. In this case,

Re: Using classes in python

2006-10-25 Thread Gabriel Genellina
h instance? Notice that you were using a *list* here, not a *dictionary* -- 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: Dealing with multiple sets

2006-10-25 Thread Gabriel Genellina
above example) a & b & c & is the intersection operator. > 2) Give me a list of the items that are not in all of the sets? (1,2 in > the above example) (a | b | c) - (a & b & c) (take the union of all items) except (the ones that are simultaneously in all sets)

Re: What's the best IDE?

2006-10-25 Thread Gabriel Genellina
python.org/moin/PythonEditors Or use Google Groups to search this group for "best IDE" - once a month someone comes and ask that same question again and again so you'll find plenty of responses... -- Gabriel Genellina Softlab SRL __ Correo

Re: Fatal Python error: deallocating None

2006-10-25 Thread Gabriel Genellina
ne were returned in certain functions to indicate failure or something exceptional - and not a regular condition - that would explain that it doesn't fail very often. Unfortunately I don't know how to debug this - except by carefully

Re: question about True values

2006-10-25 Thread Gabriel Genellina
lse". >> > > And today's question for the novices is: which Python type did Skip miss > from the above list? more that one: 0L decimal.Decimal(0) # is decimal.Decimal('0'), also u'' array.array('c') # or any other typecode, I suspect, without initial

Re: conditional computation

2006-10-26 Thread Gabriel Genellina
=cache.get(_) or cache.setdefault(_,expensive-calc-expr) Any ideas? The memoize pattern can help; in http://wiki.python.org/moin/PythonDecoratorLibrary you can see an implementation using decorators. -- Gabriel Genellina Softlab SRL __ Correo

Re: question about True values

2006-10-26 Thread Gabriel Genellina
At Wednesday 25/10/2006 23:29, Paul Rubin wrote: Steve Holden <[EMAIL PROTECTED]> writes: > Gabriel Genellina wrote: > > iter(()) I get that iter(()) is True (Python 2.3.4). It's False on 2.4.2 - and perhaps it's what one would expect, but since this behavior is not

Re: my first software

2006-10-26 Thread Gabriel Genellina
At Thursday 26/10/2006 09:39, [EMAIL PROTECTED] wrote: def openfile(): global mark global step global done global interator global mainname global beensaved Too many globals for my taste... -- Gabriel Genellina Softlab SRL

Re: question about True values

2006-10-26 Thread Gabriel Genellina
At Thursday 26/10/2006 19:57, Ben Finney wrote: Gabriel Genellina <[EMAIL PROTECTED]> writes: > At Wednesday 25/10/2006 23:29, Paul Rubin wrote: > >Steve Holden <[EMAIL PROTECTED]> writes: > >I get that iter(()) is True (Python 2.3.4). > > It's False on 2

Re: Sentinel values for special cases

2006-10-27 Thread Gabriel Genellina
x': 1} >>> b = A() >>> b.x >>> vars(b) {} >>> >>> from cPickle import loads,dumps >>> s=dumps(b) >>> b2=loads(s) >>> b2.x >>> vars(b2) {} -- Gabriel Genellina Softlab SRL __

Re: Optional Parameter Requirements

2006-10-27 Thread Gabriel Genellina
def myfunc(a, b, *tup): ... and be done with it? Just try and see if it works. http://docs.python.org/tut/node6.html#SECTION00673 -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus

Re: Cards deck problem

2006-10-27 Thread Gabriel Genellina
e card from the deck. > cardsLeft(self) - Returns the number of cards left in the deck. -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yaho

Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-27 Thread Gabriel Genellina
e this is risky so you must trust the plugin developers...) -- 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.pyt

Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-27 Thread Gabriel Genellina
mport finds the module there, it's not reloaded from disk. See <http://docs.python.org/ref/import.html> -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu c

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