Re: Struct usages in Python

2008-05-27 Thread Patrick Mullen
I don't know if this will go through (my posts seem to have become blocked lately), but I'll give it a shot anyhow. You seem to be under a misconception that a python list is similar to a list in say, Java or other languages that have a rigid idea of variables and types. In python, a list is a li

python, dlls, and multiple instances

2008-05-30 Thread Patrick Stinson
Is it a correct to assume that you can use multiple instances of python altogether if each is loaded from a separate dll? For instance, if I write a couple of dll/so libs, and each has python statically linked in, is it safe to assume that since dlls use their own address space then each dll would

Re: php vs python

2008-06-02 Thread Patrick Mullen
Yeah I would agree that a decent (a few steps below good in my book) programmer should be able to have a decent handle on a new language, given some acclimatization time of course. The amount of time this period lasts varies on the language said programmer is learning, as well as the languages he

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Patrick Mullen
Can we plez not try and ruin my fave language with a useless concept? Strict data hiding is only necessary because textbooks say it is. Use method attributes or some other hack if you really must (people won't know it's there unless they look, and if they are looking, maybe they have a reason?) I

Re: python, dlls, and multiple instances

2008-06-04 Thread Patrick Stinson
ahh, ok. Looks like my fundamental understanding of how dlls work was a little messed up. Thanks! On Sun, Jun 1, 2008 at 10:42 AM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> Is it a correct to assume that you can use multiple instances of >> python altogether if each is loaded from a separate

Re: Please unregister this mail-address out of mailing-list.

2008-06-05 Thread Patrick Stinson
you can unsubscribe yourself at the list info page (the same page you subscribed from) On Thu, Jun 5, 2008 at 10:22 AM, Hank @ITGroup <[EMAIL PROTECTED]> wrote: > Dear Python Staff, > I am writing this letter to unsubscribe this mail-address from python > mail-list. One problem is that this python

Re: Why does python not have a mechanism for data hiding?

2008-06-08 Thread Patrick Mullen
"Well, "common" in Prolog, Smalltalk, Haskell, ML, and Erlang is hardly common in general. I'll bet that Java and C/C++ are used more in North Dakota than all those languages combined are used in the entire world." I would say python has more in common with the mentioned family than with the C or

Determining which things in 'from package import *' are actually used

2008-06-10 Thread Patrick Bouffard
I have a fairly large library of Python code, where 'from package import *' is used rather liberally, and it's not uncommon for more than one of these to appear in any given module. What I'd like to be able to do is to clean my code up a bit and turn each of the 'from package import *' statements i

Re: Why does python not have a mechanism for data hiding?

2008-06-10 Thread Patrick Mullen
Hi Russ, Here are just some pragmatic considerations. Personally I am against data hiding, but I obviously won't convince you in that regard. There are some pros and cons as with anything, and I feel the cons outweight the pros (namely that users of code should be able to use how they want, even

Re: Determining which things in 'from package import *' are actually used

2008-06-10 Thread Patrick Bouffard
On Jun 10, 3:03 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Patrick Bouffard wrote: > > I have a fairly large library of Python code, where 'from package import *' > > is > > used rather liberally, and it's not uncommon for more than one of these to >

Re: Why does python not have a mechanism for data hiding?

2008-06-11 Thread Patrick Mullen
On Wed, Jun 11, 2008 at 12:28 PM, Russ P. <[EMAIL PROTECTED]> wrote: > > If Desthuilliers doesn't like my suggestion, then fine. If no other > Python programmer in the world likes it, then so be it. But do we > really need to get personal about it? Python will not be ruined if it > gets such a key

go to specific line in text file

2008-06-17 Thread Patrick David
Hello NG, I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? Hope for help Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Patrick Mullen
On Wed, Jul 30, 2008 at 12:27 PM, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Given the code samples above, is there any technical reason why this cannot > be done? Thanks for the input guys, and thanks more over for keeping this > easy-going. > > -- > http://mail.python.org/mailman/listinfo/pyth

Re: Wouldn't it be nice if this worked?

2008-08-10 Thread Patrick Mullen
How about: class A: def add(self,x,y): return x+y class B(A): pass print B().add(1, 2) This also works: class A: def add(self, x, y): return x+y class B: pass B.add = A.add.im_func print B().add(1, 2) -- http://mail.python.org/mailman/listinfo/python-list

xlrd cell background color

2008-08-13 Thread patrick . waldo
7;test7.txt' (XF:23) Now NoFill is XF:22! I am sure I am going about this the wrong way, but I just want to store filenames into a dictionary based on whether they are red or green. Any ideas would be much appreciated. My code is below. Best, Patrick filenames = {} filenames.setde

Re: xlrd cell background color

2008-08-14 Thread patrick . waldo
olour_map does not make much sense to me since the numbers change without an apparent pattern. Could you clarify? Best, Patrick Revised Code: import xlrd filenames = {} filenames.setdefault('GREEN',[]) filenames.setdefault('RED',[]) book = xlrd.open_workbook("/home/pwaldo

xlrd and cPickle.dump/rows to list

2008-03-31 Thread patrick . waldo
x27;t pickle %s objects" % base.__name__ TypeError: can't pickle file objects I tried to use open(filename, 'w') as well as pyExcelerator (wb.save(pickle_path)) to create the pickle file, but neither worked. Any ideas would be much appreciated. Patrick -- http://mail.python.org/mailman/listinfo/python-list

xlrd and cPickle.dump

2008-03-31 Thread patrick . waldo
Hi all, I have to work with a very large excel file and I have two questions. First, the documentation says that cPickle.dump would be the best way to work with it. However, I keep getting: Traceback (most recent call last): File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework \script

xlrd and cPickle.dump

2008-04-01 Thread patrick . waldo
ckle_path)) #2) Normal pickle try #pickle_file = open(pickle_path, 'w') #cPickle.dump(book, pickle_file) #file.close() Any ideas would be helpful. Otherwise, I won't pickle the excel file and deal with the lag time. Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: xlrd and cPickle.dump

2008-04-01 Thread patrick . waldo
> How many megabytes is "extremely large"? How many seconds does it take > to open it with xlrd.open_workbook? The document is 15mb ad 50,000+ rows (for test purposes I will use a smaller sample), but my computer hangs (ie it takes a long time) when I try to do simple manipulations and the documen

Re: xlrd and cPickle.dump

2008-04-02 Thread patrick . waldo
Still no luck: Traceback (most recent call last): File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework \scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__ File "C:\text analysis\pickle_test2.py", line 13, in ? cPickle.dump(Data_sheet, pickle_file, -1)

Re: xlrd and cPickle.dump

2008-04-02 Thread patrick . waldo
>FWIW, it works here on 2.5.1 without errors or warnings. Ouput is: >2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] >0.6.1 I guess it's a version issue then... I forgot about sorted! Yes, that would make sense! Thanks for the input. On Apr 2, 4:23 pm, [EMAIL PROTECTED]

problem using import from PyRun_String

2008-04-08 Thread Patrick Stinson
shows a function for the "__import__" key, and I manually added all of the contents of __builtin__ to the module's dict, which was empty before. Any help? Cheers -- Patrick Kidd Stinson http://www.patrickkidd.com/ http://pkaudio.sourceforge.net/ http://pksampler.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: problem using import from PyRun_String

2008-04-09 Thread Patrick Stinson
te: > En Tue, 08 Apr 2008 22:01:18 -0300, Patrick Stinson > <[EMAIL PROTECTED]> escribió: > > > I'm creating a module with PyModule_New(), and running a string buffer > as > > the module's text using PyRun_String and passing the module's __dict__ > t

Re: problem using import from PyRun_String

2008-04-11 Thread Patrick Stinson
Great, that was the answer I was looking for, thank you. I'll respond with how well it works. On Thu, Apr 10, 2008 at 12:16 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 09 Apr 2008 13:31:22 -0300, Patrick Stinson > <[EMAIL PROTECTED]> escribió: > > >

frozen/builtin modules and new interpreter instances

2008-04-11 Thread Patrick Stinson
would be nice to know how to handle built-in, frozen, and statically linked modules. Any generic help on this topic would be great. Thanks! -- Patrick Kidd Stinson http://www.patrickkidd.com/ http://pkaudio.sourceforge.net/ http://pksampler.sourceforge.net/ -- http://mail.python.org/mailman

import hooks

2008-04-15 Thread Patrick Stinson
hat worked just fine from a pure script file run through python.exe. Thanks! -- Patrick Kidd Stinson http://www.patrickkidd.com/ http://pkaudio.sourceforge.net/ http://pksampler.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: import hooks

2008-04-16 Thread Patrick Stinson
ppend(Importer)\n"; PyRun_SimpleString(importer_source); For both examples none of the methods are called (I set breakpoints for the C functions) but a statement like "import os" or PyImport_ImportModule("traceback") don't work. Thanks for your help On Wed, Apr 16

Re: import hooks

2008-04-17 Thread Patrick Stinson
raise a new ImportError from import.c:find_module(), but I guess the behavior is desirable.. On Wed, Apr 16, 2008 at 5:17 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 16 Apr 2008 09:04:36 -0300, Patrick Stinson > <[EMAIL PROTECTED]> escribió: > > > I

Re: python setup.py install on Vista?

2008-04-18 Thread Patrick Mullen
On Fri, Apr 18, 2008 at 4:29 PM, globalrev <[EMAIL PROTECTED]> wrote: > type "python setup.py install" > > that is used in most "addons" for python. > > well using windows vista, where the h*** am i supposed to type this? > > if it is not doable in windows, what do i have to do instead? just >

Re: Python 2.5 adoption

2008-04-21 Thread Patrick Mullen
On Mon, Apr 21, 2008 at 1:49 PM, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > OP: keep in mind that your users do not see any gain from you using > 2.5. All they see is something that makes your software harder to > install. At some point you can dismiss them as living in the Stone Age, > but the

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Patrick Mullen
YAML is a joke if you expect a windows user to be able to hand edit the data. Windows users typically expect a .ini file in the application's directory. (Usually not the users home directory, even if that may be a better location). XML is ok, but .ini is much preferred. If you have a configurat

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread Patrick Mullen
The K_a is a constant integer, but you don't need to worry about it's value. It tells you the index in get_pressed() to check for. So: print pygame.key.get_pressed()[pygame.K_a] Says, look at the 97th index in the get_pressed() list and see if that is a 1 or a 0. Or if you use the pygame event

Re: Are rank noobs tolerated, here?

2008-05-04 Thread Patrick Mullen
There is also the python tutor list: http://mail.python.org/mailman/listinfo/tutor Which is more geared toward beginners. Although I am subscribed to both lists, and they are both matched by the same filter for me so I wont know the difference... But there may be people who are not subscribed t

Re: Free Memory

2008-05-09 Thread Patrick Mullen
I had some very interesting results with this code to do what is asked: for key in globals().keys(): del globals()[key] for key in locals().keys(): del locals()[key] It might be better to reverse the two steps, I didn't give it much thought. Anyway, when this is done, all of the builtins

Re: Now what!?

2008-05-10 Thread Patrick Mullen
On Sat, May 10, 2008 at 3:57 PM, Grant Edwards <[EMAIL PROTECTED]> wrote: > On a Linux system (and I presume on other Unixes), the kernel > itself (if built with the proper options) knows know how start > a "script" file that starts with the characters "#!". When the > kernel is told to execute a

Re: Free Memory

2008-05-10 Thread Patrick Mullen
Yeah I don't know much about locals or globals. I've never used them before, just know they are there. But anyway, to illustrate what I meant by the interesting behavior, here is the output (and sorry for it being so long): IDLE 2.6a2 >>> globals() {'__builtins__': , '__name__': '__main__', '__d

Re: Imports visibility in imported modules problem

2008-08-23 Thread Patrick Maupin
On Aug 23, 7:27 pm, "Mohamed Yousef" <[EMAIL PROTECTED]> wrote: > The problem I'm asking about is how can imported modules be aware of > other imported modules so they don't have to re-import them (avoiding > importing problems and Consicing code and imports ) You could import sys and look at sys

Re: Python String Immutability Broken!

2008-08-24 Thread Patrick Maupin
On Aug 24, 8:49 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > (a lot of stuff related to using a string with a C library via ctypes) Very entertaining. But let me get this straight: Are you just complaining that if you pass a string to an arbitrary C function using ctypes, that that arb

Re: Python String Immutability Broken!

2008-08-25 Thread Patrick Maupin
On Aug 25, 3:31 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > Actually, I am not complaining - I am asking for advice on the side > effects of what I am doing, which is replacing a bunch of bits > in what is essentially an output bit field with the corresponding > input bits at the same add

Re: exactly same as [1,2,3,] ?

2008-08-28 Thread Patrick Maupin
On Aug 28, 6:35 pm, "James Mills" <[EMAIL PROTECTED]> wrote: > I must point out though that although they contain > the same elements/data, they are not the same > object/instance. > > {{{ > #!python > > >>> x = [1, 2, 3] > >>> y = [1, 2, 3] > >>> id(x) > 3083095148L > >>> id(y) > 3082953324L > >>>

Re: subclassing complex

2008-08-29 Thread Patrick Maupin
On Aug 29, 12:17 am, BiDi <[EMAIL PROTECTED]> wrote: > I have been trying to subclass complex, but I am not able to get the > right-hand arithmetic operators working. > > As shown below, if an object of my subclass 'xcomplex' is added on the > right of a 'comlex' object, the type returned is 'compl

Re: subclassing complex

2008-08-29 Thread Patrick Maupin
On Aug 29, 4:24 am, Peter Otten <[EMAIL PROTECTED]> wrote: > A minimal example is > > >>> class Complex(complex): > > ... def __radd__(self, other): print "radd" > ...>>> 1j + Complex() > > 1j > > versus > > >>> class Int(int): > > ... def __radd__(self, other): print "radd" > ...>>> 1 + In

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Patrick Maupin
On Sep 2, 6:35 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >  It's not just my familiarity, Ada language too uses underscore for > >  that purpose, I think, so there's a precedent, and Ada is a language > >  designed to always minimize programmin

Converting .doc to .txt in Linux

2008-09-04 Thread patrick . waldo
.doc files that I need to convert into txt files encoded in utf-8. However, win32com.client doesn't work in Linux. It's been giving me quite a headache all day. Any ideas would be greatly appreciated. Best, Patrick #Windows Code: import glob,os,codecs,shutil,win32com.client from win32com

__builtins__ magic behavior

2008-09-07 Thread Patrick Maupin
__builtins__ in 2.5.2 doesn't seem to behave like I remember it did the last time I did some custom stuff with it, a very long time ago. This isn't surprising, because of ongoing optimization, but it's hard to google for '__builtins__' so I didn't really find any documentation on the current CPyth

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

2008-09-07 Thread Patrick Maupin
On Sep 7, 12:30 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Sep 6, 11:05 pm, Steven D'Aprano <[EMAIL PROTECTED] > > Sheesh. That's not a problem, because Python is not trying to be a > > dialect of SQL. > > And yet, they added a Sqlite3 module. Does that mean that, because there is an 'os' modu

Re: __builtins__ magic behavior

2008-09-07 Thread Patrick Maupin
On Sep 7, 2:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Inside PyFrame_New, there is a shortcut: if the new frame and > the previous one share the same globals, then the previous > builtins are copied into the new frame. Only if the globals > differ the builtins are searched in globals.

Re: Read and write binary data

2008-09-07 Thread Patrick Maupin
On Sep 7, 5:41 pm, Mars creature <[EMAIL PROTECTED]> wrote: > Hi guys, >   I am new to Python, and thinking about migrating to it from matlab > as it is a really cool language. Right now, I am trying to figure out > how to control read and write binary data, like > 'formatted','stream','big-endian'

Incorrect compiler found building extension on windows

2008-09-08 Thread Patrick Stinson
I built python-2.5.1 from source using Visual Studio 2005, and am also trying to build my extension using distutils and Visual Studio 2005. Distutils complains about python being built with VS 2003, which is not on my system, and the only python binaries I have on my system are the ones I built fro

migrating processess to avoid the GIL

2008-09-19 Thread Patrick Stinson
I need to migrate calls to CPython to another process in my C++ app to get around the GIL. Does anyone know of a good way to do this on windows and Mac? All calls and callbacks can be blocking, I just need to share some data structures. Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: Not fully OO ?

2008-09-26 Thread Patrick Mullen
Depending on the scale of the website I am making, how much I care about editing it in the future, and how much I just want to get something up, I will occasionally use php. And I am a self confessed php hater :) But it's generally the fastest way I know to get something up. So even terrible lan

Large Data Sets: Use base variables or classes? And some binding questions

2008-09-26 Thread Patrick Sullivan
g self.variable_name ? I'll run some profile tests later today but if anyone has any cost/ efficiency of object creation in python, or any other idioms related to variable creation, I'd greatly appreciate some links. Thanks! Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: Not fully OO ?

2008-09-28 Thread Patrick Mullen
On Fri, Sep 26, 2008 at 1:11 PM, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Steven D'Aprano a écrit : >> >> On Fri, 26 Sep 2008 17:00:59 +0200, Bruno Desthuilliers wrote: >> >>> Patrick Mullen a écrit : >>>> >>>> Depending on

Re: What's The Best Editor for python

2006-03-25 Thread Patrick Stinson
emacs google: python-mode - Original Message - From: [EMAIL PROTECTED] Date: Saturday, March 25, 2006 6:10 pm Subject: Re: What's The Best Editor for python To: python-list@python.org > > Can one of you say to me what's the best editor for > > editing the python programs( for linux or wi

ANN: pdfrw pure-Python PDF file reading and writing

2009-11-27 Thread Patrick Maupin
the code and a few working examples at pdfrw.googlecode.com Feedback and/or code contributors always welcome! Best regards, Patrick Maupin -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: pdfrw pure-Python PDF file reading and writing

2009-11-27 Thread Patrick Maupin
On Nov 27, 2:35 am, Patrick Maupin wrote: > pdfrw is a basic PDF file manipulation library, developed and tested > on Python 2.5 and 2.6. > > pdfrw can read and write PDF files, and can also be used to read in > PDFs which can then be used inside reportlab (as source material

Re: ANN: pdfrw pure-Python PDF file reading and writing

2009-11-28 Thread Patrick Maupin
On Nov 27, 2:35 am, Patrick Maupin wrote: > pdfrw is a basic PDF file manipulation library, developed and tested > on Python 2.5 and 2.6. > > pdfrw can read and write PDF files, and can also be used to read in > PDFs which can then be used inside reportlab (as source material

Re: python bijection

2009-11-28 Thread Patrick Maupin
On Nov 19, 8:36 pm, Ben Finney wrote: > Carl Banks writes: > > On Nov 19, 3:24 pm, Joshua Bronson wrote: > > Apart from the GPL, it seems perfectly fine to release, and looks like > > an interesting strategy. I've wanted one of those once in a while, > > never enough to bother looking for one or

Re: Simple greatest common factor script

2009-11-29 Thread Patrick Sabin
I don't see how this script is able to divide by zero. If a and b switch places everything works ok. Have a look at your if-statements. It is possible, that both your if's are executed in one loop iteration (you can check this using pdb). You may want to try elif instead. - Patri

Re: xmlrpc idea for getting around the GIL

2009-12-01 Thread Patrick Stinson
yes, using an rpc mechanism would insert a "blocking" call into a thread in which I am "not allowed to make a blocking call," but actual turn around times would be far better than forcing all threads to wait on the Gil. As it stands, blocking on a single thread lock *almost* works, and while we can

Re: Call C program

2009-12-03 Thread Patrick Sabin
Have a look at the ctypes module http://python.net/crew/theller/ctypes/tutorial.html e.g.: from ctypes import * cdll.LoadLibrary("libc.so.6") libc = CDLL("libc.so.6") print libc.rand() print libc.atoi("34") - Patrick Patxi Bocos wrote: Hi!, I am developing a

Re: xmlrpc idea for getting around the GIL

2009-12-09 Thread Patrick Stinson
On Wed, Dec 2, 2009 at 7:42 AM, sturlamolden wrote: > On 2 Des, 02:47, Patrick Stinson > wrote: > >> We don't need extension modules, and all we need to do is run some >> fairly basic scripts that make callbacks and use some sip-wrapped >> types. > > Sure,

using freeze.py with python3

2009-12-09 Thread Patrick Stinson
Has anyone tried using Python-3.1.1/Tools/freeze/freeze.py with the encodings package? It appears that encodings is required to intialize the interpreter, but PyImport_ImportFrozenModule is failing for the "encodings" module in marshal.c:r_object(), after trying to demarshal an object of type 0. T

Re: Graph library for Python

2009-12-09 Thread Patrick Laban
reason not to have both forms of the > initialiser. If not, that weighs against having 'name' as a dictionary key. > > > -- > Rhodri James *-* Wildebeest Herder to the Masses > -- > http://mail.python.org/mailman/listinfo/python-list > Both methods are equivalent. Patrick Laban -- http://mail.python.org/mailman/listinfo/python-list

freeze in python3

2009-12-09 Thread Patrick Stinson
NOTE: This is related but is not a duplicate of my post from yesterday. Has anyone used Tools/freeze/freeze.py in python3? I tried it with a clean source distribution and for some reason freeze.py is generating code that uses the old naming convention for module init functions. I get the following

Re: freeze in python3

2009-12-10 Thread Patrick Stinson
awesome! On Thu, Dec 10, 2009 at 2:17 PM, Martin v. Loewis wrote: >> For example, initerrno should now be PyInit_errno. Am I missing something? > > No; freeze hasn't been ported to Python 3 yet. Contributions are welcome. > > Regards, > Martin > -- > http://mail.python.org/mailman/listinfo/python

Re: Python book

2009-09-30 Thread Patrick Sabin
My favorite book is "Python Essential Reference" from David M. Beazley. It is not a beginner book. It is about the python language and not about a framework or third-party library. It is much more complete than for instance "Dive into python", but maybe somewhat more di

SVG PIL decoder

2009-09-30 Thread Patrick Sabin
I would like to open svg files with PIL, but svg doesn't seem to be supported. Does anyone know about a svg decoder for the PIL? - Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: SVG PIL decoder

2009-09-30 Thread Patrick Sabin
Donn wrote: Have a look at Cairo (python-cairo) in conjunction with librsvg (python-rsvg) -- that'll fix you up. You can go from an SVG to a PNG/array and thence into PIL if you need to. Thanks for the tip. Got it work, although it was a bit tricky, as resizing doesn't seem to be supported by

setuptools, accessing ressource files

2009-10-02 Thread Patrick Sabin
tried pkg_resources.get_distribution('dist').get_metadata('images/image.png') with a similar error (IOError) What is the best way to access images distributed in an egg file? -Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & Go

2009-11-12 Thread Patrick Sabin
Carl Banks wrote: Well, it's hard to argue with not being like C++, but the lack of inheritance is a doozie. Well it has the concept of embedding, which seems to be similar to inheritance. - Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & Go

2009-11-12 Thread Patrick Sabin
enerators (although I haven't look at them in detail). There is no exception handling, but channels should be able to substitute them, although I haven't checked that. At a first look it seems, that using Google Go effectively, someone has to relinquish many programming

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Patrick Sabin
Peng Yu wrote: I'm wondering if there is something similar to list comprehension for dict (please see the example code below). Do you mean something like this: >>> {i:i+1 for i in [1,2,3,4]} {1: 2, 2: 3, 3: 4, 4: 5} This works in python3, but not in python2 - P

xmlrpc idea for getting around the GIL

2009-11-22 Thread Patrick Stinson
Has anyone every tried wrapping the CPython lib into a daemon with an RPC mechanism in order to move the GIL out of the process? I have multiple audio threads, each of which use the python interpreter but don't have to interact with each other and can might as well use a separate interpreter handle

Re: xmlrpc idea for getting around the GIL

2009-11-22 Thread Patrick Stinson
that's right. I cannot make CPython calls from my original C-based threads. On Sun, Nov 22, 2009 at 3:15 PM, Diez B. Roggisch wrote: > Daniel Fetchinson schrieb: >>> >>> Has anyone every tried wrapping the CPython lib into a daemon with an >>> RPC mechanism in order to move the GIL out of the pro

Re: xmlrpc idea for getting around the GIL

2009-11-23 Thread Patrick Stinson
On Mon, Nov 23, 2009 at 1:01 AM, Carl Banks wrote: > On Nov 22, 10:58 pm, Patrick Stinson > wrote: >> On Sun, Nov 22, 2009 at 3:15 PM, Diez B. Roggisch >> wrote: > icating) the multiprocessing module would be ideal. >> > The problem is that the OP has a embedd

Re: Dictionary or Database—Please advise

2010-02-26 Thread Patrick Sabin
at? Shelve uses caching, so it is likely to be faster than a self-made solution. However, accessing disk is much slower than accessing RAM. Jeremy - Patrick -- http://mail.python.org/mailman/listinfo/python-list

Draft PEP on RSON configuration file format

2010-02-28 Thread Patrick Maupin
All: Finding .ini configuration files too limiting, JSON and XML to hard to manually edit, and YAML too complex to parse quickly, I have started work on a new configuration file parser. I call the new format RSON (for "Readable Serial Object Notation"), and it is designed to be a superset of JSON

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Feb 28, 9:18 pm, Steven D'Aprano > Wait a minute... if JSON is too hard to edit, and RSON is a *superset* of > JSON, that means by definition every JSON file is also a valid RSON file. > Since JSON is too hard to manually edit, so is RSON. Well, Python is essentially a superset of JSON, with st

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 12:39 am, John Nagle wrote: > Patrick Maupin wrote: > > All: > > > Finding .ini configuration files too limiting, JSON and XML to hard to > > manually edit, and YAML too complex to parse quickly, I have started > > work on a new configuration file parser.

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 11:13 am, Robert Kern wrote: > Ignore it. That comment really doesn't apply to this case. That's for things > that only make sense in the language or standard library, like context > managers. > For libraries like this, Steven's summary is correct. It needs to have a > useful > life as

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 12:03 pm, Paul Rubin wrote: > But you are working on a solution in search of a problem.  The really > smart thing to do would be pick something more useful to work on.  We > don't need another configuration language.  I can't even say "yet > another" because there's already a "yet anoth

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
> > Certainly. The PEP format is a useful one. I've used it myself for some numpy > design documents. But can you see why people might get confused about your > intentions when you call it a draft PEP and post it to python-dev? If you stop > calling it a PEP and stop talking about putting it in the

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 12:40 pm, Daniel Fetchinson wrote: > > But you are working on a solution in search of a problem.  The really > > smart thing to do would be pick something more useful to work on.  We > > don't need another configuration language.  I can't even say "yet > > another" because there's alread

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 1:37 pm, Paul Rubin wrote: > There are in fact quite a few--json, yaml, .ini, xml, Python literals > (http://code.activestate.com/recipes/364469-safe-eval/), s-expressions, > actual Python code that the application can import, and so forth. Yes, I know about those. > The problem isn't

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 2:08 pm, Paul Rubin wrote: > Yaml sucks, but seems to have gotten some traction regardless. Yes, that's actually one of the reasons I want to do this. I've heard that some of the YAML people want that in the standard library, and IMHO that would be a huge mistake. > Therefore the Pyt

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 2:42 pm, Paul Rubin wrote: > Patrick Maupin writes: > > But for my use-case, YAML is irretrievably broken.  Sure, it looks > > reasonably nice, but it increases regression runtime unacceptably. > > How big are the files that you want to parse with it?  Sheesh. Ti

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 5:33 pm, Erik Max Francis wrote: > Psst.  That you're allowed to present the idea that you think is good > doesn't mean that other people aren't allowed to respond and point out > that in their opinion it's not such a good idea.  You don't own this or > any other thread. Absolutely, but

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mar 1, 5:57 pm, Erik Max Francis wrote: > Patrick Maupin wrote: > This not only seriously stretching the meaning of the term "superset" > (as Python is most definitely not even remotely a superset of JSON), but Well, you are entitled to that opinion, but seriously, i

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
separate PDF files. Best regards, Pat On Mon, Mar 1, 2010 at 8:02 PM, Kirill Simonov wrote: > Patrick Maupin wrote: >> >> All: >> >> Finding .ini configuration files too limiting, JSON and XML to hard to >> manually edit, and YAML too complex to parse quickly

Re: Draft PEP on RSON configuration file format

2010-03-01 Thread Patrick Maupin
On Mon, Mar 1, 2010 at 8:02 PM, Kirill Simonov wrote: BTW, congratulations on slogging through the YAML grammar to generate such a good working C library! That must have been a tremendous effort. Regards, Pat -- http://mail.python.org/mailman/listinfo/python-list

Re: Draft PEP on RSON configuration file format

2010-03-02 Thread Patrick Maupin
On Mar 2, 11:59 am, Terry Reedy wrote: > To me, comparing object notation with programming language is not > helpful to the OP's purpose. Yes, I agree, it was a distraction. I fell into the trap of responding to the ludicrous claim that "if X is a superset of Y, then X cannot possibly look bett

Re: Draft PEP on RSON configuration file format

2010-03-02 Thread Patrick Maupin
On Mar 2, 5:36 pm, Steven D'Aprano wrote: > You seem to be taking the position that if you start with a config file > config.json, it is "too hard to edit", but then by renaming it to > config.rson it magically becomes easier to edit. That *is* ludicrous. No, but that seems to be the position you

Re: Draft PEP on RSON configuration file format

2010-03-02 Thread Patrick Maupin
On Mar 2, 9:20 pm, Erik Max Francis wrote: > Patrick Maupin wrote: > > On Mar 2, 5:36 pm, Steven D'Aprano > cybersource.com.au> wrote: > >> You seem to be taking the position that if you start with a config file > >> config.json, it is "to

Initial RSON prototype parser in subversion

2010-03-05 Thread Patrick Maupin
I have not yet added indentation sensitivity to the parser (although the tokenizer saves the indentation information for the parser), but the initial prototype parses all of JSON plus a lot of syntax enhancements (comments, hex/binary/octal numbers, relaxed quoting requirements for strings, trailin

ANNOUNCE: RSON v 0.02 available

2010-03-11 Thread Patrick Maupin
RSON (Readable Serial Object Notation) is a superset of JSON that is suitable for files that humans have to edit and diff. The current release is decoder-only, but the decoder will read files encoded by JSON encoders such as json or simplejson. The current release consists of a single Python modu

Re: building a dict

2010-03-13 Thread Patrick Maupin
On Mar 13, 9:05 am, vsoler wrote: > Say that "m" is a tuple of 2-tuples > > m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6)) > > and I need to build a "d" dict where each key has an associated list > whose first element is the count, and the second is the sum. If a 2- > tuple contains a No

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Patrick Maupin
On Mar 13, 10:19 am, Jon Clements wrote: > What I'd like to achieve is something similar to: > > @inject(B): >  def some_function(a, b): >      pass # something useful So, just typing at the keyboard here, you mean something like: class InjectClass(object): def __init__(self, func, *args, *

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Patrick Maupin
On Mar 13, 10:38 am, Jon Clements wrote: > On 13 Mar, 16:26, Patrick Maupin wrote: > > > > > On Mar 13, 10:19 am, Jon Clements wrote: > > > > What I'd like to achieve is something similar to: > > > > @inject(B): > > >  def some_function(

<    1   2   3   4   5   6   7   >