Re: Draw rectangle on a Window DC

2007-01-04 Thread Gabriel Genellina
y>from win32gui import Rectangle py>Rectangle(hdc, 100,100, 300,300) py>ReleaseDC(hdc,0) 0 py> You should see a white square on your screen. -- Gabriel Genellina Softlab SRL __ Preguntá. Respond

Re: bug in copy.deepcopy or in getattr or in my understanding?

2007-01-04 Thread Gabriel Genellina
a, name) You *know* your bases because you wrote them in the class statement (or use super() instead of playing with __bases__); and getattr works fine here so you don't need to mess with the __dict__ details. (Note that #1

Re: subclassing a module: misleading(?) error message

2007-01-04 Thread Gabriel Genellina
ningful error: Traceback (most recent call last): File "", line 1, in ? TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given) -- Gabriel Genellina Softlab SRL ___

Re: clarification on open file modes

2007-01-04 Thread Gabriel Genellina
ystems where it doesn't matter, and it's the right way on systems where it does. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas,

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Gabriel Genellina
your class is supposed to be used). -- 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: checking one's type

2007-01-05 Thread Gabriel Genellina
At Friday 5/1/2007 05:40, belinda thom wrote: I've been using the following hack to determine if a type is acceptable and I suspect there is a better way to do it: This has been discussed today under the thread "Set type?", and a few days ago as "type classobj not def

Re: Memoization in Python

2007-01-05 Thread Gabriel Genellina
e like the original. -- 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: Calculating Download Rate

2007-01-05 Thread Gabriel Genellina
current time again and the working out the difference) this would give me duration that it took to retrieve the web-page, not the download rate? Then, the download rate in bytes/sec would be (size of page in bytes)/(time elapsed in seconds) -- Gabriel Genellina Softlab SRL

Re: CPU management

2007-01-05 Thread Gabriel Genellina
;m running Python2.4 on Windows XP. Call the function SetPriorityClass; documentation is on msdn.microsoft.com -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y

Re: bug in copy.deepcopy or in getattr or in my understanding?

2007-01-05 Thread Gabriel Genellina
copy b2 = copy.deepcopy(b) assert b2.something=='something' b2.foo(123) b2.x(123) === cut === -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber

Re: where is Microsoft Speech Object Library 5.1 option in PythonWin 2.5?

2007-01-05 Thread Gabriel Genellina
5.1 is the lowest SDK version I found on http://www.microsoft.com/downloads/details.aspx?FamilyId=5E86EC97-40A7-453F-B0EE-6583171B4530&displaylang=en#QuickInfoContainer After you download and install version 5.1, it should appear on the list. -- Gabriel Genelli

Re: strange for loop construct

2007-01-05 Thread Gabriel Genellina
quot; and is roughly equivalent to your code. Section 5 of the tutorial covers them. http://docs.python.org/tut/node7.html -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que quería

Re: still struggling, howto use a list-element as a name ? Sory, hit send button to early

2007-01-07 Thread Gabriel Genellina
an, values. py> value = True py> negvalue = ~value py> if negvalue: print "oops!" ... oops! py> bool(negvalue) True If you want to express the condition "The led is ON when the value of Anode is > 0 and the value of Cathode is < 0" that would be self.On = self.An

Re: strange for loop construct

2007-01-07 Thread Gabriel Genellina
as well as the rationale behind them. Where do you find the "What's new" for previous releases? I have to read them online. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Just Getting Started with Python on MS XP Pro

2007-01-07 Thread Gabriel Genellina
ed* PythonWin in order to use Python on Windows. The standard Python distribution works fine. Even includes a Python editor (IDLE) but you can use whichever editor you like to write your code (even Notepad...) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended way to force a thread context switch?

2007-01-07 Thread Gabriel Genellina
e, deep in an unknown function, the original coder changed the process priority - with no valid reason, and in any case, that should be an application-level setting. It was hard to find why, after doing such and such things, the system responsiveness were so slow. -- Gabriel Genellina -- http://ma

Re: find a .py path

2007-01-07 Thread Gabriel Genellina
nd sys.argv[1] the first argument after the script, and so on. It doesn't matter if you call python implicitely, or with other options. Try this: /usr/bin/python -i -u -O prog.py -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: A problem in embedding Python in a plug-in

2007-01-07 Thread Gabriel Genellina
now when Py_Initialize() and Given all those constraints, I think the only safe option is to run Python in another process. You write a very simple plugin (NOT in Python, maybe C code) that spawns another process (the actual Python code) and forwards all requests to that other process, using so

Re: urlib.quote gives KeyError in Python 2.4.4 but workin 2.3.5

2007-01-07 Thread Gabriel Genellina
On 7 ene, 15:48, "nyenyec" <[EMAIL PROTECTED]> wrote: > urllib.quote chokes on unicode in 2.4.4. >>> urllib.quote(u"\xe9") > KeyError: u'\xe9' > > but it seems to work in Python 2.3.5 > > Is this a known bug? See some recent

Re: Just Getting Started with Python on MS XP Pro

2007-01-07 Thread Gabriel Genellina
ined, then I'll go to the > default editor built into python-2.5.msi. It *does* work for me. Try https://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Traceback of hanged process

2007-01-07 Thread Gabriel Genellina
r > implemented in Python, so I need some analog of 'gdb attach' for C. On Windows, Pythonwin has an option "Break into running code". Try starting the script with python -i, and send it a signal.. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: strange for loop construct

2007-01-07 Thread Gabriel Genellina
On 7 ene, 16:34, [EMAIL PROTECTED] wrote: > Gabriel> Where do you find the "What's new" for previous releases? I > Gabriel> have to read them online. > > Google for > > what's new site:python.org That's what I do. But this post: >

Re: Capturing stderr and stdout of a subprocess as a single stream

2007-01-07 Thread Gabriel Genellina
wo threads to read from stdout and stderr to avoid a potential deadlock; they can put read lines into a Queue, and DisplayOutput just get these lines in order. (See the warnings in the popen2 module documentation). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-07 Thread Gabriel Genellina
effect in the same block. This, and the explicit self, make very clear which x you are referring to. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Capturing stderr and stdout of a subprocess as a single stream

2007-01-07 Thread Gabriel Genellina
yncronize both reading threads and the display thread using semaphores by hand.) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: strange for loop construct

2007-01-07 Thread Gabriel Genellina
ater ones, it's on http://www.python.org/download/releases/2.5/NEWS.txt (replacing 2.5 as desired) You can use google with site:www.python.org (or the Search box in the Python web) to locate them. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: AES256 in PyCrypto

2007-01-08 Thread Gabriel Genellina
r simply "help" (without quotes) in the interpreter. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuest

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread Gabriel Genellina
example, you have some files to be processed: for fname in filenames: do_something_with(fname) ==> for fname in filenames: try: do_something_with(fname) except StandardError, E: log_error(E) -- Gabriel Genellina Softlab

Re: multi-threaded webcam with SimpleAsyncHTTPServer.py

2007-01-08 Thread Gabriel Genellina
lower 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! http://www.yahoo.com.ar

Re: popen, Pipes with programs that expect user input

2007-01-08 Thread Gabriel Genellina
use up to three separate threads for processing stdin, stdout, stderr. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo!

Re: More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread Gabriel Genellina
in patterns: if fnmatch.fnmatch(some_file_name, p): return True ...is there a built-in function that will match using multiple patterns? matched = any(fnmatch(filename, p) for p in patterns) -- Gabriel G

Re: More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread Gabriel Genellina
c. I'll file a bug report. -- 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: Fwd: Execute binary code

2007-01-08 Thread Gabriel Genellina
ersions... Or search for a rootkit... -- 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://ww

Re: Maths error

2007-01-08 Thread Gabriel Genellina
recent thread "bizarre floating point output". And the last section on the Python Tutorial "Floating Point Arithmetic: Issues and Limitations" -- Gabriel Genellina Softlab SRL __ Preg

Re: Network failure when using urllib2

2007-01-08 Thread Gabriel Genellina
t -an from the command line and see how many open connections you have. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en

Re: Non-blocking pipes during subprocess handling

2007-01-08 Thread Gabriel Genellina
oing this: Using a thread for each stream is the safest way, specially if you can't control the child process. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías sabe

Re: Adding functions to classes after definition

2007-01-08 Thread Gabriel Genellina
a regular (types.FunctionType) function? Yes, that's what actually happens. It's not easy to *retrieve* it later without getting a MethodType. Any references that discuss these issues would be greatly appreciated. Descriptors are documented somewhere... I think they came in Pyth

Re: private variables

2007-01-09 Thread Gabriel Genellina
tting stung b/c I see both sides and have no preference for one vs. the other. 1.5, but I doubt anyone is still using a version earlier than 1.52 anymore. -- Gabriel Genellina Softlab SRL __ Preguntá. Res

Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
I have a module that defines a variable with a constant value and now I need to make that value dynamic, without affecting module clients. In other words, I need to call a function witout using parenthesis. Example: mymod.py-- def value(): return "hi" client.py---

Re: Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
There are modules (like os) that define some stuff that depends on the platform (for example linesep). This platform dependent constants gets their values assigned when the module gets loaded, but in our application, different threads might run on different computers (by proxying syscalls).. and we

Re: Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
Your post didn't provide any help at all, it was a useless sarcastic post and I'm a very sensible person. -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
Tim and Carsten, Thank you very much for your replies. I'm afraid this is not going to work for me (but I'm not 100% sure), coz if I access those modules from the Python's C API (PyModule_* functions), the PyModule_Check() calls will fail. Thanks again. -- http://mail.python.org/mailman/listinfo/

warning for google api users

2006-02-21 Thread Gabriel B.
ocess to import the index and or it explode in some point or they simply kill it after some time). and they obviously don't run that process very often. Now... anyone has some implementation of pygoogle.py that scraps the regular html service instead of using SOAP? :) Gabriel B. -- http://mai

Re: How to send an email with non-ascii characters in Python

2006-02-25 Thread Gabriel B.
2006/2/25, Sybren Stuvel <[EMAIL PROTECTED]>: > Lad enlightened us with: > > Body='Rídících Márinka a Školák Kája > > Marík'.decode('utf8').encode('windows-1250')# I use the text written > > in my editor with utf-8 coding, so first I decode and then encode to > > windows-1250 what does a string be

scope acting weird

2005-05-01 Thread Gabriel B.
isn't Tk supposed to be imported globaly? And If i import Tkinter again inside every other file, will it be really imported several times and be independent in each file or the python interpreter just use the subsequent imports to know where to propagate stuff? Thanks, Gabriel -- http://mail.py

Re: Standalone HTTP parser?

2007-05-31 Thread Gabriel Genellina
sage class to generate and parse HTTP headers. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: c[:]()

2007-06-01 Thread Gabriel Genellina
item() ... py> def a(): print "a" ... py> def b(): return 4 ... py> def c(): pass ... py> def d(): ... global z ... z = 1 ... py> z="A" py> x = CallableList([a,b,c,d]) py> x() a py> z 1 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Observer-Pattern by (simple) decorator

2007-06-01 Thread Gabriel Genellina
It took me quite some time understanding what the __get__ method does, > but I think now I figured it out. I've made a quantum leap in my > understanding of Python (esp. method binding) with this! Awesome! To proceed to next energy level, read some articles from http://www.python.org/doc/news

Check for descriptors (in C)

2007-06-03 Thread Gabriel Genellina
that they should not be tested that way? My actual use case: I want to check if an object (instance of a class that inherits from file) still uses the original write method or has overriden it. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: can this be implemented?

2007-06-03 Thread Gabriel Genellina
name = raw_input("Your name? ") print "Hello,", name raw_input is a built-in function, see http://docs.python.org/lib/built-in-funcs.html#l2h-59 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange behavior in Windows

2007-06-04 Thread Gabriel Genellina
inside IDLE and the console. Python versions earlier than 2.3 did not have a distutils.log module. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Jun 4)

2007-06-04 Thread Gabriel Genellina
QOTW: "Stop thinking of three lines as 'extensive coding' and your problem disappears immediately." - Steve Holden "Hey, did you hear about the object-oriented version of COBOL? They call it 'ADD ONE TO COBOL'." - Tim Roberts EuroPython: Registration is open! http://www.europyth

Re: get_traceback

2007-06-04 Thread Gabriel Genellina
; f = tempfile.TemporaryFile(mode='w+') > sys.stdout = f > traceback.print_tb(sys.exc_info()[2]) In this case you can use StringIO instead of a temporary file, and the file argument to print_tb instead of swapping sys.stdout -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Check for descriptors (in C)

2007-06-04 Thread Gabriel Genellina
identity between type(o).write and file.write -- seems a > more direct expression of that thought (and implementable with the C-API > just as well as with pure Python). Thanks! It looks obvious now :) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python in C

2007-06-04 Thread Gabriel Genellina
it,still single) argument. Yes, it appears that you are building a plain list but your code is expecting another kind of object. I'm unfamiliar with Numeric arrays, if that is what you need; perhaps someone else can help, or ask again in a Numeric-specific list. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: how to print out each single char from a string in HEX format?

2007-06-04 Thread Gabriel Genellina
p://docs.python.org/lib/built-in-funcs.html#l2h-55> for the ord() function and <http://docs.python.org/lib/typesseq-strings.html> for the "%#x" format -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: get_traceback

2007-06-05 Thread Gabriel Genellina
En Mon, 04 Jun 2007 23:03:04 -0300, <[EMAIL PROTECTED]> escribió: > Thanks Gabriel. That was exactly what I was looking for. Also, I'm > glad to make a connection to the StringIO class. I'm sure I will > remember it the next time I need it. Glad to see it helped. Cer

Re: Embedding Python in C

2007-06-05 Thread Gabriel Genellina
En Tue, 05 Jun 2007 03:41:19 -0300, <[EMAIL PROTECTED]> escribió: > On 5 Jun., 01:32, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> Yes, it appears that you are building a plain list but your code is >> expecting another kind of object. I'm unfamili

Re: Strange errors on exit

2007-06-05 Thread Gabriel Genellina
exceptions.TypeError: exceptions must be classes, instances, or strings > (deprecated), not NoneType > Unhandled exception in thread started by > Error in sys.excepthook: > > Original exception was: Looks similar to this reported bug: http://sourceforge.net/tracker/index.php?func=deta

Re: creating lists based on parsed items

2007-06-06 Thread Gabriel Genellina
ach item, do: d.setdefault(bucket, []).append(item) If you are using Python 2.5, use a defaultdict instead, the very first example looks like what you want. <http://docs.python.org/lib/defaultdict-objects.html> -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib error- Large file

2007-06-06 Thread Gabriel Genellina
failure - it's just more likely to happen on a big file. The REST ftp command is used to restart the transfer from a certain offset. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2.urlopen broken?

2007-06-06 Thread Gabriel Genellina
En Wed, 06 Jun 2007 16:20:09 -0300, Mike Meyer <[EMAIL PROTECTED]> escribió: > In 2.5.1 (and 2.[45], but not 2.3): Care to tell some details? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: TLSAbruptCloseError

2007-06-07 Thread Gabriel Genellina
'Too > few bytes from client. Expected ' + str(num) + '; got ' + str(len(data)), > num, len(data)) > > return data Without much analysis, shouldn't be: data += conn.recv(num - len(data)) or something like that? Else you are discarding the previously received data. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: recursion error using setattr and getattr

2007-06-07 Thread Gabriel Genellina
tattr/getattr, use a property, and you'll get much cleaner code. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: read xml file from compressed file using gzip

2007-06-08 Thread Gabriel Genellina
En Fri, 08 Jun 2007 10:00:58 -0300, flebber <[EMAIL PROTECTED]> escribió: >> I will, baby steps at the moment for me at the moment though as I am >> only learning and can't get gzip to work Try reading some tutorial from http://wiki.python.org/moin/BeginnersGuide

Re: Dealing with dictionary like strings

2007-06-08 Thread Gabriel Genellina
tionary .I'm only interested in the value field of > torrents key which again is a list of lists. See this Cookbook recipe: safe eval http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-08 Thread Gabriel Genellina
rthogonal coordinates and Newton's laws to solve it - the "obvious" way would be to use spherical coordinates and the Lagrangian formulation (or at least I hope so - surely knowledgeable people will find more "obviously" which is the right way). All classical mechanic

Re: Repository - file scanner

2007-06-09 Thread Gabriel Genellina
t; C.) a Python repository, as in the SVN/CVS area? D.) The Python Package Index perhaps? http://www.python.org/pypi -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get existing frames in non-current thread?

2007-06-09 Thread Gabriel Genellina
x27; call stacks are frozen for as long as they remain deadlocked. The frame returned for a non-deadlocked thread may bear no relationship to that thread's current activity by the time calling code examines the frame. This function should be used for internal and specialized purposes on

Re: Are there any python jobs worked at home from the internet?

2007-06-09 Thread Gabriel Genellina
En Sat, 09 Jun 2007 22:53:08 -0300, boyeestudio <[EMAIL PROTECTED]> escribió: > Are there any python jobs worked at home from the internet? > I want to find a part time job. > Please give a clue to this for me. I know of http://www.rentacoder.com/ but I've never actually u

Re: urllib2 - iteration over non-sequence

2007-06-09 Thread Gabriel Genellina
ry anyway. Python 2.2 (the version that the OP is using) did include a xreadlines module (now defunct) but on this case it is painfully slow - perhaps it tries to read the source one character at a time. So the best way would be to use (as Paul Rubin already said): for line

Re: How to get existing frames in non-current thread?

2007-06-10 Thread Gabriel Genellina
En Sun, 10 Jun 2007 09:17:21 -0300, Fabio Zadrozny <[EMAIL PROTECTED]> escribió: > On 6/10/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> >> En Sat, 09 Jun 2007 21:40:40 -0300, Fabio Zadrozny <[EMAIL PROTECTED]> >> escribió: >> >> >

Re: Dynamic subclassing ?

2007-06-10 Thread Gabriel Genellina
a different class name (altough it may be confusing...): py> f = type("Foo", (Foo,Bar), {})() py> f.bar() 'bar' > This "new" module seems to be the key to it all; It's almost useless now that types are callable. > but the only docs I have for that say: > >>>> help(new) > Help on module new: > [...] > MODULE DOCS > http://www.python.org/doc/current/lib/module-new.html Did you follow the above link? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: read 9 bytes

2007-06-10 Thread Gabriel Genellina
4) > I would get 8 bytes, Why do you think so? read(4) will read up to 4 bytes, or less if the specified timeout elapses. > Is there a trick to read 9 bytes off of a serial port? read(9) (don't forget to set the timeout) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Text

2007-06-11 Thread Gabriel Genellina
w. Escape characters should not be a problem then. Have you verified the contents of the text file? With notepad? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Jun 11)

2007-06-11 Thread Gabriel Genellina
QOTW: "That's the Martellibot for you. Never use a word where a paragraph with explanatory footnotes will do. Sigh. I miss him on c.l.py." - Simon Brunning "Conclusion: advice to 'try Python for yourself' is apt in a way the original questioner might not realize." - Cameron Laird A

Re: Accessing global namespace from module

2007-06-11 Thread Gabriel Genellina
import statements at the top of mainscript.py that are responsible for bringing AddPlot and DrawPlots into the current namespace? Import the same things in your second module. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Repository - file scanner

2007-06-11 Thread Gabriel Genellina
En Mon, 11 Jun 2007 15:46:51 -0300, Paul Rudin <[EMAIL PROTECTED]> escribió: > HMS Surprise <[EMAIL PROTECTED]> writes: >>> >>> Why not use grep? >> >> With Windows XP? > > www.cygwin.com Why? Try findstr /? at the command prompt. -- Ga

Re: REALLY need help with iterating a list.

2007-06-11 Thread Gabriel Genellina
uplicates in the original list, the new list won't have any. > also, the line "pinger = ping[server]" would have to be extracted from > this loop otherwise your going to ping the same server repeatedly > until it answers... Uh...? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Link Dictionary

2007-06-11 Thread Gabriel Genellina
x27;: '0', 'H9': '9', 'I2': '0', 'E8': '0', 'H3': '0', 'H7': '0', > 'I7': '3', 'I4': '0', 'H5': '0', 'F9': '0&#x

Re: Accessing global namespace from module

2007-06-11 Thread Gabriel Genellina
En Mon, 11 Jun 2007 17:29:35 -0300, reubendb <[EMAIL PROTECTED]> escribió: > On Jun 11, 3:30 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Mon, 11 Jun 2007 15:18:58 -0300, reubendb <[EMAIL PROTECTED]> >> escribió: >> >> &

Re: Python for embedded systems with memory constraints

2007-06-11 Thread Gabriel Genellina
atic too - there is no way to "uninitialize" them, and nothing forbids an extension to hold a reference to any object. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing global namespace from module

2007-06-11 Thread Gabriel Genellina
plotModule = module('plot') for key,value in namespace.items(): if key[:2] != '__': setattr(plotModule, key, value) sys.modules['plot'] = plotModule --- myModule.py --- import plot def do_work(): plot.DrawPlot(...) ... (Having to type

Re: Multiline lamba implementation in python.

2007-06-11 Thread Gabriel Genellina
ltiline lambdas as functions? Wouldn't that be a > win-win > for everyone? If you want to "implement multiline lambdas as functions"... why don't you use a plain old function? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Set PyObject value from C extension

2007-06-11 Thread Gabriel Genellina
o another value. But you can create *new* objects from the desired values, using PyInt_FromLong and PyFloat_FromDouble. If this is your first approach to Python, I suggest first become familiar with the language, and later try to mix it with C code. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Set timeout and kill external windows program

2007-06-11 Thread Gabriel Genellina
s using the pywin32 extensions (available from sourceforge) or the ctypes module. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with following python code

2007-06-11 Thread Gabriel Genellina
e, that gets executed whenever the loop exits normally (in this case, when divisor goes up to number, and the break statement is never executed). So you don't need is_prime: for number in range(10,100): for divisor in range(2,number): if number % divisor == 0:

Re: How can I parse False from c extension?

2007-06-12 Thread Gabriel Genellina
, "i", &nValue); > > But, how can I parse the False value? Parse them as integers, with False==0 and True==1. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating Number format problem

2007-06-12 Thread Gabriel Genellina
%1.00 > 1.00 > > I just expect it to output "1" , but these way will output 1.00 def my_formatter_ommitting_trailing_zeroes(value): result = '%.2f' % value if result[-3:]=='.00': result = result[:-3] return result for f in [1.0, 1.002, 1.12, 1.567, 2324.012]: print "%g -> %s" % (f, my_formatter_ommitting_trailing_zeroes(f)) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: for ... else ?

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 06:34:49 -0300, exhuma.twn <[EMAIL PROTECTED]> escribió: > On Jun 12, 6:57 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> for number in range(10,100): >> for divisor in range(2,number): >> if number % di

Re: Postpone creation of attributes until needed

2007-06-12 Thread Gabriel Genellina
between them. So why not just make compute() > the very last thing that __init__ does? As far as I understand what the OP said, (2) may never happen. And since (4) is expensive, it is avoided until it is actually required. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Gabriel Genellina
} > > If I changed INT64 nValue to be static INT64 nValue at LINE_HERE, it > is ok. > Why? I don't know, but I don't see either where Python is involved... you don't use any argument and the returned Python object is not an INT64... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: httplib / connection

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 09:09:12 -0300, rhXX <[EMAIL PROTECTED]> escribió: > i'm using this tutorial example Glad to see you could make it work finally. Which tutorial was that? The httplib.HTTP class that you were using is very old and deprecated for several years now. -- Gab

Re: for ... else ?

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 10:41:28 -0300, Chris Mellon <[EMAIL PROTECTED]> escribió: > On 6/12/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> for x in iterable: >>do something with x >> else: >>do something when there are no more x >> >&g

Re: file open default location

2007-06-12 Thread Gabriel Genellina
That will be the original "current directory" when the program starts; but it may be changed afterwards. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Forgetting an import

2007-06-12 Thread Gabriel Genellina
t gets worse: any previously created instances will still be instances of the *old* class. I think that there are some recipes in the Python Cookbook about this problem. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Gabriel Genellina
th all the normal definitions and #include's void test(void) { INT64 i=1; printf("%d\n", sizeof(i)); } -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting SAX results

2007-06-12 Thread Gabriel Genellina
findtext('title') ... Title1:Description Title2:Description ElementTree is infinitely more flexible and easier to use. See <http://effbot.org/zone/element-index.htm> -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing global namespace from module

2007-06-12 Thread Gabriel Genellina
ey,value in namespace.items(): >> if key[:2] != '__': >> setattr(plotModule, key, value) >> sys.modules['plot'] = plotModule >> > > Hm.. apparently this works for function but doesn't work for method :(. > Do you > know of any re

Re: Problem Inheriting from "str" Class

2007-06-12 Thread Gabriel Genellina
init__ is rather useless for immutable types. You have to override __new__ instead. See <http://docs.python.org/ref/customization.html> -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

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