Re: max(), sum(), next()

2008-09-05 Thread castironpi
On Sep 5, 9:20 pm, Manu Hack [EMAIL PROTECTED] wrote: On Fri, Sep 5, 2008 at 1:04 PM, castironpi [EMAIL PROTECTED] wrote: On Sep 5, 3:28 am, Manu Hack [EMAIL PROTECTED] wrote: On Thu, Sep 4, 2008 at 4:25 PM, castironpi [EMAIL PROTECTED] wrote: On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote

Re: Safely move an element into a heap

2008-09-04 Thread castironpi
On Sep 4, 6:57 am, Giampaolo Rodola' [EMAIL PROTECTED] wrote: On 4 Set, 13:49, Alexandru Palade [EMAIL PROTECTED] wrote: I'm not sure what you expect as an answer, but if you mean the heap as in the data structure, you can not just arbitrarily move one key where you want as it will

Re: xml + mmap cross

2008-09-04 Thread castironpi
On Sep 4, 2:14 am, Stefan Behnel [EMAIL PROTECTED] wrote: castironpi wrote: Any interest in pursuing/developing/working together on a mmaped-xml class?  Faster, not readable in text editor. Any hints on what you are talking about? Stefan Nice to hear from you. I assumed you were

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread castironpi
On Sep 4, 2:51 pm, Martin DeMello [EMAIL PROTECTED] wrote: On Sep 4, 12:41 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: task_done just decrements a counter (incremented by put).  when the counter reaches zero, the join call is unblocked. Thanks! Is there any standard python idiom to empty a

Re: max(), sum(), next()

2008-09-04 Thread castironpi
On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote: David C. Ullrich: At least in mathematics, the sum of the elements of the empty set _is_ 0, while the maximum element of the empty set is undefined. What do you think about my idea of adding that 'default' argument to the max()/min()

Re: why is self not passed to id()?

2008-09-04 Thread castironpi
On Sep 4, 3:26 pm, Ruediger [EMAIL PROTECTED] wrote: Hello! Executing following little program gives me an TypeError. What makes me wonder is that foo does get an argument passed while bar doesn't. Can anyone explain why?? Thanks Ruediger class foo(list):     __hash__ = lambda x:

Re: xml + mmap cross

2008-09-04 Thread castironpi
On Sep 4, 7:54 pm, alex23 [EMAIL PROTECTED] wrote: On Sep 4, 8:31 am, castironpi [EMAIL PROTECTED] wrote: Any interest in pursuing/developing/working together on a mmaped-xml class?  Faster, not readable in text editor. XML is text-based, so it should -always- be readable in a text editor

Re: pdb bug and questions

2008-09-04 Thread castironpi
On Sep 4, 4:22 pm, Stef Mientki [EMAIL PROTECTED] wrote: hello, I'm trying to embed a debugger into an editor. I'm only interested in high level debugging. The first question is what debugger is the best for my purpose ? (pdb, pydb, rpdb2, smart debugger, extended debugger ? Second

xml + mmap cross

2008-09-03 Thread castironpi
Any interest in pursuing/developing/working together on a mmaped-xml class? Faster, not readable in text editor. -- http://mail.python.org/mailman/listinfo/python-list

Re: max(), sum(), next()

2008-09-03 Thread castironpi
On Sep 3, 7:48 am, [EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that [] may be an empty sequence of someobject: sum(s for s in [a, b] if len(s) 2) 0 In a statically typed language in that

rope class (heavyweight string)

2008-09-02 Thread castironpi
Does anyone want to talk about a Rope implementation in Python? It doesn't get faster than the native strings until about 2 megs. P.S. Didn't your momma ever tell you not to talk on newsgroups? -- http://mail.python.org/mailman/listinfo/python-list

Re: Native Code vs. Python code for modules

2008-08-31 Thread castironpi
On Jul 29, 10:56 pm, koblas [EMAIL PROTECTED] wrote: To that end why would somebody write big try catch blocks to see if modules exist and if they exist alias their names.  Wouldn't it be better if there was a way that if I have an interface compatible native (aka C) module that has better

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread castironpi
On Aug 29, 12:29 am, W. eWatson [EMAIL PROTECTED] wrote: castironpi wrote: This gets you your list.  What do you mean by 'missing member of (a.dat, a.txt) is a pair. (None, a.txt) has a.dat missing. I just need to issue a msg to the user that one member of a file pair is missing. Both

Re: Identifying the start of good data in a list

2008-08-29 Thread castironpi
On Aug 29, 9:43 am, Jorgen Grahn [EMAIL PROTECTED] wrote: On 27 Aug 2008 15:50:14 GMT, Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 26 Aug 2008 17:04:19 -0700, tdmj wrote: On Aug 26, 5:49 pm, [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread castironpi
On Aug 29, 1:51 pm, Fett [EMAIL PROTECTED] wrote: Your way of thinking is similar to Microsoft's. Encrypting and Signing is a kludge, a real fix should fix the underlying cause. Anyway using data parsers isn't that much harder than using eval/exec. While I agree that in this situation I

Re: struct.Struct random access

2008-08-29 Thread castironpi
On Aug 29, 10:30 pm, Tim Roberts [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: CMIIW correct me if I'm wrong, I don't think that pack_into returns a value the way that pack does. Sorry, I was not aware that struct.pack_into and struct.unpack_from already existed (they were

Re: calling NetShareEnum win32api with ctypes

2008-08-28 Thread castironpi
On Aug 28, 12:01 am, taghi [EMAIL PROTECTED] wrote: I want to call NetShareEnum, a function from netapi32.dll NetShareEnum has this definition: NET_API_STATUS NetShareEnum(   __in     LPWSTR servername,   __in     DWORD level,   __out    LPBYTE *bufptr,   __in     DWORD prefmaxlen,  

Re: Identifying the start of good data in a list

2008-08-28 Thread castironpi
On Aug 27, 3:42 pm, George Sakkis [EMAIL PROTECTED] wrote: Below are two more versions that pass all the doctests: the first works only for lists and modifies them in place and the second works for arbitrary iterables: def clean_inplace(seq, good_ones=4):     start = 0     n = len(seq)    

Re: struct.Struct random access

2008-08-28 Thread castironpi
On Aug 28, 1:59 am, Tim Roberts [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: I'd like to seriously nominate this idea and get a considered opinion on it. struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer

Re: Problem with list.insert

2008-08-28 Thread castironpi
On Aug 28, 11:13 am, SUBHABRATA [EMAIL PROTECTED] wrote: Dear Group, I wrote one program, There is a dictionary. There is an input string. Every word of input string the word is matched against the dictionary If the word of input string is matched against the dictionary it gives the word of

Re: Negative regular expressions (searching for i not inside command)

2008-08-28 Thread castironpi
On Aug 28, 4:04 pm, Guilherme Polo [EMAIL PROTECTED] wrote: On Thu, Aug 28, 2008 at 5:04 PM, Bart Kastermans [EMAIL PROTECTED] wrote: I have a file in which I am searching for the letter i (actually a bit more general than that, arbitrary regular expressions could occur) as long as it

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread castironpi
On Aug 28, 4:51 pm, Fett [EMAIL PROTECTED] wrote: I am creating a program that requires some data that must be kept up to date. What I plan is to put this data up on a web-site then have the program periodically pull the data off the web-site. My problem is that when I pull the data

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread castironpi
On Aug 28, 10:50 pm, W. eWatson [EMAIL PROTECTED] wrote: Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with push and pop. I'm just checking to see if there's not some known simple single function that does what I want. Here's what I'm

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread castironpi
On Aug 28, 1:09 am, inorlando [EMAIL PROTECTED] wrote: Hi all, I have a question about python and sockets , UDP datagram in particular. I'm new to socket programming so please bare with me. I am trying to write a simple application that broadcast files to another computer on the same

Re: Python multimap

2008-08-27 Thread castironpi
On Aug 27, 12:52 pm, brad [EMAIL PROTECTED] wrote: Mike Kent wrote: Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. k = {} k['1'] = [] k['1'].append('Tom')

Re: Python multimap

2008-08-27 Thread castironpi
On Aug 27, 1:38 pm, brad [EMAIL PROTECTED] wrote: castironpi wrote: I don't understand what a multimap does that a map of lists doesn't do. It counts both keys individually as separate keys. The Python workaround does not... see examples... notice the key(s) that are '4' Python output

Re: Identifying the start of good data in a list

2008-08-27 Thread castironpi
On Aug 27, 4:34 pm, [EMAIL PROTECTED] wrote: George Sakkis: This seems the most efficient so far for arbitrary iterables. This one probably scores well with Psyco ;-) def start_good3(seq, good_ones=4):     n_good = 0     pos = 0     for el in seq:         if el:             if n_good

Re: Identifying the start of good data in a list

2008-08-27 Thread castironpi
On Aug 27, 6:14 pm, George Sakkis [EMAIL PROTECTED] wrote: On Aug 27, 5:48 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 27, 4:34 pm, [EMAIL PROTECTED] wrote: George Sakkis: This seems the most efficient so far for arbitrary iterables. This one probably scores well with Psyco

struct.Struct random access

2008-08-26 Thread castironpi
I'd like to seriously nominate this idea and get a considered opinion on it. struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write the structure. What do you think of random access to the

Re: Return a string result with out breaking loop

2008-08-26 Thread castironpi
On Aug 26, 11:46 am, Andrew [EMAIL PROTECTED] wrote: ...          results = change_handle          for action, files in results:              full_filename = os.path.join(path_to_watch, files)              theact = ACTIONS.get(action, Unknown)              out2 = str(full_filename) +   +

Re: Struct class random access

2008-08-26 Thread castironpi
On Aug 26, 12:41 am, castironpi [EMAIL PROTECTED] wrote: On Aug 25, 11:47 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 14:49:14 -0700, castironpi wrote: I'm interested in the speed benefit, so you don't have to reconstruct the entire 'record' just to read

Re: ctypes: loading .so file on Linux

2008-08-26 Thread castironpi
On Aug 27, 12:03 am, Paddy [EMAIL PROTECTED] wrote: On Aug 23, 2:33 pm, Paddy [EMAIL PROTECTED] wrote: Hi, I am am falling at the first hurdle when trying to access a library using ctypes. I have a file libucdb.so which the file command says is shared object, but I cannot get it to

Re: Private attribute

2008-08-25 Thread castironpi
On Aug 25, 2:09 pm, Ken Starks [EMAIL PROTECTED] wrote: Ken Starks wrote: I have a class with an attribute called 'gridsize' and I want a derived class to force and keep it at 0.8 (representing 8mm). Is this a correct, or the most pythonic approach?     def

Struct class random access

2008-08-25 Thread castironpi
struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write the structure. What do you think of random access for the results? (unproduced) packer= struct.Struct( 'IIIf255p' ) packer.pack_into(

Re: Struct class random access

2008-08-25 Thread castironpi
On Aug 25, 4:25 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 13:03:09 -0700, castironpi wrote: struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write

Re: Struct class random access

2008-08-25 Thread castironpi
On Aug 25, 4:49 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 25, 4:25 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 13:03:09 -0700, castironpi wrote: struct.Struct lets you encode Python objects into structured memory. It accepts a format string

Re: Return a string result with out breaking loop

2008-08-25 Thread castironpi
On Aug 25, 6:37 pm, Andrew [EMAIL PROTECTED] wrote: Hi I was wondering if there is anyway with XML RPC to send a string of text from the server to the client with out calling return thus breaking   my loop for example   def somefunc():        for action, files in results:                

Re: Struct class random access

2008-08-25 Thread castironpi
On Aug 25, 11:47 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 14:49:14 -0700, castironpi wrote: I'm interested in the speed benefit, so you don't have to reconstruct the entire 'record' just to read/write one 'field'.  How in ctypes? Only the field accessed

Re: property() usage - is this as good as it gets?

2008-08-24 Thread castironpi
On Aug 24, 5:00 am, alex23 [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: and we'll write Python. I haven't seen anything you've contributed to this group that would so far be considered well-written Python. Confusing and border-line insane, yes. Pythonic? Not at all

Re: What is class method?

2008-08-24 Thread castironpi
On Aug 24, 3:35 am, MeTheGameMakingGuy [EMAIL PROTECTED] wrote: On Aug 24, 6:32 pm, Hussein B [EMAIL PROTECTED] wrote: Hi, I'm familiar with static method concept, but what is the class method? how it does differ from static method? when to use it? -- class M:  def method(cls, x):  

Re: Best way to set/get an object property

2008-08-24 Thread castironpi
On Aug 24, 5:07 am, Hussein B [EMAIL PROTECTED] wrote: Hey, I noted that Python encourage the usage of: -- obj.prop = data x = obj.prop -- to set/get an object's property value. What if I want to run some logic upon setting/getting a property? What is Python preferred method to do so

Re: ctypes initializer

2008-08-24 Thread castironpi
On Aug 23, 7:11 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 23, 6:43 pm, [EMAIL PROTECTED] wrote: castironpi napisa³(a): Is there a way to initialize a ctypes Structure to point to an offset into a buffer? I don't know if the way I'm doing it is supported. There is a high

Re: recursively change values in list of lists

2008-08-24 Thread castironpi
On Aug 24, 9:17 am, Carson Farmer [EMAIL PROTECTED] wrote: Dear list, I'm sure this is a relatively trivial problem, but I have been unable to find any good examples/explanations on how to do this, so here goes: I have multi-polygon object, which is simply a list of polygons, where each

Re: In-place memory manager, mmap (was: Fastest way to store ints and floats on disk)

2008-08-24 Thread castironpi
On Aug 24, 9:52 am, Kris Kennaway [EMAIL PROTECTED] wrote: castironpi wrote: Hi, I've got an in-place memory manager that uses a disk-backed memory- mapped buffer.  Among its possibilities are: storing variable-length strings and structures for persistence and interprocess communication

Re: In-place memory manager, mmap

2008-08-24 Thread castironpi
On Aug 24, 12:19 pm, Kris Kennaway [EMAIL PROTECTED] wrote: castironpi wrote: On Aug 24, 9:52 am, Kris Kennaway [EMAIL PROTECTED] wrote: castironpi wrote: Hi, I've got an in-place memory manager that uses a disk-backed memory- mapped buffer.  Among its possibilities are: storing

Re: property() usage - is this as good as it gets?

2008-08-24 Thread castironpi
On Aug 24, 7:43 pm, alex23 [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: Python isn't as clever as you think.  It's a language.   Yet another non-sequitur response from you. At which point in my post did I make any such claims about Python's 'cleverness'? Do you want

Re: property() usage - is this as good as it gets?

2008-08-24 Thread castironpi
On Aug 24, 10:41 pm, alex23 [EMAIL PROTECTED] wrote: On Aug 25, 12:42 pm, castironpi [EMAIL PROTECTED] wrote: I'm baffled.  I don't understand what you write.   Which is pretty much how I feel about -all- of your posts. Alright. You're articulate. I'm getting a better picture of what your

Re: Should Python raise a warning for mutable default arguments?

2008-08-23 Thread castironpi
On Aug 23, 9:40 am, Carl Banks [EMAIL PROTECTED] wrote: On Aug 23, 4:09 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 22 Aug 2008 20:37:09 -0700, Carl Banks wrote: On Aug 22, 10:42 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Sometimes

ctypes initializer

2008-08-23 Thread castironpi
Is there a way to initialize a ctypes Structure to point to an offset into a buffer? I don't know if the way I'm doing it is supported. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes initializer

2008-08-23 Thread castironpi
On Aug 23, 6:43 pm, [EMAIL PROTECTED] wrote: castironpi napisa³(a): Is there a way to initialize a ctypes Structure to point to an offset into a buffer? I don't know if the way I'm doing it is supported. There is a high probability you're abusing ctypes too much, but it's possible

Re: A variables variables

2008-08-23 Thread castironpi
On Aug 23, 7:25 pm, Gandalf [EMAIL PROTECTED] wrote: how can I declare a variable with another variable  name? for example  I will use PHP: $a= hello; $a_hello=baybay; print ${'a_'.$a)  //output: baybay how can i do it with no Arrays using  python thanks! Here's one idea. a=

Re: Should Python raise a warning for mutable default arguments?

2008-08-23 Thread castironpi
On Aug 23, 2:57 pm, Cousin Stanley [EMAIL PROTECTED] wrote: Question: what is real warning?   Don't  MAKE ME  have to tell you  AGAIN -- Stanley C. Kitching Human Being Phoenix, Arizona Two black eyes. Haa haa. My question comes from: less likely to notice if a real warning is

Re: property() usage - is this as good as it gets?

2008-08-23 Thread castironpi
On Aug 22, 11:18 am, David Moss [EMAIL PROTECTED] wrote: Hi, I want to manage and control access to several important attributes in a class and override the behaviour of some of them in various subclasses. Below is a stripped version of how I've implemented this in my current bit of work.

Re: two's complement bytes

2008-08-23 Thread castironpi
On Aug 23, 10:51 pm, Adam W. [EMAIL PROTECTED] wrote: I'm dabbling with AVR's for a project I have and that means I have to use C (ageist my will).  Because my AVR will be tethered to my laptop, I am writing most of my logic in python, in the hopes of using at little C as possible. In my

Re: two's complement bytes

2008-08-23 Thread castironpi
On Aug 23, 11:52 pm, Adam W. [EMAIL PROTECTED] wrote: On Aug 24, 12:23 am, castironpi [EMAIL PROTECTED] wrote: Try this out.  Does it come close to what you want? import struct struct.pack( 'i', ~10 ) ~struct.unpack( 'i', _ )[ 0 ] import struct struct.pack( 'i', ~10 ) '\xf5\xff

Re: property() usage - is this as good as it gets?

2008-08-22 Thread castironpi
On Aug 22, 11:18 am, David Moss [EMAIL PROTECTED] wrote: Hi, I want to manage and control access to several important attributes in a class and override the behaviour of some of them in various subclasses. Below is a stripped version of how I've implemented this in my current bit of work.

Re: Should Python raise a warning for mutable default arguments?

2008-08-22 Thread castironpi
On Aug 22, 9:42 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Sometimes it seems that barely a day goes by without some newbie, or not- so-newbie, getting confused by the behaviour of functions with mutable default arguments. No sooner does one thread finally, and painfully,

Re: pickle passing client/server design

2008-08-22 Thread castironpi
On Aug 22, 12:09 pm, DwBear75 [EMAIL PROTECTED] wrote: I am contemplating the need for a way to handle high speed data passing between two processes. One process would act as a queue that would 'buffer' data coming from another processes. Seems that the easiest way to handle the data would be

In-place memory manager, mmap (was: Fastest way to store ints and floats on disk)

2008-08-22 Thread castironpi
Hi, I've got an in-place memory manager that uses a disk-backed memory- mapped buffer. Among its possibilities are: storing variable-length strings and structures for persistence and interprocess communication with mmap. It allocates segments of a generic buffer by length and returns an offset

Re: getattr() on nested functions?

2008-08-21 Thread castironpi
On Aug 21, 10:14 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Gabriel Rossetti a écrit : Bruno Desthuilliers wrote: Gabriel Rossetti a écrit : Terry Reedy wrote: (snip) Unlike the class approach, this requires recreating the constant functions and dict with each call to

Re: mmap and ctypes

2008-08-21 Thread castironpi
On Aug 18, 1:09 am, Méta-MCI \(MVP\) [EMAIL PROTECTED] wrote: Hi! See here:  http://www.ponx.org/download/CD/COMdll/autoitmmap.dll @-salutations -- Michel Claveau I don't see how it fits in. -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorators using instance variables

2008-08-21 Thread castironpi
On Aug 21, 9:22 pm, robert2821 [EMAIL PROTECTED] wrote: Hi, I'm new; greetings all! I'm wondering if the following program should work.  I think it should print 'Hello, World', but instead it produces a TypeError.  Is this a bug in decorators, a feature of them, or a mistake or

Address-Of operator equivalent, PAVL search tree

2008-08-21 Thread castironpi
Hi, I am translating the GNU library's PAVL search tree implementation into Python. I can't use it directly because a delete function I need uses a different method of finding the node to delete. It contains this line: q = (struct pavl_node *) tree-pavl_root; line 276 in

Re: Address-Of operator equivalent, PAVL search tree

2008-08-21 Thread castironpi
On Aug 21, 11:03 pm, castironpi [EMAIL PROTECTED] wrote: Hi, I am translating the GNU library's PAVL search tree implementation into Python.  I can't use it directly because a delete function I need uses a different method of finding the node to delete. It contains this line:       q

dynamic attribute syntax

2008-08-17 Thread castironpi
Hi all, Thinking of a syntax for 'getattr' and 'setattr' dynamic access. 'obj.prop' has an easy access, but att= 'prop' getattr( obj, att ) is much clumsier, while no less useful, maybe more. What are the changes, pros and cons, involved in something like: obj:att for a dynamic access, and

Re: dynamic attribute syntax

2008-08-17 Thread castironpi
On Aug 17, 2:46 pm, Paul Boddie [EMAIL PROTECTED] wrote: On 17 Aug, 21:29, castironpi [EMAIL PROTECTED] wrote: What are the changes, pros and cons, involved in something like: obj:att for a dynamic access, and obj.att for static? A previous proposal and discussion can be found here

Re: dynamic attribute syntax

2008-08-17 Thread castironpi
On Aug 17, 3:05 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: castironpi wrote: 'obj.prop' has an easy access, but att= 'prop' getattr( obj, att ) is much clumsier, while no less useful, maybe more. maybe more?  ok, you *are* utterly and completely unable to post anything that makes any

mmap and ctypes

2008-08-16 Thread castironpi
Hi all, I have a mmap and a data structure in it. I know the structure's location in the mmap and what structure it is. It has a ctypes definition. I want to initialize a ctypes object to point to a part of the mmap. Here is my attempt: b mmap.mmap object at 0x009FEDB8 c= ctypes.pointer( b

Re: mmap and ctypes

2008-08-16 Thread castironpi
On Aug 16, 4:42 pm, Michel Claveau - NoSpam SVP ; merci [EMAIL PROTECTED] wrote: Hi! I use mmap for interchange data between Python Autoit.  For that, I use (Autoit's side) a little DLL. This DLL can, perhaps, be used with ctypes. @-salutations -- Michel Claveau Say more-- what DLL?

Re: mmap and ctypes

2008-08-16 Thread castironpi
On Aug 16, 5:20 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 16, 4:42 pm, Michel Claveau - NoSpam SVP ; merci [EMAIL PROTECTED] wrote: Hi! I use mmap for interchange data between Python Autoit.  For that, I use (Autoit's side) a little DLL. This DLL can, perhaps, be used with ctypes

Re: negative numbers are not equal...

2008-08-15 Thread castironpi
On Aug 15, 8:56 am, Dan Lenski [EMAIL PROTECTED] wrote: On Thu, 14 Aug 2008 17:18:55 -0300, ariel ledesma wrote: hello guys i just ran into this when comparing negative numbers, they start returning False from -6 down, but only when comparing with 'is'   m = -5   a = -5   m is a

Re: You advice please

2008-08-15 Thread castironpi
On Aug 15, 10:05 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Hussein B a écrit : (snip) But this critisim looks so serious: http://en.wikipedia.org/wiki/Ruby_programming_language#Criticism (snip) the usual paranoïa from bondagediscipline language addicts Ooo... well said. --

Re: negative numbers are not equal...

2008-08-14 Thread castironpi
On Aug 14, 4:31 pm, Wojtek Walczak [EMAIL PROTECTED] wrote: On Thu, 14 Aug 2008 18:23:21 -0300, ariel ledesma wrote: i see now, so i guess that's also why id() returns the same address for them as well... It just have to work like this. a is b is actually equal to: id(a) == id(b) so

Re: a podcast for music algo-comped with python

2008-08-14 Thread castironpi
On Aug 14, 4:01 pm, Paul Boddie [EMAIL PROTECTED] wrote: On 14 Aug, 22:44, '2+ [EMAIL PROTECTED] wrote: I'm not sure if I follow the question. I don't have much experience with making sound effects, preferring to compose and pre-render my music, but I imagine there are some tricks that are

Re: Inquisitive computing

2008-08-13 Thread castironpi
On Aug 13, 4:29 pm, [EMAIL PROTECTED] wrote: David C. Ullrich: If you look at the end of the article you see the author agrees (I don't quite follow his complaint about not feeling at home with the interactive mode, but it's funny to read about how he uses Lisp but realizes he's not

Re: relative imports improve program organization... suggestions?

2008-08-09 Thread castironpi
On Aug 8, 12:37 pm, DG [EMAIL PROTECTED] wrote: Alright, I have searched and searched and read many conversations on the topic of relative and absolute imports and am still not getting the whole thing through my skull. Highlights of what I've

Re: interpreter vs. compiled

2008-08-09 Thread castironpi
On Aug 5, 2:09 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Regarding exploring processor instructions. Lets say you compile a C program targeting x86 architecture, with optimizations turned on for speed, and let the compiler automatic select MMX and SSE instructions for numeric code. I

Re: Fastest way to store ints and floats on disk

2008-08-09 Thread castironpi
On Aug 7, 2:27 pm, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-08-07 20:41, Laszlo Nagy wrote:  Hi, I'm working on a pivot table. I would like to write it in Python. I know, I should be doing that in C, but I would like to create a cross platform version which can deal with

Re: Fastest way to store ints and floats on disk

2008-08-09 Thread castironpi
On Aug 9, 4:43 pm, John Machin [EMAIL PROTECTED] wrote: On Aug 10, 4:58 am, castironpi [EMAIL PROTECTED] wrote: On Aug 7, 2:27 pm, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-08-07 20:41, Laszlo Nagy wrote:  Hi, I'm working on a pivot table. I would like to write

Re: iterating by twos

2008-08-07 Thread castironpi
On Jul 29, 3:38 pm, Terry Reedy [EMAIL PROTECTED] wrote: kj wrote: Is there a special pythonic idiom for iterating over a list (or tuple) two elements at a time? I mean, other than for i in range(0, len(a), 2):     frobnicate(a[i], a[i+1]) There have been requests to add a grouper

Re: Fastest way to store ints and floats on disk

2008-08-07 Thread castironpi
On Aug 7, 1:41 pm, Laszlo Nagy [EMAIL PROTECTED] wrote:   Hi, I'm working on a pivot table. I would like to write it in Python. I know, I should be doing that in C, but I would like to create a cross platform version which can deal with smaller databases (not more than a million facts).

Re: Limits of Metaprogramming

2008-08-07 Thread castironpi
On Aug 7, 2:01 pm, Wilson [EMAIL PROTECTED] wrote: On Aug 6, 6:04 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 6, 7:24 am, Wilson [EMAIL PROTECTED] wrote: On Aug 4, 9:23 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 4, 1:57 pm, Wilson [EMAIL PROTECTED] wrote: On Aug 4, 6:49

Re: enhancing decorator signatures

2008-08-06 Thread castironpi
On Aug 6, 7:16 am, Diez B. Roggisch [EMAIL PROTECTED] wrote: Hi, I'm using Michele S's decorator-module to create decorators with matching signatures, for better error-catching. However, I now want to enrich the signature of a generic wrapper so that the new function will accept more

Re: More like a shell command.

2008-08-06 Thread castironpi
On Aug 6, 9:38 am, Bill [EMAIL PROTECTED] wrote: Is there anyway I can extend python to accept a command which looks more like shell syntax than a function call. I want to be able to do this:     if blah :         MyCommand  Arg1  Arg2 as opposed to this:     if blah :        

Re: Limits of Metaprogramming

2008-08-06 Thread castironpi
On Aug 6, 7:24 am, Wilson [EMAIL PROTECTED] wrote: On Aug 4, 9:23 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 4, 1:57 pm, Wilson [EMAIL PROTECTED] wrote: On Aug 4, 6:49 pm, castironpi [EMAIL PROTECTED] wrote: Two, if all your methods will have uniform signatures and closures

string to type object (C)

2008-08-05 Thread castironpi
Hello, I'm looking for a one-to-one function from strings to the built-in data types in C. I will be keeping the string in a file. I need the PyTypeObject* back from it. If nothing else I'll just do a bunch of strcmp( tuple ) { return PyTuple_Type; } commands, provided PyTuple_Type; will be

Re: interpreter vs. compiled

2008-08-05 Thread castironpi
On Aug 5, 9:21 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 3, 1:26 am, castironpi [EMAIL PROTECTED] wrote: Which is 12 bytes long and runs in a millisecond.  What it does is set a memory address to successive integers 0..9, then yields.  Due to the nature of program flow control

Re: string to type object (C)

2008-08-05 Thread castironpi
On Aug 5, 7:59 pm, Miles [EMAIL PROTECTED] wrote: On Tue, Aug 5, 2008 at 2:30 AM, castironpi [EMAIL PROTECTED] wrote: I'm looking for a one-to-one function from strings to the built-in data types in C.  I will be keeping the string in a file.  I need the PyTypeObject* back from

Re: interpreter vs. compiled

2008-08-05 Thread castironpi
On Aug 5, 1:54 pm, Chris Mellon [EMAIL PROTECTED] wrote: On Tue, Aug 5, 2008 at 12:12 PM, castironpi [EMAIL PROTECTED] wrote: On Aug 5, 9:21 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 3, 1:26 am, castironpi [EMAIL PROTECTED] wrote: Which is 12 bytes long and runs

Re: Limits of Metaprogramming

2008-08-04 Thread castironpi
On Aug 4, 4:48 am, Wilson [EMAIL PROTECTED] wrote: Hi all, My problem is that I don't know if it's possible to edit these states and then write them back to .py. Firstly, if my editing tool was to create a new state, I would want to create the class (using type) and attach it to the imported

custom allocation and custom type

2008-08-04 Thread castironpi
Hi all, I am trying to create a custom tuple type. I want it to live in a custom memory region, which will be a memory-mapped file. Its contents cannot be PyObject*. They have to be offsets into mapped memory. GetItem( i ) would return: (PyObject *)( t-ob_item[ i ]+ mmap_base_addr ); In

Re: Limits of Metaprogramming

2008-08-04 Thread castironpi
On Aug 4, 1:57 pm, Wilson [EMAIL PROTECTED] wrote: On Aug 4, 6:49 pm, castironpi [EMAIL PROTECTED] wrote: Two, if all your methods will have uniform signatures and closures, you can store class methods as only their co_code objects: C.g.im_func.func_code.co_code 'd\x00\x00S

Re: scanf in python

2008-08-03 Thread castironpi
On Aug 3, 8:27 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jul 22, 2:00 pm, AMD [EMAIL PROTECTED] wrote: Hello Fredrik, I didn't think my comment would offend anyone [...] I doubt that it offended anyone else.  Having been the recipient of a few F-bombs :-) myself, I'd just let it

Re: interpreter vs. compiled

2008-08-02 Thread castironpi
On Aug 1, 5:24 am, Paul Boddie [EMAIL PROTECTED] wrote: On 1 Aug, 07:11, castironpi [EMAIL PROTECTED] wrote: Given the restrictions (or rather, freedoms) of Python, does there exist code that necessarily cannot translate to machine code?  In other words, can you translate all Python code

Re: interpreter vs. compiled

2008-08-02 Thread castironpi
On Aug 2, 2:02 pm, Tim Roberts [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: And furthermore, I think I'm getting confused about what exactly constitutes an interpreter: it is whether there is a process that runs product instructions, or the product instructions can run

Re: interpreter vs. compiled

2008-07-31 Thread castironpi
On Jul 31, 1:17 am, Tim Roberts [EMAIL PROTECTED] wrote: castironpi [EMAIL PROTECTED] wrote: In C, we have: int x, y; x= 10; y= x+ 1; It translates as, roughly: 8000 .data 7996 #x 7992 #y 7988 .end data 7984 loadi reg0 7996 7980 loadi reg1 7992 7976 loadi reg2 10

Re: interpreter vs. compiled

2008-07-30 Thread castironpi
I note that IronPython and Python's pickle.dumps do not return the same value. Perhaps this relates to the absence of interpreter loop. p.dumps( { 'a': True, 'b': set( ) } ) IPy: '(dp0\nVb\np1\nc__builtin__\nset\np3\n((lp4\ntp5\nRp2\nsVa \np6\nI01\ns.' CPy:

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread castironpi
On Jul 30, 1:50 am, Carl Banks [EMAIL PROTECTED] wrote: On Jul 30, 1:58 am, Russ P. [EMAIL PROTECTED] wrote: On Jul 29, 10:33 pm, Carl Banks [EMAIL PROTECTED] wrote: On Jul 30, 1:15 am, Russ P. [EMAIL PROTECTED] wrote: Having said that, it would sure be nice to be able to write

Re: undo a dictionary

2008-07-30 Thread castironpi
On Jul 30, 8:07 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 30 Jul 2008 16:14:31 -0300, mmm [EMAIL PROTECTED] escribi : And for that matter a way to create a dictionary from a set of variables (local or global). You have to be more specific: there are {} displays and

Re: static variables in Python?

2008-07-29 Thread castironpi
On Jul 29, 8:38 pm, pigmartian [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: kj: OK, I guess that in Python the only way to do what I want to do is with objects... There are other ways, like assigning the value out of the function, because Python functions too are objects: ...

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