Re: Py_BuildValue or PyList_SetItem()

2007-01-03 Thread Jack Diederich
op = 0; > return Py_BuildValue("N",Rva); > } > > Results in Python: > > , , 0x80d885c>, , , at 0x80d885c>, , , > , , 0x80d885c>, > PyList_SetItem steals a reference to "op" so DECREF'ing it reduces the refcount to zero. http://docs.python.org/api/listObjects.html -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast generation of permutations

2006-01-25 Thread Jack Diederich
e.net/ import probstat cards = range(52) for (hand) in probstat.Combination(card, 5): pass Takes 1.3 seconds on my laptop instead of 17 seconds for the pure python version which is only one order of magnitude faster. Creating and populating 2598960 list objects one at a time isn't free

Re: Pulling all n-sized combinations from a list

2006-02-09 Thread Jack Diederich
On Wed, Feb 08, 2006 at 12:50:19PM -0800, Swroteb wrote: > Hi there, > > I've got a reasonably sized list of objects that I'd like to pull out > all combinations of five elements from. Right now I have a way to do > this that's quite slow, but manageable. I know there must be a better > way to d

Re: Pulling all n-sized combinations from a list

2006-02-09 Thread Jack Diederich
On Thu, Feb 09, 2006 at 10:23:12AM -0800, [EMAIL PROTECTED] wrote: > Jack Diederich wrote: > > On Wed, Feb 08, 2006 at 12:50:19PM -0800, Swroteb wrote: > > > Hi there, > > > > > > I've got a reasonably sized list of objects that I'd like to pull ou

Re: Pulling all n-sized combinations from a list

2006-02-09 Thread Jack Diederich
liberally snipped out parts On Thu, Feb 09, 2006 at 03:25:18PM -0800, [EMAIL PROTECTED] wrote: > Jack Diederich wrote: > > > > On Wed, Feb 08, 2006 at 12:50:19PM -0800, Swroteb wrote: > > > > > > > > > > I've got a reasonably sized list

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Jack Diederich
On Mon, Feb 13, 2006 at 08:52:06PM +, John Salerno wrote: > Terry Hancock wrote: > > > So what's a 1-element tuple, anyway? A "mople"? "monople"? > > It does seem like this lopsided pythonic creature (1,) ought > > to have a name to reflect its ugly, newbie-unfriendly > > nature. > > > > Are

Re: how do you pronounce 'tuple'?

2006-02-14 Thread Jack Diederich
On Tue, Feb 14, 2006 at 10:40:09AM -0500, Tim Peters wrote: > > the-acid-test-is-whether-you-say-"xor"-with-one-syllable-or-three-ly y'rs - > tim "Zorr!" of course. Saying "All hail the mighty Exclusive Or!" would just sound silly. -jackdied -- http://mail.python.org/mailman/listinfo/python-

Re: Soduku

2006-02-14 Thread Jack Diederich
On Tue, Feb 14, 2006 at 05:32:48PM -0800, Jonathan Gardner wrote: > Here at my job, Python gets no respect. > > A programmer here wanted to see which language among Python, Perl, and > Java was better. So he wrote a Python, perl, and Java version. Except > the Python version was 20x slower than th

Re: Soduku

2006-02-15 Thread Jack Diederich
On Wed, Feb 15, 2006 at 06:56:56PM -0800, Raymond Hettinger wrote: > [Jack Diederich] > > Is my math off or does 27ms mean 0.027 seconds? On my laptop (1.3GHz) > > an empty python program takes 10ms to run (0.010 secs). I ask out of > > vanity, my own solver takes .15 secon

Re: Proper class initialization

2006-03-01 Thread Jack Diederich
On Wed, Mar 01, 2006 at 09:25:36PM +0100, Christoph Zwerschke wrote: > Usually, you initialize class variables like that: > > class A: > sum = 45 > > But what is the proper way to initialize class variables if they are the > result of some computation or processing as in the following silly

Re: Adding new methods to new-style classes dynamically

2005-05-05 Thread Jack Diederich
On Thu, May 05, 2005 at 01:35:09AM -0700, Max Derkachev wrote: > Good day to all. > > Some time ago I'd been playing with a framework which uses dynamic > class creation havily. Say, I could do: > > #well, try this with the new-style class > class A(object): > pass > > # the new-style __dic

Re: Is Python suitable for a huge, enterprise size app?

2005-05-18 Thread Jack Diederich
On Wed, May 18, 2005 at 08:37:00AM -0700, john67 wrote: > The company I work for is about to embark on developing a commercial > application that will cost us tens-of-millions to develop. When all is > said and done it will have thousands of business objects/classes, some > of which will have hun

Re: MUD Client and Python Plugin Framework

2005-05-23 Thread Jack Diederich
On Mon, May 23, 2005 at 10:51:47AM -0700, Discipulus wrote: > Hey, > I'm contemplating starting a MUD client in Python, and I would like to > make it so that people can write their own plugins, but I need ideas on > the framework. Any suggestions? Use Lyntin? (http://lyntin.sourceforge.net/) An ex

Re: Want to learn Python

2007-06-15 Thread Jack Crane
www.pythonware.com/daily/4368043588838810608/ Jack Crane -- http://mail.python.org/mailman/listinfo/python-list

Re: Descriptor/Decorator challenge

2007-03-07 Thread Jack Diederich
e. I could be wrong on the byte-hack part as I've only recently learned to read the chicken bones that are byte codes (thanks to PyCon sprints I got to spend time picking python-devs's brains over burritos). It seem plausible if fragile. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Python object overhead?

2007-03-23 Thread Jack Diederich
h of the records in serial you only have the class overhead for one at any given time. Hope that helps, -Jack -- http://mail.python.org/mailman/listinfo/python-list

reading cookies from PHP

2007-12-10 Thread Jack Holt
Hello there. I’m a PHP fan but a Python newbie. I wrote anapplication in Python that needs to read a cookie setup from a PHP page. Is itpossible to do it? If not, what if I create a TXT file - as well as a cookie - thatcontains the cookie’s data? Will python be able to open the file and

Re: Queue can result in nested monitor deadlock

2006-04-17 Thread Jack Diederich
else_to_do_something() # waits forever -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does built-in set not take keyword arguments?

2006-05-04 Thread Jack Diederich
be maximally set-like. We're all adults here so I'd call it a bug. bufferobect, rangeobject, and sliceobject all do this too, but classmethod and staticmethod both check in tp_init. Go figure. As a work around use a function to make the set-alike. class NamedSet(set): pass def make_n

Re: how to remove 50000 elements from a 100000 list?

2006-05-05 Thread Jack Orenstein
ists are ordered in the same way, then you could walk through the lists in order using a merge procedure, generating a new list as you go. After ruling out slow data structures and algorithms, you'll almost certainly be better off using something built in to Python rather than c

Re: A critic of Guido's blog on Python's lambda

2006-05-05 Thread Jack Diederich
o it is a safe bet. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: interactive shell -- reload definitions?

2006-05-10 Thread Jack Diederich
d. It can never be made magic enough. > Given the persistent push of Ruby, I would strongly recommend that a > workable integrated solution will be found for Reload & Go in Python, > taking priority on many way out features of rather low practicality for > many programmers. Link? Goo

Re: Google-API Bad-Gateway-Error

2006-05-16 Thread Jack Diederich
# chronic failure, reraise the last error The job runs nightly at O'Dark thirty. I get one chronic failure every few months. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming language productivity

2006-05-19 Thread Jack Diederich
now the internals. If you are going to complain please at least post some context about what you think should happen and some links to how other folks have implemented it. Asserting python should do 'Reload and Go' isn't very helpful. -Jack [1] I googled up a reference to it here <http://www.unpossible.com/2006/04/20/time-saver-rails-console-reset/#comments> -- http://mail.python.org/mailman/listinfo/python-list

wxEVT_SCROLL_ENDSCROLL

2008-01-31 Thread Jack Holt
Hello, I got the following error: Traceback (most recent call last): File "vplayer.py", line 15, in ? File "config.pyo", line 3, in ? File "wx\__init__.pyo", line 44, in ? File "wx\_core.pyo", line 3592, in ? AttributeError: 'module' object has no attribute 'wxEVT_SCROLL_ENDSCROLL' I ne

How to autorun a python script when a specific user logs on?

2008-02-05 Thread jack trades
vice, but wouldn't that make the program start for any user that logs on? Thanks for sparing some time, Jack Trades PS. The source for the logger is below. I'll post the source for the reader when I'm finished if anyone's interested (I'll also post it to uselesspython when t

Re: How to autorun a python script when a specific user logs on?

2008-02-05 Thread jack trades
dangerous situations.) I'll be modifying the program to watch for certain keywords which will enable the logging, so as to give his kids some degree of 'privacy' as I think that is important. Afterall how exciting would life be if you couldn't sneak a peek at the occasional naked woman :) Jack Trades -- http://mail.python.org/mailman/listinfo/python-list

Re: How to autorun a python script when a specific user logs on?

2008-02-07 Thread jack trades
to autostart the program for: def autostartProgram(name, location): os.system(r'reg add HKCU\software\microsoft\windows\currentversion\run /v %s /t REG_SZ /d %s' % (name, location) ) Jack Trades -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not a Python compiler?

2008-02-08 Thread jack trades
thon can run Python code in two modes, interpreted or compiled. In the latter case, the Lisp code is translated into assembly. The advantage of interpreted code is that debugging is easier (the stack trace contains more information); on the other hand execution of compiled code is much faster. Jack Trades -- http://mail.python.org/mailman/listinfo/python-list

Re: How to autorun a python script when a specific user logs on?

2008-02-08 Thread jack trades
"Wolfgang Draxinger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > jack trades wrote: > > > Honestly I never even thought of that, it just sounded like a > > fun, and easy, > > project to put my mediocre programming skills to some use.

Know Your Python-Devs!

2008-03-22 Thread Jack Diederich
http://jackdied.blogspot.com/2008/03/misc-from-pycon-ii.html Enjoy, -Jack -- http://mail.python.org/mailman/listinfo/python-list

UICrawler

2008-10-15 Thread mccarth . jack
Hello all, I am trying to run the Universal information crawler wed spider on my mac. It seems to install without any trouble but when, in unix command line, I try to run "paster create --list-templates" it returns this Value Code error. I followed instructions provided at http://lucasmanual.com/m

str.Template 4 times slower than calling replace multiple times

2009-03-08 Thread Jack Steven
Isn't string.Template suppose to be faster than calling replace multiple times? That's what I thought until I benchmarked this code, where string.Template ended up being 4 times slower. This doesn't make sense to me, since unlike when you are calling replace multiple times, code behind Template ca

Re: Measuring time of a telnet connect

2009-04-15 Thread Jack diederich
ime.time() conn = telnetlib.Telnet('localhost', 80) print time.time() - start -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: telnetlib in python-3.0

2009-04-29 Thread Jack Diederich
reproduce the behavior in a testable snippet please submit a bug and assign it to me on bugs.python.org (jackdied on the bug tracker). -Jack -- http://mail.python.org/mailman/listinfo/python-list

Subversion commit from Python?

2009-05-18 Thread Jack Trades
I'm wondering if there's an easy way to do a 'svn commit' on a directory from Python. More Details: I have a wiki-like program that stores its data in a directory that I would like to put under version control to be able to roll back unwanted changes. The program is stored in two directories, a '

Re: Subversion commit from Python?

2009-05-18 Thread Jack Trades
On May 19, 12:26 am, Lawrence D'Oliveiro wrote: > In message <2904e7de-0a8d-4697-9c44- > > c83bb5319...@s31g2000vbp.googlegroups.com>, Jack Trades wrote: > > Originally I had the 'data' directory in the same directory as the cgi > > scripts and was usi

Re: Subversion commit from Python?

2009-05-19 Thread Jack Trades
On May 19, 3:46 am, Duncan Booth wrote: > Jack Trades wrote: > > Originally I had the 'data' directory in the same directory as the cgi > > scripts and was using os.system("svn commit"), however I kept running > > into weird bugs with this method.  So

Re: Subversion commit from Python?

2009-05-19 Thread Jack Trades
On May 19, 3:53 am, Lawrence D'Oliveiro wrote: > In message > d9e205be7...@s31g2000vbp.googlegroups.com>, Jack Trades wrote: > > On May 19, 12:26 am, Lawrence D'Oliveiro > central.gen.new_zealand> wrote: > > >> In message

Re: Popen: NameError: name 'PIPE' is not defined

2008-05-24 Thread Jack Yu
On Sat, 24 May 2008 14:09:07 +0200,Mathieu Prevot wrote: > Hi > > I import subprocess and use Popen, but PIPE is not defined. I used > 2.5.1, 2.5.2, Python 2.6a3+ (trunk:63576, May 24 2008, 12:13:40), it's > always the same. What am I missing ? > > Thanks > Mathieu Try subprocess.PIPE. -- http:

Re: Silly import question (__file__ attribute)

2006-03-09 Thread Jack Diederich
.3.5-8ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> import thread >>> sys.modules['thread'] >>> thread >>> ^D sprat:~# cd ~/src/python-head/Modules/ sprat:~/src/python-head/Modules# ls thread* threadmodule.c threadmodule.o It is a built-in module so it doesn't have a .so (dll) or .py file to mention. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Markov process representation

2006-03-15 Thread Jack Diederich
hensions are new in 2.4. Try: > >self._all_states |= set([key[i] for key in probabilities]) And sets aren't a builtin in 2.3 try: set() except NameError: import sets set = sets.Set -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance profiling Python code

2006-03-24 Thread Jack Diederich
and store it in the tiles (assuming the tiles don't move around). As a last resort you can write the sensitive bits in C and add a python wrapper. For the ICFP contest[1] each year I write the few primitives in C and all the logic in python and it works quite well. -Jack [1] http://icfpcontest.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-04-01 Thread Jack Diederich
Xah, is that you? -- http://mail.python.org/mailman/listinfo/python-list

Re: Manipulating sets from the 2.4 C API?

2006-04-11 Thread Jack Diederich
or is there some more explicit set support somewhere > I'm not seeing? There are people that use sets from C-code but I don't know if they use the slotted methods, the 2.5 version, or a special build. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing backwards compatible code

2006-04-14 Thread Jack Diederich
If you want to support 2.3 just use the yield version. Having two versions of the same thing is asking for trouble. Twice the tests, twice the room for breakage, twice the places to update if you want to change it. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Any Swisses here?

2010-01-03 Thread Jack Diederich
ggling young AI trying to extrapolate the average content of an alt.group to the comp.lang community. The fact that it passed the gmail spam filters is a sign of progress. So hello new friend, and your backgroung is the best rockets! -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASED] Python 2.7 alpha 2

2010-01-09 Thread Jack Diederich
n 2009 http://pycon.blip.tv/file/1949345 by a very handsome and well beloved man, and come to pycon 2010 where there will be a couple more talks on the subject by slightly more homely but none the less competent speakers. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Python RPG Codebase

2009-10-01 Thread Jack Diederich
n I did in my classes proper (probably because I spent hundreds of hours in class but thousands of hours writing LPC). -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Jack Diederich
It's Xah Lee, he's been trolling this and every other programing language group for over 10 years (preferably all at once). Let it go. On Sat, Oct 3, 2009 at 2:53 AM, Chris Withers wrote: > Xah Lee wrote: >> >> Haskell has a new logo. A fantastic one. Beautiful. For creator, >> context, detail,

Re: Is there a better way to code variable number of return arguments?

2009-10-08 Thread Jack Norton
same thing? How about using yield and then iterate over the answer: def some_fun(): \tfor result in some_loopable_stuff: \t\t yield result Then call it thusly: for i in some_fun() result = i -Jack (PS, sorry to the OP, you will get two of these -- I forgot to CC the list

Re: Reading hex to int from a binary string

2009-10-09 Thread Jack Norton
x[1] output: 'A' That should be enough to get you started in the right direction. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-14 Thread Jack Norton
o do the same thing. I think this is a perfect example of `while True:` that works damn well, and there isn't anything that can replace its simplicity. Programming practices be damned, it is invaluable, and I would recommend doing it in my situation to any person, regardless of programming experience. Food for thought. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: What is Islam?-1

2009-10-21 Thread Jack Norton
ust ignore them please, and if someone *kindly* asks you to keep it on topic, then *please* do so. -jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Read any function in runtime

2009-10-26 Thread Jack Norton
I'd like to add that there are several lisp apps out there that give you a REPL (for example stumpwm). A REPL could be seen as a sophisticated `eval' loop. Case in point, it is common in the lisp world. You could, in theory, hose your system from inside emacs (and you may not even

Re: My own accounting python euler problem

2009-11-07 Thread Jack Diederich
nds to brute force a solution then you probably have more problems than just matching checks to invoices... -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: list.extend([]) Question

2010-02-05 Thread Jack Diederich
ing story with no whiz-bang feature behind it, but I like that the language behaves that way for exactly that reason. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings considered too complicated

2010-02-24 Thread Jack Diederich
9 seems to work for me. kill -1 -1 Back in the days of thin X terminals I used that one as a quicker alternative to actually logging out. It is also useful if you start a fork bunny and need to hit the panic switch before the machine grinds to a halt. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: NoSQL Movement?

2010-03-03 Thread Jack Diederich
On Wed, Mar 3, 2010 at 12:36 PM, Xah Lee wrote: [snip] Xah Lee is a longstanding usenet troll. Don't feed the trolls. -- http://mail.python.org/mailman/listinfo/python-list

Re: Generic singleton

2010-03-03 Thread Jack Diederich
languages don't necessarily suffer from Java's design flaws. The original "Gang of Four" book was about C++ and not Java. The fact that you can casually assert that "Design Patterns" are about Java says something not entirely kosher about Java ;) -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: isinstance(False, int)

2010-03-05 Thread Jack Diederich
se > > Why do you need to check for True/False? > You should never check for "is" False/True but always check for equality. The reason is that many types support the equality (__eq__) and boolen (__bool__ in 3x) protocols. If you check equality these will be invoked, if you check identity ("is") they won't. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: isinstance(False, int)

2010-03-05 Thread Jack Diederich
On Fri, Mar 5, 2010 at 6:09 PM, Steven D'Aprano wrote: > On Fri, 05 Mar 2010 15:58:01 -0500, Jack Diederich wrote: > >>>> So, the pythonic way to check for True/False should be: >>>> >>>>>>> 1 is True >>>> False >>> &

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jack Diederich
l__(self, *args, **kw): return call_func(self, *args, *kw) return NewClass or the return could even be NewClass() [return an instance] if this is a one off. That said, I'm not really sure what this behavior is good for. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: class inheritance

2010-03-13 Thread Jack Diederich
new object but the subclass Value is compatible (as I would except since it is a sublcass) then just change all references in Franction.__add__ to be more generic, ex/ class Franction(): def __add__(self, other): return self.__classs__(self.denominator + other.denominator) That way if __

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jack Diederich
On Sat, Mar 13, 2010 at 12:10 PM, Jon Clements wrote: > On 13 Mar, 16:42, Jack Diederich wrote: >> On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements wrote: >> > This is semi-experimental and I'd appreciate opinions of whether it's >> > the correct design appro

Re: Dynamic Class Creation

2010-03-16 Thread Jack Diederich
element (get/find) and then put them in your class like this class Market(): code = ElemGetProperty('code') title = ElemFindProeprty('title') The getattr/setattr method is easier to understand and will handle arbitrary elements; for the descriptors version you'll have to define one for each tag that might be used on the class. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes as namespaces?

2010-03-26 Thread Jack Diederich
es are a valid use case (I do it all the time). Python 3 has a small cleanup that makes classes even closer to module namespaces; namely the concept of "unbound methods" goes away. In 3.x when you get a function from a class you get the function itself and not an unbound function. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: unittests with different parameters

2010-11-24 Thread Jack Keegan
Apologies if this is a bit off the wall but I've only just started getting into unit testing (in Python) this morning. Would generators help you in any way? You might be able to have a generator which would yield an attribute set combination each time it is called. I'm not sure if it would still st

To Thread or not to Thread....?

2010-11-30 Thread Jack Keegan
s through a set of C DLLs using Ctypes. Any help or suggestions will be greatly appreciated, Thanks very much, Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: To Thread or not to Thread....?

2010-12-01 Thread Jack Keegan
ile I read from there. It's probably some sort of ring buffer implementation so I'd have to read the frames out and store them to disk before the next run through the buffer overwrites the old frames. How does that sound, process/thread wise? Thanks, Jack -- The earth is a very small stage in

Re: TestFixtures 1.8.0 Released!

2011-01-14 Thread Jack Keegan
s will not work as expected. Therefore I'd like to mock out the ctypes dll calls. Can you give me an indication of how you would go about doing this with Simplistix? Just so you know, I use py.test for unit testing. Thanks, Jack On Fri, Jan 14, 2011 at 12:38 PM, Chris Withers wrote: > Hi

Re: TestFixtures 1.8.0 Released!

2011-01-14 Thread Jack Keegan
Appologies, please read the 2nd last line as: Can you give me an indication of how you would go about doing this with TestFixtures? :) Thanks Jack On Fri, Jan 14, 2011 at 2:39 PM, Jack Keegan wrote: > I'm new to python and have just been looking into a solution for Mocking >

Re: TestFixtures 1.8.0 Released!

2011-01-14 Thread Jack Keegan
Hi Chris, Thanks for that. I'll give it a go. Cheers, Jack On Fri, Jan 14, 2011 at 2:49 PM, Chris Withers wrote: > Hi Jack, > > > On 14/01/2011 14:39, Jack Keegan wrote: > >> objects. In particular, at the moment, testing some code that needs to >> access ha

method-to-instance binding, callable generator decorator

2011-01-26 Thread Jack Bates
Am struggling to understand Python method-to-instance binding Anyone know why this example throws a TypeError? > #!/usr/bin/env python > > import functools > > # Take a generator function (i.e. a callable which returns a generator) and > # return a callable which calls .send() > class coroutine

Re: Use the Source Luke

2011-01-28 Thread Jack Diederich
e wrote so I thought "Hey, I'll just ask Tim!" I asked him and he replied "I'm not sure what you're asking - do you want me to read the code aloud to you?" So I just went and read it. -Jack -- http://mail.python.org/mailman/listinfo/python-list

psd estimation no matplotlib

2011-02-05 Thread Jack Yu
administrator says that it is impractical to install matplotlib on all of them, because it requires X window, which takes up a lot of memory, which the computing nodes do not have. Thanks for any help in advance. Cheers, Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of list vs. set equality operations

2010-04-06 Thread Jack Diederich
rt() in a loop. Also, lists can have mutable members so there are times you really /do/ want to compare lists instead of hashes. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: [capi-sig] SWIG + expy

2010-05-01 Thread Jack Jansen
ormat, and if other people do the same for theirs we may be able to get to common ground... -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman -- http://mail.python.org/mailman/listinfo/python-list

Re: Ugly modification of a class, can it be done better ?

2010-05-20 Thread Jack Diederich
> Is this a valid construction ( sorry I'm not a programmer), > or are there better ways to accomplish similar dynamic behavior ? > You can have two classes and then just change the class of the instances that need it. class A(object): def method1(self): pass class B(A):

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread Jack Diederich
one that ever used "fishes". "loaves and fishes" would be familiar (but still archaic) to anyone who has read the King James Version of the bible. http://bible.cc/luke/9-16.htm -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Community (A Modest Proposal)

2010-06-12 Thread Jack Diederich
no code, don't even bother to use something that looks like a real name, and continually demand that volunteers (which we all are) write code to fulfill your speculative needs. If-it-walks-like-a-troll-and-smells-like-a-troll-it's-a-troll-ly, -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Jack Diederich
really directly saying anything about it. You want to import a name that is itself a namespace; preferably a module or package and sometimes a class. Importing constants can lead to trouble. ex/ from settings import DEBUG if DEBUG: log('debug is on!') The value of the flag gets fetched at import time. If code in another module updates settings.DEBUG later your module won't see it. ditto for exceptions. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: "is not" operator?

2010-07-08 Thread Jack Diederich
, or what makes sense in English, but rather "what was the obvious way to write an LL(1) syntax if you are a Dutchman who speaks English?" Hope-that-clears-things-up-ly, -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.intersect?

2009-06-10 Thread Jack Diederich
ing a defaultdict(list) as the main structure; it worked but was uglier by far { curr_val => [it1, it2, ..]} with dels and appends. -Jack ps, woops, I forgot to hit reply all the first time. -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.intersect?

2009-06-10 Thread Jack Diederich
u want to do and in clear prose. The stdlib isn't meant to have a one liner for everything. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.intersect?

2009-06-11 Thread Jack Diederich
On Thu, Jun 11, 2009 at 2:54 PM, Terry Reedy wrote: > Jack Diederich wrote: >> >> On Thu, Jun 11, 2009 at 12:03 AM, David M. Wilson wrote: >> [snip] >>> >>> I found my answer: Python 2.6 introduces heap.merge(), which is >>> designed exactly for th

Re: Perl's @foo[3,7,1,-1] ?

2009-06-13 Thread Jack Diederich
so the "1,2,3" tuple is always interpreted as a tuple and the square brackets always expect an int or a slice. Not including special cases everywhere means there isn't a short way to handle special cases but it also means human readers have to remember fewer special cases. Perl and Python make different tradeoffs in that respect. -Jack [1] http://www.perlmonks.org/?node_id=111952 -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-03 Thread Jack Diederich
(or release, or whatever) method.  I'd recommend making an > effort to call it and to rely on __del__ as little as possible. This. If you care enough about a resource to write a __del__ method you care enough to clean it up explicitly. 'with' blocks are very nice for that. -jack -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators - would be nice if...

2009-07-14 Thread Jack Diederich
that uses a custom dictionary. This was added to make some common cases easier (like knowing in which order members were defined). This is not backportable to 2.6 because the __metaclass__ is defined inside the class body and possibly anywhere in the class body. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Why aren't OrderedDicts comparable with < etc?

2009-07-16 Thread Jack Diederich
n the face of ambiguity, refuse the temptation to guess. It isn't an OrderedDict thing, it is a comparison thing. Two regular dicts also raise an error if you try to LT them. What does it mean for a dict to be greater than or less than its peer? Nothing, so we refuse to guess. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Try... except....Try again?

2009-07-17 Thread Jack Diederich
t): while len(primes) < n: primes.append(next_prime()) return primes[n] -Jack [1] http://www.catonmat.net/blog/solving-google-treasure-hunt-prime-number-problem-four/#comment-3075 There is a deque implementation that is faster still but I can't find a link. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why aren't OrderedDicts comparable with < etc?

2009-07-20 Thread Jack Diederich
On Mon, Jul 20, 2009 at 10:00 AM, Steven D'Aprano wrote: > On Mon, 20 Jul 2009 09:34:24 +, Sion Arrowsmith wrote: > >> Terry Reedy   wrote: >>>Sion Arrowsmith wrote: >>>> Jack Diederich   wrote: >>>>> It isn't an OrderedDict thing, it

Re: Mutable Strings - Any libraries that offer this?

2009-07-26 Thread Jack Diederich
s on how mutable you want your strings. There have been several patches proposed on python-dev over the years that do things like lazy concatenation and ropes. They were always shot down because the implementation or the semantics were very complicated. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Retracing your steps in an interactive python env

2009-09-14 Thread Jack Norton
e still in this interactive shell session I could do something like: In [1]: what_is_in(func) "The def for func(input) is:" print "im in this function!" + str(input) print "doing some stuff" sleep(10) and therefore be able to recount what I just did. Cheers, Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: regex search with a space as the fist character

2009-09-17 Thread Jack Norton
it all, instead of forcing an index, not to mention trying to find the most specific regexp that works(least generic -- I don't want any false positives). I also do _not_ like having spaces in the regexp itself. If I need more than one space I'll use '\s*' or '\s+'. Al

Re: socket send O(N**2) complexity

2009-09-21 Thread Jack Diederich
ns it. There are no new allocations at all. Be very careful recommending optimizations based on how you think the underlying implementation works without double checking with the code first. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: socket send O(N**2) complexity

2009-09-22 Thread Jack Diederich
On Tue, Sep 22, 2009 at 7:25 PM, Nobody wrote: > On Mon, 21 Sep 2009 16:33:08 -0400, Jack Diederich wrote: > >>> AIUI, as a python string is imutable, a slice of a string is a >>> new string which points (C char *) to the start of the slice data >>> and with a

State Machines in Python

2010-09-04 Thread Jack Keegan
tion of the switch using dictionaries but someone had commented that creating and throwing away dictionaries also comes at a cost. I was wondering if any of you could advise or point me in the right direction. Any help would be greatly appreciated. Thanks, Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: ConFoo spam?

2010-10-07 Thread Jack Diederich
interest to me every day on python-list. You get used to it. [For the record ConFoo /does/ interest me, but I can't take a week and a half off to do that plus PyCon]. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programmer needed in the LA area

2010-10-07 Thread Jack Diederich
rg/community/jobs/ is the appropriate place for this. 2) Comic sans? Wow. -Jack -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   >