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/wr

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 res

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 do

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 canno

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'].ap

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

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: >          

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

Re: calling NetShareEnum win32api with ctypes

2008-08-27 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(s

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 structure

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

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) a

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 (cu

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'

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 sam

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 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

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 sporadi

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 situa

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

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 bet

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

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 staticall

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

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

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

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__

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

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 ? > > Secon

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

2008-09-05 Thread castironpi
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: > >> David C. Ullrich: > > >> > At least in mathematics, the su

Re: xml + mmap cross

2008-09-05 Thread castironpi
On Sep 5, 12:13 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > this discussion seems pretty much off-topic for a Python list. > > > > castironpi wrote: > > In an XML file, entries are stored in serial, sort of like this. > > >

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, castir

lacking follow-through

2008-09-07 Thread castironpi
I am concerned by the lack of follow-through on some responses to recent ideas I have described. Do I merely have a wrong understanding of group policy? Is it a good policy (defined with respect to the future of Python and the welfare of humans at large) if so? Is there a serious lack of diligen

Re: lacking follow-through

2008-09-07 Thread castironpi
On Sep 7, 5:03 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote: > > This is the strangest post I've seen > > since I've joined this list (only > > recently). What the ? > > Yeah,

Re: lacking follow-through

2008-09-07 Thread castironpi
On Sep 7, 5:45 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote: > > Hi, > > > This is the strangest post I've seen > > since I've joined this list (only > > recently). W

Re: lacking follow-through

2008-09-07 Thread castironpi
On Sep 7, 7:34 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Sep 7, 11:28 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > > > +1 Bot > > I think it's like duck typing: it doesn't matter whether he's actually > a bot, only whether he behaves like one. Do you support the bot interface and methods? -- htt

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

2008-09-08 Thread castironpi
On Sep 8, 8:54 am, Boris Borcic <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > > (ii) If A is a subset of B then we should have > > max(A) <= max(B). This requires that max(empty set) > > be something that's smaller than everything else. > > So we give up on that. > > Er, what about insta

Re: lacking follow-through

2008-09-08 Thread castironpi
On Sep 8, 11:23 am, "Dan Upton" <[EMAIL PROTECTED]> wrote: > On Sun, Sep 7, 2008 at 10:59 PM, castironpi <[EMAIL PROTECTED]> wrote: > > On Sep 7, 7:34 pm, MRAB <[EMAIL PROTECTED]> wrote: > >> On Sep 7, 11:28 pm, "Eric Wertman" <[EMAIL

Re: lacking follow-through

2008-09-08 Thread castironpi
On Sep 8, 2:04 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Mon, Sep 8, 2008 at 9:03 AM, Eric Wertman <[EMAIL PROTECTED]> wrote: > >> Perhaps the wrong idea of what the group is.  I would have thought > >> that > >> if one had a sufficiently developed idea and wanted to have it / > >> formall

Re: lacking follow-through

2008-09-08 Thread castironpi
On Sep 8, 2:21 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-09-08, Chris Rebert <[EMAIL PROTECTED]> wrote: > > > On Mon, Sep 8, 2008 at 9:03 AM, Eric Wertman <[EMAIL PROTECTED]> wrote: > > >> To expand on this a little bit, I've been subscribed to this > >> group for a couple of months, b

dynamic allocation file buffer

2008-09-09 Thread castironpi
I will try my idea again. I want to talk to people about a module I want to write and I will take the time to explain it. I think it's a "cool idea" that a lot of people, forgiving the slang, could benefit from. What are its flaws? A user has a file he is using either 1/ to persist binary data

Re: dynamic allocation file buffer

2008-09-09 Thread castironpi
On Sep 9, 5:44 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > I will try my idea again.  I want to talk to people about a module I > > want to write and I will take the time to explain it.  I think it's a > > "cool idea" that a lot of

Re: dynamic allocation file buffer

2008-09-09 Thread castironpi
On Sep 9, 5:58 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 09 Sep 2008 14:59:19 -0700, castironpi wrote: > > I will try my idea again.  I want to talk to people about a module I > > want to write and I will take the time to explain it.  I t

Re: Coming from .NET and VB and C

2008-09-09 Thread castironpi
On Sep 8, 9:31 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > On 3 Sep, 18:52, ToPostMustJoinGroup22 <[EMAIL PROTECTED]> > wrote: > > > I'm coming from a .NET, VB, C background. > > Any suggestions for someone new to the scene like me? > > Welcome! Unfortunately, you probably have a lot of bad habit

Re: how to get the thighest bit position in big integers?

2008-10-05 Thread Aaron &quot;Castironpi" Brady
On Oct 5, 2:12 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > > [EMAIL PROTECTED] wrote: > > > OFFSET = dict(("%x"%i, int(c)) for i,c in enumerate("5433")) > > def get_highe

Re: how to get the thighest bit position in big integers?

2008-10-05 Thread Aaron &quot;Castironpi" Brady
On Oct 5, 7:02 pm, Rich Healey <[EMAIL PROTECTED]> wrote: > > P.S.  Back home, this sort of 'nitpicking' would be judged > > unconstructive.  Worth pointing out, or not worth saying? > > > P.S.S.  'Thighest' bit?  I thought the spam filters would catch that. > > That should be P.P.S. > > PS: This i

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-05 Thread Aaron &quot;Castironpi" Brady
On Oct 5, 7:13 pm, MRAB <[EMAIL PROTECTED]> wrote: > Fuzzyman wrote: > > Hello all, > > > I may well be being dumb (it has happened before), but I'm struggling > > to fix some code breakage with Python 2.6. > > > I have some code that looks for the '__lt__' method on a class: > > > if hasattr(clr,

Re: When Python should not be used?

2008-10-05 Thread Aaron &quot;Castironpi" Brady
On Oct 5, 7:08 pm, Andrea Francia <[EMAIL PROTECTED] HERE.ohoihihoihoih.TO-HERE.gmx.it> wrote: > The right tool depends on the current problem. > > While some python users prefer to talk about when Python is the right > tool I think that it is more instructive to know when it is not. > > Please, co

Re: lint for Python?

2008-10-05 Thread Aaron &quot;Castironpi" Brady
On Oct 5, 8:53 am, Pat <[EMAIL PROTECTED]> wrote: > Miki wrote: > > Hello, > > >> In module one, I have a function: > > >> def foo( host, userid, password ): > >>      pass > > >> In module two, I call that function: > > >> foo( userid, password) > > >> lint doesn't find that error and it won't be

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Aaron &quot;Castironpi" Brady
On Oct 6, 4:30 am, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Oct 6, 1:13 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > > Fuzzyman wrote: > > > Hello all, > > > > I may well be being dumb (it has happened before), but I'm struggling > > > to fix some code breakage with Python 2.6. > > > > I have some c

Re: how to get the thighest bit position in big integers?

2008-10-06 Thread Aaron &quot;Castironpi" Brady
On Oct 6, 3:37 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Oct 5, 11:40 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > > > Your point, that taking floor(log2(x)) is redundant, is a good catch. > > However, you should have added 'untested' ;-).  When value has more > > significant bits than the

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Aaron &quot;Castironpi" Brady
On Oct 6, 1:17 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Oct 6, 7:01 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> > wrote: > > It's a very object oriented solution.  Essentially you're inheriting > > all the classes that you w

Re: Array of dict or lists or ....?

2008-10-07 Thread Aaron &quot;Castironpi" Brady
On Oct 7, 10:16 am, "Barak, Ron" <[EMAIL PROTECTED]> wrote: > Would the following be suitable data structure: > ... > struct = {} > struct["Nebraska"] = "Wabash" > struct["Nebraska"]["Wabash"] = "Newville" > struct["Nebraska"]["Wabash"]["Newville"]["topics"] = "Math" > struct["Nebraska"]["Wabash"][

Re: Race condition when generating .pyc files

2008-10-07 Thread Aaron &quot;Castironpi" Brady
On Oct 7, 10:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a large body of Python code which runs on many different (Unix) > machines concurrently.  Part of the code lives in one place, but most > of it lives in directories which I find at runtime.  I only have one > copy of each P

Re: type-checking support in Python?

2008-10-07 Thread Aaron &quot;Castironpi" Brady
On Oct 7, 5:24 am, Bas <[EMAIL PROTECTED]> wrote: > On Oct 7, 8:36 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > > central.gen.new_zealand> wrote: > > In message <[EMAIL PROTECTED]>, Gabriel > > > Genellina wrote: > > > As an example, in the oil industry here in my country there is a mix of > > > me

Re: type-checking support in Python?

2008-10-07 Thread Aaron &quot;Castironpi" Brady
On Oct 7, 3:52 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > (e.g., man-day-widgets for > questions like, "If it takes one man three days to make two widgets, how > many widgets can five men make in two weeks?"). Wouldn't that be 'widgets per man-day'? -- http://mail

inspect bug

2008-10-08 Thread Aaron &quot;Castironpi" Brady
Hi all, Found this bug. It's in 2.6, too bad. Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> type( inspect.getargvalues( inspect.currentframe() ) ) Docs say: insp

inspect feature

2008-10-08 Thread Aaron &quot;Castironpi" Brady
Hello, The 'inspect' module has this method: inspect.getargvalues(frame) It takes a frame and returns the parameters used to call it, including the locals as defined in the frame, as shown. >>> def f( a, b, d= None, *c, **e ): ... import inspect ... return inspect.getargvalues( inspect.

Re: Safe eval of insecure strings containing Python data structures?

2008-10-08 Thread Aaron &quot;Castironpi" Brady
On Oct 8, 7:34 pm, "Warren DeLano" <[EMAIL PROTECTED]> wrote: > I would like to parse arbitrary insecure text string containing nested > Python data structures in eval-compatible form:   > ... > # But I know for certain that the above approach is NOT secure since > object attributes can still be ac

Re: how to get the thighest bit position in big integers?

2008-10-08 Thread Aaron &quot;Castironpi" Brady
On Oct 8, 7:21 pm, greg <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > str.find is an historical anomaly that should not be copied.  It > > was(is?) a wrapper for C's string find function.  C routinely uses -1 to > > mean None for functions statically typed to return ints.  The Python > > vers

Re: Porn Addiction Solutions?

2008-10-08 Thread Aaron &quot;Castironpi" Brady
On Oct 8, 2:07 pm, [EMAIL PROTECTED] wrote: > Help, I'm addicted to porn. I've been spending a lot of time > downloading hardcore porn and masturbating to it. It's ruining my > life. I just found out that one of these sites somehow hacked my card > and rang up $5K in charges which they won't even r

Re: inspect bug

2008-10-09 Thread Aaron &quot;Castironpi" Brady
On Oct 9, 9:47 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 09 Oct 2008 00:24:20 -0300, Aaron "Castironpi" Brady   > <[EMAIL PROTECTED]> escribió: > > > Found this bug.  It's in 2.6, too bad. > > Posting here is not going

Re: inspect feature

2008-10-09 Thread Aaron &quot;Castironpi" Brady
On Oct 9, 3:48 am, Bruno Desthuilliers wrote: > Aaron "Castironpi" Brady a écrit : > > > > > Hello, > > > The 'inspect' module has this method: > > > inspect.getargvalues(frame) > > > It takes a frame and returns the parameters used

Re: Safe eval of insecure strings containing Python data structures?

2008-10-09 Thread Aaron &quot;Castironpi" Brady
On Oct 9, 1:44 pm, Jason Scheirer <[EMAIL PROTECTED]> wrote: > On Oct 9, 9:01 am, Paul Rubin wrote: > > > Lie Ryan <[EMAIL PROTECTED]> writes: > > > in python 2.6, ast.literal_eval may be used to replace eval() for > > > literals. > > > What happens on literal_eval('[1]*9

Re: Traceback not going all the way to the exception?

2008-10-09 Thread Aaron &quot;Castironpi" Brady
On Oct 9, 3:27 am, sert <[EMAIL PROTECTED]> wrote: > I just got an exception and the traceback wouldn't go all the > way to the statement that threw the exception. I found that out > by using the debugger. > > Contrast the traceback: > > http://tinyurl.com/5xglde > > with the debugger output (notic

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 5:24 am, Gordon Allott <[EMAIL PROTECTED]> wrote: > Hello :) > > The result of various incompatibilities has left me needing to somehow > extract the address that a null pointer is pointing to with the null > pointer being exposed to python via PyCObject_FromVoidPtr > > the code that cre

Re: inspect feature

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 3:36 am, Bruno Desthuilliers wrote: > Aaron "Castironpi" Brady a écrit : > > > > > On Oct 9, 3:48 am, Bruno Desthuilliers > [EMAIL PROTECTED]> wrote: > >> Aaron "Castironpi" Brady a écrit : > > >>> Hello, > >

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 12:04 pm, Gordon Allott <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > Did you try: > > > tmp= PyLong_FromLong( ( long ) info.info.x11.display ); > > PyDict_SetItemString (dict, "display", tmp); > > Py_DECREF

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 4:16 pm, Gordon Allott <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > I see.  If I understand, you have a PyCObject in a dictionary. > > > Look at the 'ctypes' module and try calling PyCObject_AsVoidPtr.  Its > >

Re: Porn Addiction Solutions?

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 10:33 am, Aspersieman <[EMAIL PROTECTED]> wrote: > On Fri, 10 Oct 2008 16:11:07 +0200, <[EMAIL PROTECTED]> wrote: > > On Oct 10, 7:03 am, Um Jammer NATTY <[EMAIL PROTECTED]> wrote: > >> On Oct 10, 5:37 am, [EMAIL PROTECTED] wrote: > > >> > It's very simple. You need to know the world is

Re: Where/how to propose an addition to a standard module?

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 2:10 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > I would like to propose a new method for the string.Template class.   > What's the proper procedure for doing this?  I've joined the python- > ideas list, but that seems to be only for proposed language changes,   > and my idea doesn't req

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 7:59 pm, Gordon Allott <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > Yes, well said.  But no, not true, not necessarily.  You can choose/ > > change return types with your code.  If the call is defined already > > and you can'

Re: Using multiprocessing

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 3:32 pm, nhwarriors <[EMAIL PROTECTED]> wrote: > I am attempting to use the (new in 2.6) multiprocessing package to > process 2 items in a large queue of items simultaneously. I'd like to > be able to print to the screen the results of each item before > starting the next one. I'm having

Re: Efficient Bit addressing in Python.

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 9, 5:30 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > Is there a canonical way to address the bits in a structure > like an array or string or struct? > > Or alternatively, is there a good way to combine eight > ints that represent bits into one of the bytes in some > array or string

Re: Efficient Bit addressing in Python.

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 10:37 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Oct 9, 5:30 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > > > > > Is there a canonical way to address the bits in a structure > > like an arra

Re: Using multiprocessing

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 10:48 pm, nhwarriors <[EMAIL PROTECTED]> wrote: > On Oct 10, 10:52 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Oct 10, 3:32 pm, nhwarriors <[EMAIL PROTECTED]> wrote: > > > > I am attemp

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 10:54 pm, Gordon Allott <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > snip > > Last, you > > haven't mentioned an attempt with PyCObject_AsVoidPtr yet: > > > void* PyCObject_AsVoidPtr(PyObject* self) > >     Return

Re: 2to3 refactoring [was Re: Tuple parameter unpacking in 3.x]

2008-10-11 Thread Aaron &quot;Castironpi" Brady
On Oct 11, 2:23 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: snip > I am talking about a clash between *conventions*, where there could be > many argument names of the form a_b which are not intended to be two item > tuples. > > In Python 2.x, when you see the function signatur

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Aaron &quot;Castironpi" Brady
On Oct 11, 9:45 am, Gordon Allott <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > > My pygame install just returns an integer in get_wm_info.  Take a > > look: > > >>>> pygame.display.get_wm_info() > > {'window

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Aaron &quot;Castironpi" Brady
On Oct 11, 1:59 pm, Gordon Allott <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > > What does print pythonapi.PyCObject_AsVoidPtr(display) give you? > > -- > >http://mail.python.org/mailman/listinfo/python-list > > Traceback (most rec

Re: default value in __init__

2008-10-11 Thread Aaron &quot;Castironpi" Brady
On Oct 10, 12:30 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> I don't think simply re-executing the default argument > >> expression on each call works either: that would confuse at least as > >> many people as the current system. > > > May I ask you why? I think I do

Re: default value in __init__

2008-10-11 Thread Aaron &quot;Castironpi" Brady
On Oct 11, 4:41 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 10 Oct 2008 06:20:35 -0700, bearophileHUGS wrote: snip > > I have seen professional programmers too use class attributes instead of > > instance ones... > > That's only a mistake if you don't mean to use cla

Re: Most compact "X if X else Y" idiom

2008-10-11 Thread Aaron &quot;Castironpi" Brady
On Oct 12, 12:01 am, [EMAIL PROTECTED] wrote: > I find myself having to do the following: > >   x = (some complex expression) >   y = x if x else "blah" > > and I was wondering if there is any built-in idiom that > can remove the need to put (some complex expression) > in the temporary variable x.

Mail reader & spam

2008-10-12 Thread Aaron &quot;Castironpi" Brady
Hello all, I'm hesitating to change news readers because I like Google's interface. In the interests of discussion, I'd make better contributions without it, if only because it's a known spam source, but its reader format beats the alternatives I've seen. I checked out the 'nntplib' module to se

Re: inspect feature

2008-10-14 Thread Aaron &quot;Castironpi" Brady
On Oct 14, 9:42 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 14, 3:06 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > > > > En Fri, 10 Oct 2008 14:18:53 -0300, Aaron "Castironpi" Brady > > <[EMAIL PROTECTED]> escr

Re: inspect feature

2008-10-14 Thread Aaron &quot;Castironpi" Brady
On Oct 14, 2:32 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 14, 2:35 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Oct 14, 9:42 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > >

Re: default value in __init__

2008-10-14 Thread Aaron &quot;Castironpi" Brady
On Oct 14, 1:50 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > David C. Ullrich a écrit : > > > > > In article <[EMAIL PROTECTED]>, > >  Bruno Desthuilliers <[EMAIL PROTECTED]> > >  wrote: snip > (snip) snip > > In particular default parameters should work the way the user > > expects! The fa

Re: inspect feature

2008-10-14 Thread Aaron &quot;Castironpi" Brady
On Oct 14, 4:16 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 14, 5:00 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: (snip > > Here's some more info. > > > Ver 2.5: > > > >>&g

Re: docpicture

2008-10-14 Thread Aaron &quot;Castironpi" Brady
On Oct 14, 11:56 am, [EMAIL PROTECTED] wrote: > André: > > > Ok, the following is my first attempt at implementing this idea. > > I suggest you to change the program you use to encode your images, > because it's 1000 bytes, while with my program the same 256 colors > image needs just 278 bytes: > >

Re: Overloading operators

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 7:34 am, Mr.SpOOn <[EMAIL PROTECTED]> wrote: > Hi, > in a project I'm overloading a lot of comparison and arithmetic > operators to make them working with more complex classes that I > defined. > > Sometimes I need a different behavior of the operator depending on the > argument. For exa

Re: File Management

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 12:47 pm, "erict1689" <[EMAIL PROTECTED]> wrote: > I am writing this program in which I open up a file and update that > information but to a new file.  I already have a global variable for > it but how do I go about creating an openable file in the source code? >  If it helps here is wh

Re: Overloading operators

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 7:34 am, Mr.SpOOn <[EMAIL PROTECTED]> wrote: > Hi, > in a project I'm overloading a lot of comparison and arithmetic > operators to make them working with more complex classes that I > defined. > > Sometimes I need a different behavior of the operator depending on the > argument. For exa

Re: IDE Question

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 1:07 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > Steve Phillips wrote: > > Hi All, > > I am just wondering what seems to be the most popular IDE. The reason > > I ask is I am currently at war with myself when it comes to IDE's. It > > seems like every one I find and try out has somethi

Re: How to transfer data structure or class from Python to C/C++?

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 8:08 pm, Hongtian <[EMAIL PROTECTED]> wrote: > Hi friends, > > I am a newer of Python. I want to ask below question: > > I have a C/C++ application and I want to use Python as its extension. > To do that, I have to transfer some data structure from C/C++ > application to Python and get s

Re: default value in __init__

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 11:05 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message <[EMAIL PROTECTED]>, Steven D'Aprano > wrote: > > > On Thu, 09 Oct 2008 01:39:30 -0700, kenneth (a.k.a. Paolo) wrote: > > >> On Oct 9, 10:14 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > > >

Re: default value in __init__

2008-10-15 Thread Aaron &quot;Castironpi" Brady
On Oct 15, 11:33 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > [about how default argument behavior should, in his opinion, be changed] > > Say what you like. The language is as it is by choice. Were it, for some > reason, to

Re: Finding the instance reference of an object

2008-10-16 Thread Aaron &quot;Castironpi" Brady
On Oct 16, 12:25 pm, Astley Le Jasper <[EMAIL PROTECTED]> wrote: > Thanks for all the responses. That helps. > > Ta > > ALJ If you're sure it's unique, why not just scan through the pairs in locals()? for k, v in locals(): if v is the_object_im_looking_for: name_im_looking_for= k This meth

<    4   5   6   7   8   9   10   11   >