Re: what's so difficult about namespace?

2008-11-25 Thread Glenn Linderman
On approximately 11/25/2008 11:01 PM, came the following characters from the keyboard of Gene: On Nov 26, 1:29 am, Xah Lee <[EMAIL PROTECTED]> wrote: comp.lang.lisp,comp.lang.functional,comp.lang.perl.misc,comp.lang.python,co­mp.lang.java.programmer 2008-11-25 Recently, Steve Yegge implemen

Re: what's so difficult about namespace?

2008-11-25 Thread Gene
On Nov 26, 1:29 am, Xah Lee <[EMAIL PROTECTED]> wrote: > comp.lang.lisp,comp.lang.functional,comp.lang.perl.misc,comp.lang.python,co­mp.lang.java.programmer > > 2008-11-25 > > Recently, Steve Yegge implemented Javascript in Emacs lisp, and > compared the 2 languages. > > http://steve-yegge.blogspot

Pyhon (with wxPython) on Windows' cygwin: can it be done fully ?

2008-11-25 Thread Barak, Ron
Hi Pythonistas, I read diaz's comments with interest, but - in my current configuration, I'm unable to use pdb. I'm developing on cygwin and use wxPython. Consequently, I cannot use native cygwin Python, but my Python is actually the Windows XP Python (i.e., /cygdrive/c/Python25/python.exe). T

what's so difficult about namespace?

2008-11-25 Thread Xah Lee
comp.lang.lisp,comp.lang.functional,comp.lang.perl.misc,comp.lang.python,comp.lang.java.programmer 2008-11-25 Recently, Steve Yegge implemented Javascript in Emacs lisp, and compared the 2 languages. http://steve-yegge.blogspot.com/ http://code.google.com/p/ejacs/ One of his point is about emac

Re: How to get a directory file descriptor?

2008-11-25 Thread alex23
On Nov 26, 3:26 pm, greg <[EMAIL PROTECTED]> wrote: > os.O_DIRECTORY must be fairly new -- it doesn't exist > in my 2.5 installation. But os.O_RDONLY seems to work > just as well for this purpose. Which OS are you using? Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2u

Re: How to get a directory file descriptor?

2008-11-25 Thread greg
alex23 wrote: import os dirfd = os.open("directory-name", os.O_DIRECTORY) os.fchdir(dirfd) os.O_DIRECTORY must be fairly new -- it doesn't exist in my 2.5 installation. But os.O_RDONLY seems to work just as well for this purpose. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Reflectiong capabilityof Python

2008-11-25 Thread Rafe
On Nov 26, 9:18 am, [EMAIL PROTECTED] wrote: > Can Python create object by name? Like > clsName = "ClassA" > aObj = createObjectByName(clsName) if you are talking about creating an objcet dynamically and naming the CLASS name at runtime, use: >>> obj = type("ClassA", object, {}) # The base class i

Re: How to get a directory file descriptor?

2008-11-25 Thread alex23
On Nov 26, 1:34 pm, Cong Ma <[EMAIL PROTECTED]> wrote: > So if I can't seem to get directory file descriptors, the only way to use > os.fchdir() in Python is to embed Python in C code? This doesn't work for you? import os dirfd = os.open("directory-name", os.O_DIRECTORY) os.fchdir(dirfd) Are you

Re: Instance attributes vs method arguments

2008-11-25 Thread John O'Hagan
On Wed, 26 Nov 2008, Ben Finney wrote: > John O'Hagan <[EMAIL PROTECTED]> writes: > > insofar as one is only interested in accessing methods, is there an > > difference in efficiency (for large enough number of methods and > > arguments) between > > > > a) passing all arguments to __init__() and ac

Re: How to get a directory file descriptor?

2008-11-25 Thread Cong Ma
alex23 wrote: > On Nov 26, 12:31 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: >> Is this what you want? >> >> ofiles = [open(x) for x in os.listdir(os.getcwd())] > > 'open' returns a "file object", whereas the OP is after "file > descriptors", which are returned by 'os.open'. > > -- > http:/

Re: Python surpasses Perl in popularity?

2008-11-25 Thread david . lyon
Quoting Lawrence D'Oliveiro <[EMAIL PROTECTED]>: Perl is the FORTRAN of scripting languages. Python is in some ways like Pascal. Java is like COBOL. C? Who knows... Your memory goes way back... haha -- http://mail.python.org/mailman/listinfo/python-list

Re: Python surpasses Perl in popularity?

2008-11-25 Thread david . lyon
Quoting John Machin <[EMAIL PROTECTED]>: pyExcelerator is abandonware. Check out xlwt (a fork of pyExcelerator) at http://pypi.python.org/pypi/xlwt Thanks John. That is very helpful. I will move to that product.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 - is this true?

2008-11-25 Thread Steven D'Aprano
On Mon, 24 Nov 2008 10:42:41 +, Duncan Grisby wrote: > Again, this is just an example. As I say, in the real application, the > data has come from a dynamically-typed database. There's no easy way to > coerce all the items to the same type, because the application doesn't > know up-front what

Re: Python 3.0 - is this true?

2008-11-25 Thread Steven D'Aprano
On Mon, 24 Nov 2008 17:33:50 +, Tim Rowe wrote: > 2008/11/24 Aahz <[EMAIL PROTECTED]>: > >> (I'll agree that from some perspectives the new behavior of None is a >> wart but I think that in the end I agree with people who say that >> preventing None from being sorted except intentionally will

Re: Instance attributes vs method arguments

2008-11-25 Thread Steven D'Aprano
On Tue, 25 Nov 2008 10:21:18 +0100, M.-A. Lemburg wrote: > It is always good practice to provide default values for instance > variables in the class definition, both to enhance readability and to > allow adding documentation regarding the variables, e.g. > > class Class_a: > ># Foo bar >

Re: Instance attributes vs method arguments

2008-11-25 Thread Ben Finney
John O'Hagan <[EMAIL PROTECTED]> writes: > insofar as one is only interested in accessing methods, is there an > difference in efficiency (for large enough number of methods and > arguments) between > > a) passing all arguments to __init__() and accessing them via self > within individual methods

Re: Reflectiong capabilityof Python

2008-11-25 Thread MRAB
[EMAIL PROTECTED] wrote: Can Python create object by name? Like clsName = "ClassA" aObj = createObjectByName(clsName) > >>> # Create the class. >>> class MyClass: pass >>> # The class is in the globals() dict. >>> globals()["MyClass"] >>> # And also the locals() dict. >>> locals()["MyC

Re: Python 3.0 - is this true?

2008-11-25 Thread Aahz
In article <[EMAIL PROTECTED]>, Duncan Grisby <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, Aahz <[EMAIL PROTECTED]> wrote: >>In article <[EMAIL PROTECTED]>, >>Duncan Grisby <[EMAIL PROTECTED]> wrote: >>> >>>For my application, Python 3's comparison behaviour is a backwards >>>step.

Re: Instance attributes vs method arguments

2008-11-25 Thread George Sakkis
On Nov 25, 8:49 pm, John O'Hagan <[EMAIL PROTECTED]> wrote: > is there an > difference in efficiency (for large enough number of methods and arguments) > between > > a) passing all arguments to __init__() and accessing them via self within > individual methods: > > class = Class(all_class_args) >

Reflectiong capabilityof Python

2008-11-25 Thread goatold
Can Python create object by name? Like clsName = "ClassA" aObj = createObjectByName(clsName) -- http://mail.python.org/mailman/listinfo/python-list

Re: Instance attributes vs method arguments

2008-11-25 Thread John O'Hagan
On Tue, 25 Nov 2008, Rafe wrote: > On Nov 25, 5:48 pm, John O'Hagan <[EMAIL PROTECTED]> wrote: > > On Tue, 25 Nov 2008, Marc 'BlackJack' Rintsch wrote: > > > On Tue, 25 Nov 2008 07:27:41 +, John O'Hagan wrote: > > > > Is it better to do this: > > > > > > > > class Class_a(): > > > >       def _

Re: recommended __future__ imports for 2.5?

2008-11-25 Thread greg
Dennis Lee Bieber wrote: I'm still waiting to hear that from __past__ import division Well, *I'm* waiting for the time machine technology to be declassified, so we'll be able to do from __future__ import * and get all the features that are ever going to be added to Python!

Re: end of print = lower productivity ?

2008-11-25 Thread alex23
On Nov 26, 1:52 am, [EMAIL PROTECTED] wrote: > I hope there was a missing smiley in that post.  If a couple extra parens > destroys your debugging productivity I suspect you need a fresh approach to > the task. I'm always inclined to suggest 6 months working in a role that requires hard manual lab

Re: How to get a directory file descriptor?

2008-11-25 Thread alex23
On Nov 26, 12:31 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > Is this what you want? > > ofiles = [open(x) for x in os.listdir(os.getcwd())] 'open' returns a "file object", whereas the OP is after "file descriptors", which are returned by 'os.open'. -- http://mail.python.org/mailman/listin

Re: Python Script to search by Date

2008-11-25 Thread Albert Hopkins
On Tue, 2008-11-25 at 16:10 -0800, [EMAIL PROTECTED] wrote: > What I'm trying to do is decompress a bunch of files depending on the > date/time specified. > > So, we have full backups created every Sunday and transaction backups > every hour afterwards. > > I have everything compressed at an hour

Re: checking for mis-spelled variable names / function names

2008-11-25 Thread John Machin
On Nov 26, 10:16 am, News123 <[EMAIL PROTECTED]> wrote: > Hi, > > Let's imagine following code > > def specialfunc(): >         print "very special function" > > name= getuserinput() > if name == 'one_name_out_of_a_million': >         print "Hey your name '%s' is really rare" % namee >         spec

Thread limit and thread stack size

2008-11-25 Thread blair . bethwaite
Hi All, We've been debugging a distributed app that uses a database server to accept connections and then queries from remote agents. Once a connection is established it is passed off to a thread, along with a local db connection from a pool, to handle the IO. We get to a point that seems to be a

Python Script to search by Date

2008-11-25 Thread gamersunit
What I'm trying to do is decompress a bunch of files depending on the date/time specified. So, we have full backups created every Sunday and transaction backups every hour afterwards. I have everything compressed at an hourly basis. Now, what I'm trying to create is a way to specify a date and t

PyMei - Python Media Interface

2008-11-25 Thread Jørgen P. Tjernø
Hi! python-list users: I'm not a subscriber, so please send all replies off-list as well! (CC or To me) This is self-advertisement; I've just publised my first "official" python+pygame project, and I'd love it if people looked at it. I've recently published my inhouse Python Media Center ap

Re: checking for mis-spelled variable names / function names

2008-11-25 Thread Chris Rebert
On Tue, Nov 25, 2008 at 3:16 PM, News123 <[EMAIL PROTECTED]> wrote: > Hi, > > Let's imagine following code > > def specialfunc(): >print "very special function" > > name= getuserinput() > if name == 'one_name_out_of_a_million': >print "Hey your name '%s' is really rare" % namee >

checking for mis-spelled variable names / function names

2008-11-25 Thread News123
Hi, Let's imagine following code def specialfunc(): print "very special function" name= getuserinput() if name == 'one_name_out_of_a_million': print "Hey your name '%s' is really rare" % namee specialfunk() my python script could survive thousands of runs before falling

Re: Python surpasses Perl in popularity?

2008-11-25 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > Hard to take a popularity index seriously when Logo is at #19 and > Bourne shell at #32 ... and then they suggest that their readers can > use it "to make a strategic decision about what programming language > should be ad

Re: Reg Expression - Get position of >

2008-11-25 Thread r
On Nov 25, 4:33 pm, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > On Tue, 25 Nov 2008 12:41:53 -0800 (PST), r <[EMAIL PROTECTED]> wrote: > > On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: > >> Hey, > > >> I need the position of the last char > > > >> Let's say I have a string > >> mystr =  

Re: segfault calling SSE enabled library from ctypes

2008-11-25 Thread Olivier Grisel
Replying to myself: haypo found the origin of the problem. Apparently this problem stems from a GCC bug [1] (that should be fixed on x86 as of version 4.4). The bug is that GCC does not always ensure the stack to be 16 bytes aligned hence the "__m128 myvector" local variable in the previous code

Re: Python surpasses Perl in popularity?

2008-11-25 Thread Jorgen Grahn
On Mon, 24 Nov 2008 20:25:51 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Quoting Xah Lee <[EMAIL PROTECTED]>: > >> herald: Python surpasses Perl in popularity! >> >> According to >> ?TIOBE Programming Community Index for November 2008? at >> http://www.tiobe.com/content/paperinfo/tpci/in

Re: end of print = lower productivity ?

2008-11-25 Thread George Sakkis
On Nov 25, 5:03 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > > BUT you now can do > > > >>> p = print > > > >>> p("f") > > All right. Let's talk about that. > > > When I write "print", it is both effortless and instantaneous : my > > hands do not move, a wave goe

Re: Security implications of using open() on untrusted strings.

2008-11-25 Thread News123
Jorgen Grahn wrote: > Compare with a language (does Perl allow this?) where if the string > is "rm -rf /|", open will run "rm -rf /" and start reading its output. > *That* interface would have been Good example. (for perl): The problem doesn't exist in python open("rm -rf / |") would try t

Re: Reg Expression - Get position of >

2008-11-25 Thread Jorgen Grahn
On Tue, 25 Nov 2008 12:41:53 -0800 (PST), r <[EMAIL PROTECTED]> wrote: > On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: >> Hey, >> >> I need the position of the last char > >> >> Let's say I have a string >> mystr =  

Re: pyExcelerator: setting zoom of a worksheet

2008-11-25 Thread John Machin
On Nov 26, 6:40 am, Frank <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I use pyExcelerator and am quite happy with it, except: I cannot find a option > for setting the zoom of a particular worksheet. I am using pyExcelerator > 0.6.3a which is the latest as far as i know. That is the latest relea

Re: Security implications of using open() on untrusted strings.

2008-11-25 Thread Jorgen Grahn
On Tue, 25 Nov 2008 02:26:32 -0500, r0g <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: ... >> Or am I missing something? > No Jorgen, that's exactly what I needed to know i.e. that sending > unfiltered text to open() is not negligent or likely to allow any > badness to occur. > > As far as what

Re: Getting in to metaprogramming

2008-11-25 Thread Arnaud Delobelle
Aaron Brady <[EMAIL PROTECTED]> writes: > I don't know a clean, reliable way to structure a metaprogram though. > Mine always turn out messy. I don't think Python is designed for large scale metaprogramming. Lisp is the only naturally suited language that I know. -- Arnaud -- http://mail.pytho

Re: What are the syntax for &&, ||

2008-11-25 Thread Andrew Koenig
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> How do I do in Python? > if condition1 and condition2: # && > doThis > elif condition3 or condition4: # || > doThat > See the pattern? if condition1 and condition2: doThis elif condition3 or condition4: doTha

Re: converting a string data to a float value for access database

2008-11-25 Thread M.-A. Lemburg
On 2008-11-25 22:37, [EMAIL PROTECTED] wrote: > Hi, > > I am trying to copy a sql database to a access database using python. > I can copy all the fields, but the date. I can store a float value in > access data object, ie > http://en.wikibooks.org/wiki/JET_Database/Data_types#Dates_and_times >

Re: end of print = lower productivity ?

2008-11-25 Thread Paul Rubin
[EMAIL PROTECTED] writes: > > BUT you now can do > > >>> p = print > > >>> p("f") > All right. Let's talk about that. > > When I write "print", it is both effortless and instantaneous : my > hands do not move, a wave goes through my fingers, it all happens in a > tenth of a second. > > Contrast

Re: Security implications of using open() on untrusted strings.

2008-11-25 Thread Jorgen Grahn
On Tue, 25 Nov 2008 20:40:57 +1300, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: > >> Seems to me you simply want to know beforehand that the reading will >> work. But you can never check that! You can stat(2) the file, or >> open-and-close it -- and then a microsecond la

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread rfk
> I'd be interested to hear about your > experiences with both and why you switched. Enchant has a pretty simple C API so the binding process was straightforward with both SWIG and ctypes. The only real trick was in passing python functions as callbacks to the C API, for which I found ctypes a li

Re: confused about classes and tkinter object design

2008-11-25 Thread r
On Nov 25, 2:31 pm, r <[EMAIL PROTECTED]> wrote: > On Nov 25, 10:38 am, marc wyburn <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I've created my first Tkinter GUI class which consists of some buttons > > that trigger functions.  I have also created a > > tkFileDialog.askdirectory control to local

converting a string data to a float value for access database

2008-11-25 Thread [EMAIL PROTECTED]
Hi, I am trying to copy a sql database to a access database using python. I can copy all the fields, but the date. I can store a float value in access data object, ie http://en.wikibooks.org/wiki/JET_Database/Data_types#Dates_and_times So access uses a float for a date, and mysql databse uses t

Re: Getting in to metaprogramming

2008-11-25 Thread Aaron Brady
On Nov 25, 5:20 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Nov 25, 12:12 pm, Rafe <[EMAIL PROTECTED]> wrote: > > > is it really as simple as gathering strings of code? > > Yes. Yes. > > Sort of like generating HTML or XML directly? Is there any other framework > > or > > pattern set t

Re: Problem with writing fast UDP server

2008-11-25 Thread Krzysztof Retel
On Nov 21, 6:55 pm, Greg Copeland <[EMAIL PROTECTED]> wrote: > On Nov 21, 11:05 am, Krzysztof Retel <[EMAIL PROTECTED]> > wrote: > > > > > On Nov 21, 4:48 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: > > > > On Fri, 21 Nov 2008 08:14:19 -0800 (PST), Krzysztof Retel wrote: > > > > I am not sure what

Re: Module Structure/Import Design Problem

2008-11-25 Thread Arnaud Delobelle
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Rafe a écrit : >> On Nov 20, 2:06 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > (snip) >>> >>> Or (better IMHO) you can make types register themselves with the factory >>> function (in which case it would have some state so it would make more >

Re: Reg Expression - Get position of >

2008-11-25 Thread r
On Nov 25, 10:36 am, M_H <[EMAIL PROTECTED]> wrote: > Hey, > > I need the position of the last char > > > Let's say I have a string > mystr =  

Re: How to get the class instance of a passed method ?

2008-11-25 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : (snip) .im_self will become example.method.__self__ and in python 3. But I can't see the equivalen of .im_class? At worst, you'll still have example.method.__self__.__class__ !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: confused about classes and tkinter object design

2008-11-25 Thread r
On Nov 25, 10:38 am, marc wyburn <[EMAIL PROTECTED]> wrote: > Hi, > > I've created my first Tkinter GUI class which consists of some buttons > that trigger functions.  I have also created a > tkFileDialog.askdirectory control to local a root folder for log > files. > > I have several file paths tha

Re: zope vs openACS

2008-11-25 Thread Bruno Desthuilliers
Stefan Scholl a écrit : [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Nov 19, 1:50 am, gavino <[EMAIL PROTECTED]> wrote: what is nicer about each? Yes. And No. Or maybe ? -- http://mail.python.org/mailman/listinfo/python-list

Re: confused about classes and tkinter object design

2008-11-25 Thread r
On Nov 25, 10:38 am, marc wyburn <[EMAIL PROTECTED]> wrote: > Hi, > > I've created my first Tkinter GUI class which consists of some buttons > that trigger functions.  I have also created a > tkFileDialog.askdirectory control to local a root folder for log > files. > > I have several file paths tha

Anyone heard of a good Voice Stress Analysis program

2008-11-25 Thread Daniel Folkes
Anyone heard of a good voice stress analysis program that was either: a) Written in python b) can be used by python? It would be a great help to me. Thanks, Dan Folkes http://danfolkes.com -- http://mail.python.org/mailman/listinfo/python-list

Re: end of print = lower productivity ?

2008-11-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On Nov 25, 5:05 pm, peter <[EMAIL PROTECTED]> wrote: BUT you now can do p = print p("f") Voila, 4 keystrokes saved :-) All right. Let's talk about that. When I write "print", it is both effortless and instantaneous : my hands do not move, a wave goes through my f

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On Nov 25, 4:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: You can't use ctypes for C++, only for C-style APIs. Diez With some work, you can convert your C++ objects to PyObject* and then return the latter in a function with C bindings. Or you use SWIG or S

Re: Module Structure/Import Design Problem

2008-11-25 Thread Bruno Desthuilliers
Rafe a écrit : On Nov 20, 2:06 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: (snip) Or (better IMHO) you can make types register themselves with the factory function (in which case it would have some state so it would make more sense to make it a factory object). Can you elaborate on what

pyExcelerator: setting zoom of a worksheet

2008-11-25 Thread Frank
Hi everybody, I use pyExcelerator and am quite happy with it, except: I cannot find a option for setting the zoom of a particular worksheet. I am using pyExcelerator 0.6.3a which is the latest as far as i know. I already contacted the developer of pyExcelerator, he says there is a zoom-option

Re: Reg Expression - Get position of >

2008-11-25 Thread Chris Rebert
On Tue, Nov 25, 2008 at 8:36 AM, M_H <[EMAIL PROTECTED]> wrote: > > Hey, > > I need the position of the last char > > > Let's say I have a string > mystr =

Re: Enumerating k-segmentations of a sequence

2008-11-25 Thread Gerard flanagan
bullockbefriending bard wrote: I'm not sure if my terminology is precise enough, but what I want to do is: Given an ordered sequence of n items, enumerate all its possible k- segmentations. This is *not* the same as enumerating the k set partitions of the n items because I am only interested in

Re: Enumerating k-segmentations of a sequence

2008-11-25 Thread Arnaud Delobelle
bullockbefriending bard <[EMAIL PROTECTED]> writes: > I'm not sure if my terminology is precise enough, but what I want to > do is: > > Given an ordered sequence of n items, enumerate all its possible k- > segmentations. > > This is *not* the same as enumerating the k set partitions of the n > ite

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread Matthieu Brucher
Boost.Python is difficult to understand, far more than SWIG. It may be faster, but I don't think it is worth it ATM. Binding C++ classes with SWIG is really simple. Matthieu 2008/11/25 Olivier Grisel <[EMAIL PROTECTED]>: > 2008/11/25 <[EMAIL PROTECTED]>: >> On Nov 25, 4:34 pm, "Diez B. Roggisch"

Re: Getting in to metaprogramming

2008-11-25 Thread Stef Mientki
Rafe wrote: On Nov 25, 5:41 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: On Nov 25, 4:08 am, Rafe <[EMAIL PROTECTED]> wrote: Hi, In the name of self-education can anyone share some pointers, links, modules, etc that I might use to begin learning how to do some "metaprogramming".

Re: end of print = lower productivity ?

2008-11-25 Thread Arnaud Delobelle
Tim Chase <[EMAIL PROTECTED]> writes: >> p = print >> p("f") >>> Voila, 4 keystrokes saved :-) >> >> When I write "print", it is both effortless and instantaneous : my >> hands do not move, a wave goes through my fingers, it all happens in a >> tenth of a second. >> >> Contrast this with w

Re: Enumerating k-segmentations of a sequence

2008-11-25 Thread bearophileHUGS
My version: from itertools import combinations as xcombinations from itertools import izip, islice def xpairwise(iterable): # docs and doctests removed return izip(iterable, islice(iterable, 1, None)) def segmentations(seq, k): for comb in xcombinations(range(1, len(seq)), k-1):

Re: Enumerating k-segmentations of a sequence

2008-11-25 Thread Mark Dickinson
On Nov 25, 5:34 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > If you have Python 2.6 available, itertools.combination might be That should be itertools.combinations, of course. The idea is that to give a partition of e.g., a 5-element list into 3 nonempty pieces, all you have to do is say where

Re: Enumerating k-segmentations of a sequence

2008-11-25 Thread Mark Dickinson
On Nov 25, 4:56 pm, bullockbefriending bard <[EMAIL PROTECTED]> wrote: > I'm not sure if my terminology is precise enough, but what I want to > do is: > [snip problem description] > Structural Recursion not being my strong point, any ideas on how to go > about this would be much appreciated! If yo

Re: Using dictionary to hold regex patterns?

2008-11-25 Thread Thomas Mlynarczyk
John Machin schrieb: No, "complicated" is more related to unused features. In the case of using an aeroplane to transport 3 passengers 10 km along the autobahn, you aren't using the radar, wheel-retractability, wings, pressurised cabin, etc. In your original notion of using a dict in your lexer,

Re: encoding

2008-11-25 Thread Dotan Cohen
2008/11/25 Benjamin Kaplan <[EMAIL PROTECTED]>: > On Tue, Nov 25, 2008 at 11:53 AM, luca72 <[EMAIL PROTECTED]> wrote: >> >> hello i'm writing an irc client, i use for encoding the utf-8 but i >> never see all the typed sign in the correct way, anyone know the >> standard encodind for the irc channe

Re: end of print = lower productivity ?

2008-11-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On Nov 25, 4:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I used to use print a lot. Once I found >> >> import pdb; pdb.set_trace() >> >> I massively lost interest in it. And gained *much* more debugging >> power/productivity. > > In some cases, this is not d

Re: end of print = lower productivity ?

2008-11-25 Thread George Sakkis
On Nov 25, 10:52 am, [EMAIL PROTECTED] wrote: >     >> Now the print statement disappeared, and I have to write print("f") >     >> instead. These parentheses not only take time to write, they also make >     >> me think twice about using print for debugging purposes. Pressing < >     >> SHIFT > th

Re: Enumerating k-segmentations of a sequence

2008-11-25 Thread marek . rocki
bullockbefriending bard napisał(a): > I'm not sure if my terminology is precise enough, but what I want to > do is: > > Given an ordered sequence of n items, enumerate all its possible k- > segmentations. > > This is *not* the same as enumerating the k set partitions of the n > items because I am o

Re: encoding

2008-11-25 Thread Benjamin Kaplan
On Tue, Nov 25, 2008 at 11:53 AM, luca72 <[EMAIL PROTECTED]> wrote: > hello i'm writing an irc client, i use for encoding the utf-8 but i > never see all the typed sign in the correct way, anyone know the > standard encodind for the irc channels? > > Regards > > Luca > -- > http://mail.python.org/

Enumerating k-segmentations of a sequence

2008-11-25 Thread bullockbefriending bard
I'm not sure if my terminology is precise enough, but what I want to do is: Given an ordered sequence of n items, enumerate all its possible k- segmentations. This is *not* the same as enumerating the k set partitions of the n items because I am only interested in those set partitions which prese

encoding

2008-11-25 Thread luca72
hello i'm writing an irc client, i use for encoding the utf-8 but i never see all the typed sign in the correct way, anyone know the standard encodind for the irc channels? Regards Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread Olivier Grisel
2008/11/25 <[EMAIL PROTECTED]>: > On Nov 25, 4:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> >> You can't use ctypes for C++, only for C-style APIs. >> >> Diez > > With some work, you can convert your C++ objects to PyObject* and then > return the latter in a function with C bindings. h

Re: datetime objects and __new__()

2008-11-25 Thread peter
On Nov 25, 5:16 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > peter wrote: > >> >>> from datetime import * > >> >>> class TS(datetime): > > >> ...     def __new__(cls, ts): > >> ...             return datetime.fromtimestamp(ts) > >> ...>>> TS(0) > > >> datetime.datetime(1970, 1, 1, 1, 0) > > >> work

Re: Instance attributes vs method arguments

2008-11-25 Thread Bruno Desthuilliers
M.-A. Lemburg a écrit : (snip) It is always good practice to provide default values for instance variables in the class definition, both to enhance readability and to allow adding documentation regarding the variables, e.g. Your opinion. As far as I'm concerned, using class variables this way i

Re: end of print = lower productivity ?

2008-11-25 Thread Tim Chase
p = print p("f") Voila, 4 keystrokes saved :-) When I write "print", it is both effortless and instantaneous : my hands do not move, a wave goes through my fingers, it all happens in a tenth of a second. Contrast this with what one has to go through to catch the SHIFT key, and then the "(" : m

confused about classes and tkinter object design

2008-11-25 Thread marc wyburn
Hi, I've created my first Tkinter GUI class which consists of some buttons that trigger functions. I have also created a tkFileDialog.askdirectory control to local a root folder for log files. I have several file paths that depend on the value of tkFileDialog.askdirectory should I create an obje

Reg Expression - Get position of >

2008-11-25 Thread M_H
Hey, I need the position of the last char > Let's say I have a string mystr =

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread cptnwillard
On Nov 25, 4:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > You can't use ctypes for C++, only for C-style APIs. > > Diez With some work, you can convert your C++ objects to PyObject* and then return the latter in a function with C bindings. -- http://mail.python.org/mailman/listinfo/pyt

Re: end of print = lower productivity ?

2008-11-25 Thread Johannes Bauer
[EMAIL PROTECTED] schrieb: > I know it sounds ridiculous Not only that - it also sounds as if there's spring break in Trollland. Regards, Johannes -- "Meine Gegenklage gegen dich lautet dann auf bewusste Verlogenheit, verlästerung von Gott, Bibel und mir und bewusster Blasphemie." --

Re: end of print = lower productivity ?

2008-11-25 Thread cptnwillard
On Nov 25, 5:05 pm, peter <[EMAIL PROTECTED]> wrote: > BUT you now can do > > >>> p = print > >>> p("f") > > Voila, 4 keystrokes saved :-) All right. Let's talk about that. When I write "print", it is both effortless and instantaneous : my hands do not move, a wave goes through my fingers, it all

Re: datetime objects and __new__()

2008-11-25 Thread Peter Otten
peter wrote: >> >>> from datetime import * >> >>> class TS(datetime): >> >> ...     def __new__(cls, ts): >> ...             return datetime.fromtimestamp(ts) >> ...>>> TS(0) >> >> datetime.datetime(1970, 1, 1, 1, 0) >> >> works super() would be the most likely culprit. > > Yes, that works, excep

Re: How to get a directory file descriptor?

2008-11-25 Thread Baptiste Carvello
Cong Ma a écrit : Dear all, Can you give me some hint on getting a directory file descriptor in Python? Besides, what's good about os.fchdir() if I can't get a directory fd in the first place? Thanks for your reply. Regards, Cong. -- http://mail.python.org/mailman/listinfo/python-list Hell

Re: end of print = lower productivity ?

2008-11-25 Thread cptnwillard
On Nov 25, 4:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > I used to use print a lot. Once I found > > import pdb; pdb.set_trace() > > I massively lost interest in it. And gained *much* more debugging > power/productivity. In some cases, this is not discriminatory enough : there are simpl

Re: end of print = lower productivity ?

2008-11-25 Thread peter
On Nov 25, 4:44 pm, [EMAIL PROTECTED] wrote: > I want my productivity back. > > In Python 2.x, I could easily write things like -- print "f" / print > "add" / print "done" -- to a lot of different places in my code, which > allowed me to find bugs that I could not track otherwise. When I found > ou

Re: initialized list: strange behavior

2008-11-25 Thread Arnaud Delobelle
Steve Holden <[EMAIL PROTECTED]> writes: > Arnaud Delobelle wrote: >> Jason Scheirer <[EMAIL PROTECTED]> writes: >>> Python is pass-by-reference, not pass-by-value. >> >> It's certainly not pass-by-reference, nor is it pass-by-value IMHO. >> > Since no lists are being passed as arguments in thes

Re: datetime objects and __new__()

2008-11-25 Thread peter
On Nov 25, 4:39 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > peter wrote: > > On Nov 25, 3:46 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> peter wrote: > >> import datetime > >> class ts(datetime.datetime): > >> > ...     foo = 'bar' > >> > ...     def __new__(cls, s): > >> > ...      

Re: end of print = lower productivity ?

2008-11-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I want my productivity back. > > In Python 2.x, I could easily write things like -- print "f" / print > "add" / print "done" -- to a lot of different places in my code, which > allowed me to find bugs that I could not track otherwise. When I found > out that "f" was not

Re: end of print = lower productivity ?

2008-11-25 Thread skip
>> Now the print statement disappeared, and I have to write print("f") >> instead. These parentheses not only take time to write, they also make >> me think twice about using print for debugging purposes. Pressing < >> SHIFT > then < ( > then < " > makes the whole process quite a h

end of print = lower productivity ?

2008-11-25 Thread cptnwillard
I want my productivity back. In Python 2.x, I could easily write things like -- print "f" / print "add" / print "done" -- to a lot of different places in my code, which allowed me to find bugs that I could not track otherwise. When I found out that "f" was not at fault, I could write -- print "g"

Re: datetime objects and __new__()

2008-11-25 Thread Peter Otten
peter wrote: > On Nov 25, 3:46 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> peter wrote: >> import datetime >> class ts(datetime.datetime): >> > ...     foo = 'bar' >> > ...     def __new__(cls, s): >> > ...         c = super(ts, cls) >> > ...         return c.fromtimestamp(s) >> > ...

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread Diez B. Roggisch
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Ryan Kelly <[EMAIL PROTECTED]> wrote: > >> * Migrated from SWIG to ctypes for the C binding: > > Ryan, > > I'm looking at a doing a Python wrapper for a C++ library. We've already > done a Perl wrapper for this library using SWIG (I wasn't

Re: initialized list: strange behavior

2008-11-25 Thread alexander . genkin
The issue is exhausted in Python Library Reference, Chapter 3.6, so I should apologize for initial posting. All comments were helpful, though Arnaud and Steve are right that pass-by-anything is off the point. Thanks All! -- http://mail.python.org/mailman/listinfo/python-list

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread skip
Roy> I'm debating whether I should do the Python version with SWIG or Roy> ctypes. Unless your C++ library exports a C api I don't think you can use ctypes to make it available within Python. -- Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/ -- http://mail.python.or

  1   2   >