Re: Is python worth learning as a second language?

2009-03-10 Thread Craig Allen
think. -craig -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python worth learning as a second language?

2009-03-09 Thread Nick Craig-Wood
++ only when necessary. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Any c header parser for generate ctypes module?

2009-03-09 Thread Nick Craig-Wood
C parser written in python? GCCXML is usually used to create ctypes-structures from headers. Look at http://pypi.python.org/pypi/ctypeslib/ And the h2xml and xml2py scripts that are part of it. You'll need gccxml too as Diez pointed out. A definite time saver! -- Nick Craig-Wood n

Re: A better way to timeout a class method?

2009-03-09 Thread Nick Craig-Wood
/signal.html Won't work on windows and there is only one sigalarm timer, so you can't nest them :-( -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: A better way to timeout a class method?

2009-03-09 Thread Nick Craig-Wood
duration: print i i += 1 sleep(1) print finished long_function() Which prints starting 0 1 2 3 4 finished -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Craig Allen
On Mar 3, 10:17 am, Cool Dude mittal.aniket...@gmail.com wrote: Hello , This is Aniket from Techclique, a New Jersey based software development and IT consulting firm providing top quality technical and software professionals on a permanent and contractual basis to Government and commercial

Re: Using xreadlines

2009-02-28 Thread Nick Craig-Wood
/linecache.html Which may be useful... -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python Questions .....

2009-02-26 Thread Nick Craig-Wood
Ben bnsili...@gmail.com wrote: On Feb 24, 11:31?am, Nick Craig-Wood n...@craig-wood.com wrote: So do you want to embed python into your code? I'm still not clear what you are trying to achieve with python, though I have a better idea what SLAG is now! Actually no, I want to EXTEND

Re: intermediate python csv reader/writer question from a beginner

2009-02-24 Thread Nick Craig-Wood
='Charlie', a='17', b='18', day='Tuesday', time='1:00 PM' And leaves newfile.csv with the contents 1,2,3,Monday,1:00 PM 7,8,9,Tuesday,1:00 PM 4,5,6,Monday,2:00 PM -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python Questions .....

2009-02-24 Thread Nick Craig-Wood
handling menu and screen control. So do you want to embed python into your code? I'm still not clear what you are trying to achieve with python, though I have a better idea what SLAG is now! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman

Re: can multi-core improve single funciton?

2009-02-23 Thread Nick Craig-Wood
Calculation error print iterative, f_iterative print non iterative, f_noniterative print difference, f_iterative-f_noniterative -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python Questions .....

2009-02-23 Thread Nick Craig-Wood
a python extension in C then you do need to worry about reference counting - a lot! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Nick Craig-Wood
print self.B a = Stuff() a.main() Getting A None None Setting A Getting A aValue aValue -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading and tkinter

2009-02-20 Thread Craig Allen
The statement     x=x+1 (which, by the way, should stylistically be written     x = x + 1 yes I was wondering what x=x+1 meant until you translated it... oh, x = x + 1 of course! I thought to myself. Oh wait no I'm sarcastic. -- http://mail.python.org/mailman/listinfo/python-list

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Nick Craig-Wood
this GUI toolkit fits the same niche. Presumably since it uses SDL then all the GUI will appear in one window? So windows within windows in the MDI style? -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to determine if a string is a number

2009-02-16 Thread Nick Craig-Wood
= _float_pattern.search(value) if match: return float(match.group(1)) return 0.0 atof(15.5 Sausages) 15.5 atof( 17.2) 17.199 atof(0x12) 0.0 atof(8.3.2) 8.3007 atof(potato) 0.0 -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Nick Craig-Wood
to Cython. What sort of problems have you had? I find as long as I use the same types as the C code actually uses it all works fine. If on a 64 bit platform long is 64 bits then it will be under ctypes too. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http

Re: python in emacs

2009-02-15 Thread Craig
I would go to ubuntu linux if you can. --- On Sun, 2/15/09, Diez B. Roggisch de...@nospam.web.de wrote: From: Diez B. Roggisch de...@nospam.web.de Subject: Re: python in emacs To: python-list@python.org Date: Sunday, February 15, 2009, 9:23 AM kentand...@sbcglobal.net schrieb: When I visit a

Re: String concatenation performance with +=

2009-02-14 Thread Nick Craig-Wood
'import array' -s 'a = array.array(c)' 'a.extend(x)' 10 loops, best of 3: 2.01 usec per loop There are many other possibilities though like the mmap module. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: encrypting lines from file with md5 module doesn't work?

2009-02-14 Thread Nick Craig-Wood
means it is an md5 hash, the next $3nvOlOaw$ is the salt and the final $vRWaitT8Ne4sMjf9NOrVZ. is the md5 hash in some encoded format or other! Some googling should reveal the correct algorithm! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org

Re: Escaping my own chroot...

2009-02-13 Thread Nick Craig-Wood
Jean-Paul Calderone exar...@divmod.com wrote: On Wed, 11 Feb 2009 09:31:56 -0600, Nick Craig-Wood n...@craig-wood.com wrote: r0g aioe@technicalbloke.com wrote: I'm writing a linux remastering script in python where I need to chroot into a folder, run some system commands

Re: Escaping my own chroot...

2009-02-11 Thread Nick Craig-Wood
packages for it if you look! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Code critique xmlrpclib

2009-02-04 Thread Nick Craig-Wood
flagg ianand0...@gmail.com wrote: On Feb 3, 7:32?am, Nick Craig-Wood n...@craig-wood.com wrote: flagg ianand0...@gmail.com wrote: ?This xmlrpc server is designed to parse dns zone files and then ?perform various actions on said files. \ ?It uses dnspython, and xmlrpclib ? I'd like

Re: Cross platform compilation?

2009-02-04 Thread Nick Craig-Wood
commitment from the python maintainers. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb and MySQL stored functions

2009-02-04 Thread Nick Craig-Wood
kurt.forrester@googlemail.com kurt.forrester@googlemail.com wrote: Any ideas on how to suppress the warning output: __main__:1: Warning: No data - zero rows fetched, selected, or processed You can use the warnings module to suppress these I would have thought. -- Nick Craig-Wood n

Re: Code critique xmlrpclib

2009-02-03 Thread Nick Craig-Wood
for examples) Don't catch all exceptions - find out which exceptions are thrown. Consider just letting it propagate - hopefully the find_rdataset error is descriptive enough. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Does the Python community really follow the philospy of Community Matters?

2009-02-02 Thread Craig Allen
a langague with sense of community that advocates for their language over others is never in a spec. -craig -- http://mail.python.org/mailman/listinfo/python-list

[issue5131] pprint doesn't know how to print a set or a defaultdict

2009-02-02 Thread Nick Craig-Wood
New submission from Nick Craig-Wood n...@craig-wood.com: I noticed this the other day when debugging a program that neither set() nor defaultdict() pprint() properly Same under 3.1 and 2.5 (Not tried 2.6/2.7 but I assume it is the same) pprint(set(range(100))) set([0, 1, 2, 3, 4, 5, 6, 7, 8

Re: what IDE is the best to write python?

2009-02-01 Thread Craig
eclipse --- On Sun, 2/1/09, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: From: Dennis Lee Bieber wlfr...@ix.netcom.com Subject: Re: what IDE is the best to write python? To: python-list@python.org Date: Sunday, February 1, 2009, 3:31 AM On Sat, 31 Jan 2009 23:42:42 -0800 (PST),

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Nick Craig-Wood
() for t in threads: t.join() if print_result: try: while True: print queue.get(block=False) except Empty: pass if __name__ == __main__: #test_lock(processes=5, process=True) test_lock(processes=5) -- Nick Craig-Wood n...@craig-wood.com

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Nick Craig-Wood
to me. I'd love to be proved wrong though! If you were thinking of passing time.time() / clock_gettime(CLOCK_MONOTONIC) along in the Queue too, then you'll want to know that it can differ by significant amounts on different processors :-( Good luck! -- Nick Craig-Wood n...@craig-wood.com -- http

Re: ctype problem

2009-01-14 Thread Nick Craig-Wood
) ] myclib.myfunction.restype = c_int # or whatever If you do that then you should be able to pass in myiface directly or byref(myiface). -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: initialising a class by name

2009-01-14 Thread Nick Craig-Wood
'__main__.ThingTwo' class '__main__.ThingThree' -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python tricks

2009-01-13 Thread Nick Craig-Wood
or for i in infinite_loop(10): print iteration, i but I agree with Tim that a for ... else loop for the limit is clearer. Probably yes -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C or C++

2009-01-09 Thread Nick Craig-Wood
Thomas Heller thel...@python.net wrote: Nick Craig-Wood schrieb: Thomas Heller thel...@python.net wrote: Nick Craig-Wood schrieb: Interesting - I didn't know about h2xml and xml2py before and I've done lots of ctypes wrapping! Something to help with the initial drudge work

[issue4631] urlopen returns extra, spurious bytes

2009-01-09 Thread Craig Holmquist
Changes by Craig Holmquist craigh...@gmail.com: -- nosy: +craigh ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4631 ___ ___ Python-bugs-list

Re: Multiprocessing takes higher execution time

2009-01-08 Thread Nick Craig-Wood
of zip files is it? As reading zip files does lots of disk IO I would guess it is disk limited rather than anything else, which explains why doing many at once is actually slower (the disk has to do more seeks). -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http

Re: Creating new instances of subclasses.

2009-01-08 Thread Nick Craig-Wood
ValueError(Not a list) super(ListField, self).__init__(s) self.s = s.split(',') class StringField(Field): pass -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C or C++

2009-01-07 Thread Nick Craig-Wood
Thomas Heller thel...@python.net wrote: Nick Craig-Wood schrieb: Interesting - I didn't know about h2xml and xml2py before and I've done lots of ctypes wrapping! Something to help with the initial drudge work of converting the structures would be very helpful. ( http

Re: Multiprocessing takes higher execution time

2009-01-07 Thread Nick Craig-Wood
it sequentially. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C or C++

2009-01-06 Thread Nick Craig-Wood
saver. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing vs thread performance

2009-01-03 Thread Nick Craig-Wood
9000 working == == Thread 1 working == Total time: 834.81882 -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2009-01-02 Thread Craig Holmquist
Craig Holmquist craigh...@gmail.com added the comment: I haven't been able to try this patch myself yet, but I see a potential problem: the cookie variable is declared as a DWORD, while ActivateActCtx expects a ULONG_PTR. DWORD and ULONG_PTR are only the same thing in 32-bit Windows. Also

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2009-01-02 Thread Craig Holmquist
Craig Holmquist craigh...@gmail.com added the comment: The patch works fine on my system (32-bit XP). Also I verified in Process Explorer that there's only one instance of msvcr90.dll loaded. ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2009-01-01 Thread Craig Holmquist
Craig Holmquist craigh...@gmail.com added the comment: Here's an option, though unfortunately not a trivial one: use a private build of the C runtime. The Windows version of Firefox does this (mozcrt19.dll). The private CRT build doesn't use SxS in any way, so it gets around this issue

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2009-01-01 Thread Craig Holmquist
Craig Holmquist craigh...@gmail.com added the comment: test.c's error is can't find the DLL - this will be as we attempt to load Python's DLL - but this isn't the same as the original error, which is DLL init routine failed. To repro the initial error, I suspect you will want to put

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2009-01-01 Thread Craig Holmquist
Craig Holmquist craigh...@gmail.com added the comment: I took a look at this with the debugger, as Mark recommended. The CRT's DLLMain is called _CRTDLL_INIT, that in turn calls __CRTDLL_INIT. __CRTDLL_INIT calls another function, _check_manifest. _check_manifest calls an SxS function called

Re: I always wonder ...

2008-12-24 Thread Craig Allen
this is one of the most subtle trolls I've ever read. you sir, are a master! On Dec 22, 7:53 am, s...@pobox.com wrote: ... shouldn't people who spend all their time trolling be doing something else: studying, working, writing patches which solve the problems they perceive to exist in the

Re: How to modify a program while it's running?

2008-12-16 Thread Craig Allen
On Dec 16, 10:25 am, Joe Strout j...@strout.net wrote: Here's my situation: I'm making an AIM bot, but the AIM server will get annoyed if you log in too frequently (and then lock you out for a while). So my usual build-a-little, test-a-little methodology doesn't work too well. So I'd like

Re: Python is slow

2008-12-16 Thread Craig Allen
On Dec 14, 6:38 pm, cm_gui cmg...@gmail.com wrote: hahaha, do you know how much money they are spending on hardware to make youtube.com fast??? By the way... I know of a very slow Python site called YouTube.com. In fact, it is so slow that nobody ever uses it. less than they'd spend to

Re: [Python.NET] Where does the clr in IronPython look the dll

2008-12-12 Thread Craig Farrow
The dll needs to be on the Python path (sys.path). You can either add to the path with sys.path.append(c:\) or put your dll in a folder in the Python site-packages directory and add a .pth file (for Python.NET, but not IronPython -- it doesn't recognise the .pth files). Regards, Craig

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-12 Thread Nick Craig-Wood
David Cournapeau courn...@gmail.com wrote: On Thu, Dec 11, 2008 at 10:30 PM, Nick Craig-Wood n...@craig-wood.com wrote: David Cournapeau courn...@gmail.com wrote: On Wed, Dec 10, 2008 at 12:04 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Dec 9, 2008 at 6:49 PM, excor...@gmail.com

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-11 Thread Nick Craig-Wood
that easy_install doesn't have a) a list what you installed with easy_install b) uninstall in an otherwise excellent program. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python now coming from Perl

2008-12-09 Thread Nick Craig-Wood
Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Nick Craig-Wood [EMAIL PROTECTED] wrote: My favourite mistake when I made the transition was calling methods without parentheses. In perl it is common to call methods without parentheses - in python this does

Re: Learning Python now coming from Perl

2008-12-08 Thread Nick Craig-Wood
- in python this does absolutely nothing! pychecker does warn about it though. perl - $object-method python - object.method() -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-07 Thread Craig Holmquist
Craig Holmquist [EMAIL PROTECTED] added the comment: I don't quite understand this issue yet. python26.dll is linked with a manifest. Isn't that good enough? Apparently not, at least in my testing. It seems that if a DLL is loaded, Windows will try to resolve its dependencies by looking

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-06 Thread Craig Holmquist
New submission from Craig Holmquist [EMAIL PROTECTED]: Applications on Windows that don't link to the MSVCR90.DLL via a manifest are broken with Python 2.6.1. This includes apps that link with the C library statically and apps that link with other versions of it. These applications worked fine

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-06 Thread Craig Holmquist
Changes by Craig Holmquist [EMAIL PROTECTED]: Added file: http://bugs.python.org/file12249/testpy.c ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4566

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-06 Thread Craig Holmquist
Craig Holmquist [EMAIL PROTECTED] added the comment: I've attached the test program I was using. The commands I used to compile it are: cl /MT /c /IC:\Python26\include testpy.c link /LIBPATH:C:\Python26\libs testpy.obj ___ Python tracker [EMAIL PROTECTED

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-06 Thread Craig Holmquist
Craig Holmquist [EMAIL PROTECTED] added the comment: I've attached a manifest file that references the C runtime; adding this file to the Apache bin folder seems to workaround this issue. Added file: http://bugs.python.org/file12250/httpd.exe.manifest

[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-06 Thread Craig Holmquist
Craig Holmquist [EMAIL PROTECTED] added the comment: I understand the rationale behind #4120, but it seems like it only helps a narrow set of applications, namely applications that link dynamically with the same version of MSVCR90 as Python and that bundle the MSVCR90 DLL and that can't install

Re: How can I do this (from Perl) in Python? (closures)

2008-12-04 Thread Nick Craig-Wood
__call__(self): x = self.x self.x += 1 return x -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I do this (from Perl) in Python? (closures)

2008-12-04 Thread Nick Craig-Wood
and kwargs yield result def make_closure(*args, **kwargs): return closure(*args, **kwargs).next I still prefer doing it explicitly with a class though ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Do more imported objects affect performance

2008-12-03 Thread Nick Craig-Wood
. Then, *if it doesn't work fast enough*, make it work faster. You are 100% right of course Steve. I was just trying to answer the specific question which is faster question which probably isn't helpful for new Python programmers to focus on. PS I enjoyed your book :-) -- Nick Craig-Wood [EMAIL

Re: How to instantiate in a lazy way?

2008-12-03 Thread Nick Craig-Wood
fine! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to instantiate in a lazy way?

2008-12-03 Thread Nick Craig-Wood
Slaunger [EMAIL PROTECTED] wrote: On 3 Dec., 11:30, Nick Craig-Wood [EMAIL PROTECTED] wrote: ? ? ? ? ?cls = self.__class__ ? ? ? ? ?if attr_name in cls.data_attr_names: self.data_attr_names should do instead of cls.data_attr_names unless you are overriding it in the instance (which

Re: Do more imported objects affect performance

2008-12-02 Thread Nick Craig-Wood
import foo.bar.yourclass and use myclass.MyClass and foo.bar.yourclass.YourClass Ultimately it is a matter of taste I think! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to instantiate in a lazy way?

2008-12-02 Thread Nick Craig-Wood
Slaunger [EMAIL PROTECTED] wrote: On 2 Dec., 11:30, Nick Craig-Wood [EMAIL PROTECTED] wrote: For 4 attributes I'd probably go with the __getattr__. OK, I'll do that! Or you could easily write your own decorator to cache the result... Eg http://code.activestate.com/recipes

Re: How to instantiate in a lazy way?

2008-12-02 Thread Nick Craig-Wood
Slaunger [EMAIL PROTECTED] wrote: On 1 Dec., 16:30, Nick Craig-Wood [EMAIL PROTECTED] wrote: I wouldn't use __getattr__ unless you've got lots of attributes to overload. ?__getattr__ is a recipe for getting yourself into trouble in my experience ;-) Just do it like this... class

Re: Do more imported objects affect performance

2008-12-02 Thread Nick Craig-Wood
Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 02 Dec 2008 11:12:31 +, Nick Craig-Wood wrote: I prefer the from module import function. That means that if module doesn't supply function it raises an exception at compile time, not run time when you try to run module.function

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread Craig Allen
Just remember thought that if you threat Python like a hammer, suddenly everything will look like a bail. don't you mean if you use Python like a pitchfork? -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about class relationships

2008-12-02 Thread Craig Allen
what you have is a totally acceptable factory system. Not sure why you are using a generator, but that's another matter. I agree with the previous replies regarding inheritance... this is not a case for inheritance. You could, however, have Bar be a borg with the Bar factory built in as a class

Re: distinct fcntl flags for stdin and stdout

2008-12-01 Thread Nick Craig-Wood
result is because stdin and stdout refer to the same file (eg /dev/tty0 or /dev/pts/25). No idea whether this is correct behaviour or not though! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Do more imported objects affect performance

2008-12-01 Thread Nick Craig-Wood
(0)' 100 loops, best of 3: 1.48 usec per loop -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread Nick Craig-Wood
these features, don't know about Eclipse. In fact if I had to pick one feature that a programmer's editor must have it would be keyboard macros. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to instantiate in a lazy way?

2008-12-01 Thread Nick Craig-Wood
= self.really_read_the_data() return self._data -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread Craig Allen
I would never tell someone what editor to use in the same way I wouldn't tell someone what religion to believe in. Which is to say, I would tell my kids or other trusting soul... I used emacs for years, I was eventually convinced to start using nedit, which is quite nice. For an IDE, which I need

Re: How to get a directory file descriptor?

2008-11-26 Thread Nick Craig-Wood
at 0xb7d13cd4 dir_fd = 3 closed (rc 0) I don't know why os doesn't wrap - opendir, closedir, dirfd, readdir etc - I guess because except if you are doing something esoteric, then os.list and os.walk do everything you could possibly want. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig

Re: Python Django Latex Permissions Problem

2008-11-25 Thread Nick Craig-Wood
that dont have access to /tmp/pdfscratch{id} Unlikely - it takes root to change user and I wouldn't have thought any of the files would be setuid. Try chdir to /tmp/pdfscratch{id} first would be my suggestion. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: recommended __future__ imports for 2.5?

2008-11-25 Thread Nick Craig-Wood
... ;-) I think that is called using // instead of / which works without any from __future__ import from python 2.2 onwards. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: compressed serialization module

2008-11-19 Thread Nick Craig-Wood
greg [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: (Note that basic pickle protocol is likely to be more compressible than the binary version!) Although the binary version may be more compact to start with. It would be interesting to compare the two and see which one wins

Re: Finding the instance reference of an object

2008-11-19 Thread Craig Allen
I've just come to the conclusion it's not possible to call functions in python, to do so is undefined and indeterminate, like dividing by zero. Henceforth no calling functions for me as clearly it's the devil's playground. -- http://mail.python.org/mailman/listinfo/python-list

Re: compressed serialization module

2008-11-18 Thread Nick Craig-Wood
efficient. Eg import bz2 import pickle L = range(100) f = bz2.BZ2File(z.dat, wb) pickle.dump(L, f) f.close() f = bz2.BZ2File(z.dat, rb) M = pickle.load(f) f.close() M == L True (Note that basic pickle protocol is likely to be more compressible than the binary version!) -- Nick Craig-Wood

Re: setting permissions to a file from linux.

2008-11-18 Thread Nick Craig-Wood
Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: C Function Pointer Wrapping Example not working

2008-11-17 Thread Nick Craig-Wood
it with the swig wrapper before you make the .so -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Best practise hierarchy for user-defined exceptions

2008-11-17 Thread Nick Craig-Wood
if the above code worries you, then MyParseError isn't a ValueError and you shouldn't inherit from ValueError. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: compressed serialization module

2008-11-17 Thread Nick Craig-Wood
len(pickle.dumps([1,2,3], 0)) 18 Or even L = range(100) a = pickle.dumps(L) len(a) 496 b = a.encode(bz2) len(b) 141 c = b.decode(bz2) M = pickle.loads(c) M == L True -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-17 Thread Craig Allen
* Do all objects have values? (Ignore the Python docs if necessary.) If one allows null values, I am current thinking yes. I don't see a difference between a null value and not having a value. I think the difference is concrete... an uninitialized variable in C has no value, I'd say,

Re: C Function Pointer Wrapping Example not working

2008-11-16 Thread Nick Craig-Wood
easier. You just write C .so/.dll and use ctypes to access them. You can do callbacks and embedding python like this too. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Good practice when writing modules...

2008-11-16 Thread Nick Craig-Wood
do it! There are arguments against doing this, which I'm sure you'll hear shortly ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use a contiguous memory location of n bytes in python

2008-11-14 Thread Nick Craig-Wood
' a[9] '\x00' a[9]='q' a[9] 'q' del a -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: duck-type-checking?

2008-11-13 Thread Craig Allen
This is better achived, not by littering the functional code unit with numerous assertions that obscure the normal function of the code, but rather by employing comprehensive unit tests *separate from* the code unit. that doesn't seem to work too well when shipping a library for someone else

Re: duck-type-checking?

2008-11-13 Thread Craig Allen
since both are equally informative when it comes to tracing the faulty assignment. steve, they are not equally informative, the assertion is designed to fire earlier in the process, and therefore before much mischief and corruption can be done compared to later, when you happen to hit the

Re: Finding the instance reference of an object

2008-11-12 Thread Craig Allen
arguably even older than that to Lisp. Firstly, thanks to those that have responded to my part in this debate, I have found it very informative and interesting as I have the entire thread. However, with regard to comments that I led myself astray, I want to reiterate the one thing I find

Re: why does this call to re.findall() loop forever?

2008-11-10 Thread Nick Craig-Wood
examples. Eg http://bugs.python.org/issue1515829 I'd attack this problem using beatifulsoup probably rather than regexps! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-11-04 Thread Craig Allen
If the assert statement fails (and it does), then no copy was made and Python is not call-by-value. So Python is not call-by-value, and it's not call-by-reference, so ... either Python doesn't exist, or it uses a different calling convention. coming from C/C++ Python seemed to me call by

Re: Finding the instance reference of an object

2008-11-04 Thread Craig Allen
On Nov 4, 11:06 am, Joe Strout [EMAIL PROTECTED] wrote: On Nov 4, 2008, at 7:42 AM, Craig Allen wrote: coming from C/C++ Python seemed to me call by reference, for the pragmatic reason you said, modificaitons to function arguments do affect the variable in the caller.  The confusing part

Re: Structures

2008-11-03 Thread Craig Allen
Care to say more about what they are, not what they're like? I'm not the OP and I may be biased by C++, I can imagine the complaints when I say, classes are just structures with function members for working on the structure. -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON WORKING WITH PERL ??

2008-11-03 Thread Craig Allen
article:http://www.linuxjournal.com/article/3882 interesting read, thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON WORKING WITH PERL ??

2008-11-03 Thread Craig Allen
article:http://www.linuxjournal.com/article/3882 even if it is by Eric Raymond -- http://mail.python.org/mailman/listinfo/python-list

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