dictionary of dictionaries

2007-12-09 Thread kettle
Hi, I'm wondering what the best practice is for creating an extensible dictionary-of-dictionaries in python? In perl I would just do something like: my %hash_of_hashes; for(my $i=0;$i<10;$i++){ for(my $j=0;$j<10;$j++){ ${$hash_of_hashes{$i}}{$j} = int(rand(10)); } } but it seem

Re: dictionary of dictionaries

2007-12-09 Thread Marc 'BlackJack' Rintsch
On Sun, 09 Dec 2007 00:35:18 -0800, kettle wrote: > Hi, > I'm wondering what the best practice is for creating an extensible > dictionary-of-dictionaries in python? > > In perl I would just do something like: > > my %hash_of_hashes; > for(my $i=0;$i<10;$i++){ > for(my $j=0;$j<10;$j++){ >

Re: python/regex question... hope someone can help

2007-12-09 Thread John Machin
On Dec 9, 6:13 pm, charonzen <[EMAIL PROTECTED]> wrote: > I have a list of strings. These strings are previously selected > bigrams with underscores between them ('and_the', 'nothing_given', and > so on). I need to write a regex that will read another text string > that this list was derived from

Re: python/regex question... hope someone can help

2007-12-09 Thread John Machin
On Dec 9, 6:13 pm, charonzen <[EMAIL PROTECTED]> wrote: The following *may* come close to doing what your revised spec requires: import re def ch_replace2(alist, text): for bigram in alist: pattern = r'\b' + bigram.replace('_', ' ') + r'\b' text = re.sub(pattern, bigram, text)

Re: distutils & OS X universal binaries

2007-12-09 Thread Martin v. Löwis
> I prefer to continue using WORDS_BIGENDIAN so fewer changes need to be > made to the code. It just makes resynching with the upstream code > easier. If neither are defined we get to use the definition from > setup.py if it's needed. Ok. Still, I would write it as #if defined(__LITTLE_ENDIAN__)

Re: how to convert 3 byte to float

2007-12-09 Thread Mario M. Mueller
Hendrik van Rooyen schrieb: [...] > What is it digitising - if its an Analogue to Digital converter, then the > 24 bits may not be floats at all, but simple integer counts. Personally I would expect simple counts (since other seismic formats don't even think of using floats because most digitizer

Re: "finding hostid with python"

2007-12-09 Thread farsheed
Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils & OS X universal binaries

2007-12-09 Thread Robin Becker
Martin v. Löwis wrote: >> I prefer to continue using WORDS_BIGENDIAN so fewer changes need to be >> made to the code. It just makes resynching with the upstream code >> easier. If neither are defined we get to use the definition from >> setup.py if it's needed. > > > Ok. Still, I would write it a

Re: Recommendations for writing a user guide with examples?

2007-12-09 Thread Paddy
On Dec 8, 9:22 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > I'm looking for recommendations for writing a user manual. It will need > lots of examples of command line inputs and terminal outputs. > > I'd like to minimize the effort to integrate the terminal input/output into > my document. I have

Re: a Python person's experience with Ruby

2007-12-09 Thread Arnaud Delobelle
On Dec 9, 12:15 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Richard Jones a écrit : > > > > > Bruno Desthuilliers wrote: > > >>class A(object): > >> @apply > >> def a(): > >> def fget(self): > >> return self._a > >> def fset(self, val): > >> self._a = val > >> r

Re: Distinguishing attributes and methods

2007-12-09 Thread Bruno Desthuilliers
Roy Smith a écrit : > In article <[EMAIL PROTECTED]>, > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >>MonkeeSage a écrit : (snip) >>>Bah. Type-by-behavior never impressed me much. And I still think that >>>a.a is semantically different from a.a() in python. >> >>It is indeed and very obvi

python from any command line?

2007-12-09 Thread waltbrad
Hi folks. I'm learning Python from the Mark Lutz Book, Programming Python 3rd edition. He seems to be able to invoke the Python interpreter from any command line prompt. C:\temp>python C:\PP3rdEd\examples>python C:\PP3rdEd\Examples\PP3E\System>cd Whereas I am only able to invoke it when the co

Re: Newbie edit/compile/run cycle question

2007-12-09 Thread Arnaud Delobelle
On Dec 9, 1:26 pm, [EMAIL PROTECTED] wrote: > Thanks for all the help. Thought I'd spend my newbie days right in the > Python shell (there's lots to test when you're just starting) but I > guess that's not going to happen. It would be a shame not to use the shell. > Everyone told me to get out of

Re: python from any command line?

2007-12-09 Thread Adonis Vargas
waltbrad wrote: > Hi folks. I'm learning Python from the Mark Lutz Book, Programming > Python 3rd edition. > > He seems to be able to invoke the Python interpreter from any command > line prompt. > > C:\temp>python > > C:\PP3rdEd\examples>python > > C:\PP3rdEd\Examples\PP3E\System>cd > > Where

Re: Newbie edit/compile/run cycle question

2007-12-09 Thread MartinRinehart
Thanks for all the help. Thought I'd spend my newbie days right in the Python shell (there's lots to test when you're just starting) but I guess that's not going to happen. Everyone told me to get out of the Python shell, one way or another. OK. But this means that every execution must first load

Re: python from any command line?

2007-12-09 Thread waltbrad
On Dec 9, 8:54 am, Adonis Vargas <[EMAIL PROTECTED]> wrote: > waltbrad wrote: > > Hi folks. I'm learning Python from the Mark Lutz Book, Programming > > Python 3rd edition. > > > He seems to be able to invoke the Python interpreter from any command > > line prompt. > > > C:\temp>python > > > C:\PP3

Re: python from any command line?

2007-12-09 Thread john
Hi, You need to edit your path variable. (I'm assuming you're using Windows). Go to: Settings > Control Panel > System > Advanced > Environment Variables. Now double click on 'Path' and append ";C:\Python25\" (minus the quotation marks) to the text displayed in the Variable Value box. BW, John

Re: Minimalistic Software Transactional Memory

2007-12-09 Thread Duncan Booth
Michael Sparks <[EMAIL PROTECTED]> wrote: > I'm interested in writing a simple, minimalistic, non persistent (at > this stage) software transactional memory (STM) module. The idea being > it should be possible to write such a beast in a way that can be made > threadsafe fair easily. > > For those

Re: python from any command line?

2007-12-09 Thread Christian Heimes
waltbrad wrote: > Is there a way to set this so I can also invoke it from any command > line prompt? You can follow Adonis' advice but I'm going a different path on my computer because I've multiple versions of Python installed on my box. I usually put a simple batch file in c:\Windows, e.g. pyth

Re: Advice for editing xml file using ElementTree and wxPython

2007-12-09 Thread Rick Muller
On Dec 8, 11:57 pm, Waldemar Osuch <[EMAIL PROTECTED]> wrote: > On Dec 8, 8:35 pm, Rick Muller <[EMAIL PROTECTED]> wrote: > > > > > I'm a computational chemist who frequently dabbles in Python. A > > collaborator sent me a huge XML file that at one point was evidently > > modified by a now defunct

Re: Newbie edit/compile/run cycle question

2007-12-09 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Thanks for all the help. Thought I'd spend my newbie days right in the > Python shell (there's lots to test when you're just starting) but I > guess that's not going to happen. > > Everyone told me to get out of the Python shell, one way or another. Everyone told you

Re: Newbie edit/compile/run cycle question

2007-12-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Thanks for all the help. Thought I'd spend my newbie days right in the > Python shell (there's lots to test when you're just starting) but I > guess that's not going to happen. > > Everyone told me to get out of the Python shell, one way or another. > OK. But this mean

Re: Minimalistic Software Transactional Memory

2007-12-09 Thread Fuzzyman
> STM seems more in > keeping with Kamaelia being generally lock-free. STM isn't lock free - it just abstracts the locks away from the 'user'. You still need to lock around committing the transaction. Other threads accessing the data during the transaction should see the old values until the commi

[newbie] My very first python web app (no framework)

2007-12-09 Thread scardig
This is my first Python web pseudo-app: "you give me some data, I give you func(data)". I'm on a shared host with mod_fastcgi so I installed a virtual python environment + flup (no middleware now, just wsgi server). = dispatch.fcgi = from fcgi import WSGIServer import sys,

Re: Minimalistic Software Transactional Memory

2007-12-09 Thread Michael Sparks
Duncan Booth wrote: > Michael Sparks <[EMAIL PROTECTED]> wrote: > >> I'm interested in writing a simple, minimalistic, non persistent (at >> this stage) software transactional memory (STM) module. The idea being >> it should be possible to write such a beast in a way that can be made >> threadsaf

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-09 Thread Dirk Hagemann
On 7 Dez., 22:36, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 8, 12:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > Hello, > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > I get the date/time of the dynamic update entries in a format, which > > is as far as

Serializing Python compiled code.

2007-12-09 Thread renjipanicker
Hi everyone, In a C++ application having a Python interpreter embedded, is it possible to compile a small Python snippet into object code and serialize the compiled object code to, for example, a database? I am exploring the possibility of writing a data driven application, where small-sized objec

Re: Serializing Python compiled code.

2007-12-09 Thread Steve Howell
--- [EMAIL PROTECTED] wrote: > In a C++ application having a Python interpreter > embedded, is it > possible to compile a small Python snippet into > object code and > serialize the compiled object code to, for example, > a database? I am > exploring the possibility of writing a data driven > appl

Re: Minimalistic Software Transactional Memory

2007-12-09 Thread Michael Sparks
Fuzzyman wrote: >> STM seems more in >> keeping with Kamaelia being generally lock-free. > > STM isn't lock free - it just abstracts the locks away from the > 'user'. You still need to lock around committing the transaction. > I perhaps phrased what I meant too tersely. Kamaelia isn't lock fre

reading list of list to a file

2007-12-09 Thread caroliina
i made a list of lists but i cant write it into a file. how do i get the first string in a sublist? -- View this message in context: http://www.nabble.com/reading-list-of-list-to-a-file-tp14239876p14239876.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://ma

Re: reading list of list to a file

2007-12-09 Thread Ismail Dönmez
Sunday 09 December 2007 18:11:00 tarihinde caroliina şunları yazmıştı: > i made a list of lists but i cant write it into a file. how do i get the > first string in a sublist? An easy example: >>> a=[[1,2,3],[4,5,6]] >>> a[0][0] 1 >>> a[1][0] 4 >>> -- Never learn by your mistakes, if you

searching a value of a dict (each value is a list)

2007-12-09 Thread Seongsu Lee
Hi, I have a dictionary with million keys. Each value in the dictionary has a list with up to thousand integers. Follow is a simple example with 5 keys. dict = {1: [1, 2, 3, 4, 5], 2: [10, 11, 12], 90: [100, 101, 102, 103, 104, 105], 91: [20, 21, 22], 99: [15, 16, 17, 18,

Re: reading list of list to a file

2007-12-09 Thread Steve Howell
--- caroliina <[EMAIL PROTECTED]> wrote: > > i made a list of lists but i cant write it into a > file. how do i get the > first string in a sublist? > -- Try doing this: print list_of_lists print list_of_lists[0] print list_of_lists[0][0] print list_of_lists[0][0][0] It might give you some i

Re: reading list of list to a file

2007-12-09 Thread Pablo Ziliani
Hi Croliina, caroliina escribió: > i made a list of lists Please notice that this problem: > but i cant write it into a file. has nothing to do with this other one: > how do i get the > first string in a sublist? > For the first one, it is impossible to answer without seeing some actual co

Re: how to convert 3 byte to float

2007-12-09 Thread marek . rocki
Mario M. Mueller napisał(a): > Personally I would expect simple counts (since other seismic formats don't > even think of using floats because most digitizers deliver counts). But I > was told that there are floats inside. > > But if I assume counts I get some reasonable numbers out of the file. I

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Pablo Ziliani
Seongsu Lee escribió: > Hi, > > I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > (...) > > I want to find out the key value which has a specific > integer in the list of its value. Sorry if this is unhelpful, but have you considered m

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Seongsu Lee
On 12월10일, 오전1시23분, Seongsu Lee <[EMAIL PROTECTED]> wrote: > Hi, > > I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > Follow is a simple example with 5 keys. > > dict = {1: [1, 2, 3, 4, 5], >2: [10, 11, 12], >90: [100, 101,

Tkinter weird (and randomly inconsistant) crashes

2007-12-09 Thread wolfonenet
Hi All, My setup is: WinXP Python 2.5.1 TKinter version: $Revision: 50704 $ Tcl: 8.4 Debugger: WinPdb My program uses some Tkinter code written by someone else, that creates a basic 24x80 terminal across different platforms. The terminal worked fine in earlier versions of Python (version 1.5.2

Re: Best ways of managing text encodings in source/regexes?

2007-12-09 Thread tvn
Please see the correction from Cliff pasted here after this excerpt. Tim > the byte string is ASCII which is a subset of Unicode (IS0-8859-1 > isn't).) The one comment I'd make is that ASCII and ISO-8859-1 are both subsets of Unicode, (which relates to the abstract code-points) but ASCII is also

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-09 Thread [EMAIL PROTECTED]
On Dec 9, 8:52�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 22:36, John Machin <[EMAIL PROTECTED]> wrote: > > > > > > > On Dec 8, 12:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > > I get

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Seongsu Lee
On 12월10일, 오전1시53분, Pablo Ziliani <[EMAIL PROTECTED]> wrote: > Seongsu Lee escribió: > > > Hi, > > > I have a dictionary with million keys. Each value in the > > dictionary has a list with up to thousand integers. > > (...) > > > I want to find out the key value which has a specific > > integer in

Re: a way to keep track of # of clicks

2007-12-09 Thread Shawn Minisall
Is there a way to keep track of the number of times someone clicks on a menu item in a prorgam? What I want to do is make the rectangle disappear after they click on it at the main menu 3 times so visually show them they can't do it any longer. > > Since I appended the button to a main menu lis

Re: Minimalistic Software Transactional Memory

2007-12-09 Thread John J. Lee
Michael Sparks <[EMAIL PROTECTED]> writes: > Duncan Booth wrote: > >> Michael Sparks <[EMAIL PROTECTED]> wrote: >> >>> I'm interested in writing a simple, minimalistic, non persistent (at >>> this stage) software transactional memory (STM) module. The idea being >>> it should be possible to write

Re: a Python person's experience with Ruby

2007-12-09 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > Thus: close; > > could replace close(); Wouldn't this give an ambiguity? afcn=close # make an "alias" to the close function val=close() # set val to the return value of the close function -- -- Lou

Re: a Python person's experience with Ruby

2007-12-09 Thread Steve Howell
After starting this discussion thread, I found the link below: http://www.b-list.org/weblog/2006/jun/18/lets-talk-about-python-and-ruby/ If you're like me--struggling to learn Ruby while having Python as your primary point of reference--you might find some of the points informative. I suspect vi

Re: a Python person's experience with Ruby

2007-12-09 Thread Bruno Desthuilliers
Lou Pecora a écrit : > In article <[EMAIL PROTECTED]>, > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >>>Thus: close; >>>could replace close(); *Please* give proper attribution. I'd *never* suggest such a thing. > > Wouldn't this give an ambiguity? > > afcn=close # make an

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Bruno Desthuilliers
Seongsu Lee a écrit : > Hi, > > I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > Follow is a simple example with 5 keys. > > dict = {1: [1, 2, 3, 4, 5], >2: [10, 11, 12], >90: [100, 101, 102, 103, 104, 105], >91:

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread bearophileHUGS
Seongsu Lee: > What do you think of this? Ideas with less space complexity? You can put the second group of keys in a second dictionary, so you don't have to mangle them, and it may be a bit faster. Regarding the space complexity, I don't know how you can reduce it with Python. Probably you can c

Re: Dictionary instantiation?

2007-12-09 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Fri, 07 Dec 2007 11:56:14 +0100, Bruno Desthuilliers wrote: > > >>Also, modifying a sequence in place while iterating over it is a *very* >>bad idea. > > > That's somewhat of an exaggeration, surely. Somewhat of a shortcut if you want - given the context, I obvio

Islamic Manners (1): Sidq (Truthfulness

2007-12-09 Thread abdo911
Allâh, Exalted is He says, "You who have faith! Have taqwâ of Allâh and be with the truthful"; "...being true to Allâh would be better for them"; "... men and women who are truthful...Allâh has prepared for them forgiveness and an immense reward"; "Among the believers are those who have been true

Re: python/regex question... hope someone can help

2007-12-09 Thread charonzen
> Another suggestion is to ensure that the job specification is not > overly simplified. How did you parse the text into "words" in the > prior exercise that produced the list of bigrams? Won't you need to > use the same parsing method in the current exercise of tagging the > bigrams with an under

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 8, 4:54 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > > > On Dec 8, 12:42 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > >>MonkeeSage a écrit : > > >>>On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > > >>(snip) > > 4) Ruby force

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 9, 1:58 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > Sure. But as I understand, every attribute in python is a value, sorry...*references* a value -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert 3 byte to float

2007-12-09 Thread John Machin
On Dec 10, 3:40 am, [EMAIL PROTECTED] wrote: > Mario M. Mueller napisa³(a): > > > Personally I would expect simple counts (since other seismic formats don't > > even think of using floats because most digitizers deliver counts). But I > > was told that there are floats inside. > > > But if I assume

a strange SyntaxError

2007-12-09 Thread CoolGenie
Hi! I'm trying to write a small adesklet that will read newsfeeds. Here's the code: # # # fparser.py # # P. Kaminski <[EMAIL PROTECTED]> # Time-stamp: <> ## impor

Re: a Python person's experience with Ruby

2007-12-09 Thread Steve Howell
--- MonkeeSage <[EMAIL PROTECTED]> wrote: > > Not just callable, but interchangeable. My point was > that in ruby, if > you use a block or a lambda as a HOF, you have to > use #call / #[] / > yield keyword on it to call it. > > def foo(a) > puts a > end > bar = lambda { | a | puts a } > > # t

Re: a strange SyntaxError

2007-12-09 Thread CoolGenie
OK, sorry, this was about indents. Stupid VIM! -- http://mail.python.org/mailman/listinfo/python-list

Re: a strange SyntaxError

2007-12-09 Thread John Machin
On Dec 10, 7:15 am, CoolGenie <[EMAIL PROTECTED]> wrote: > Hi! > I'm trying to write a small adesklet that will read newsfeeds. Here's > the code: > > # > # > # fparser.py > # > # P. Kaminski <[EMAIL PROTECTED]> > # Time-stamp: <>

Re: a strange SyntaxError

2007-12-09 Thread Steve Howell
--- CoolGenie <[EMAIL PROTECTED]> wrote: > self.feed = self.config['feedsrc'] > self.numfeeds = self.config['numfeeds'] > self.numlines = self.config['numlines'] > > self.w = 520 > self.h = 12*self.numfeeds*(self.numlines+1) > adesklets.

Re: a strange SyntaxError

2007-12-09 Thread Samuel
On Sun, 09 Dec 2007 12:35:46 -0800, CoolGenie wrote: > OK, sorry, this was about indents. Stupid VIM! $ mkdir -p $HOME/.vim/ftplugin/ $ echo "setlocal sw=4 setlocal ts=4 noremap py o/**/ " >> ~/.vim/ftplugin/python.vim $ echo "syntax on set sw=2 set ts=2 set nu set nuw=3 set autoin

Re: Distinguishing attributes and methods

2007-12-09 Thread MonkeeSage
On Dec 8, 4:11 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > > > On Dec 8, 12:56 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > >>MonkeeSage a écrit : > > >>>On Dec 8, 2:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > On Fri, 07 Dec 2

Re: a strange SyntaxError

2007-12-09 Thread Steve Howell
--- CoolGenie <[EMAIL PROTECTED]> wrote: > OK, sorry, this was about indents. Stupid VIM! No prob. Add something like this (untested) to your ~/.vimrc: set expandtab set sw=4 set ts=4 Looking for

Re: a strange SyntaxError

2007-12-09 Thread Steve Howell
--- CoolGenie <[EMAIL PROTECTED]> wrote: > OK, sorry, this was about indents. Stupid VIM! One more piece of VIM advice. You can use "set list" to show where tabs are. I prefer to convert my own tabs to spaces automatically, but you inevitably come across code that you don't own where it's nice

Re: Minimalistic Software Transactional Memory

2007-12-09 Thread Michael Sparks
John J. Lee wrote: > Durus might be worth a look too (though I doubt it's suitable for your > situation): > > http://www.mems-exchange.org/software/durus/ > > The link to their paper about it seems to be broken, but I think it > was based somewhat on ZODB, but is simpler (67k tarball :-). Much

Re: a Python person's experience with Ruby

2007-12-09 Thread I V
On Sun, 09 Dec 2007 11:58:05 -0800, MonkeeSage wrote: > class A > attr_accessor :a # == self.a, ># accessible to instances of A > def initialize > @a = "foo" # A.__a ># only accessible from class scope of A > end > end > > Once again, there is no such

Re: Different kinds of Import Errors

2007-12-09 Thread Jeremy C B Nicoll
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 09 Dec 2007 00:25:53 +, Jeremy C B Nicoll wrote: > > > > for app_name in settings.INSTALLED_APPS: > > > try: > > > __import__(app_name + '.management', {}, {}, ['']) > > > except ImportError, exc: > >

Re: Newbie edit/compile/run cycle question

2007-12-09 Thread Jeremy C B Nicoll
Steve Howell <[EMAIL PROTECTED]> wrote: > > --- Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > > > Steve Howell <[EMAIL PROTECTED]> wrote: > > > > > --- Jeremy C B Nicoll <[EMAIL PROTECTED]> > > wrote: > > > > > > What command (in XP) does one need to issue to syntax check a saved > > > > pyt

regular expression for nested parentheses

2007-12-09 Thread Noah Hoffman
I have been trying to write a regular expression that identifies a block of text enclosed by (potentially nested) parentheses. I've found solutions using other regular expression engines (for example, my text editor, BBEdit, which uses the PCRE library), but have not been able to replicate it using

Is a "real" C-Python possible?

2007-12-09 Thread Jack
I understand that the standard Python distribution is considered the C-Python. Howerver, the current C-Python is really a combination of C and Python implementation. There are about 2000 Python files included in the Windows version of Python distribution. I'm not sure how much of the C-Python is im

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 9, 3:10 pm, I V <[EMAIL PROTECTED]> wrote: > On Sun, 09 Dec 2007 11:58:05 -0800, MonkeeSage wrote: > > class A > > attr_accessor :a # == self.a, > ># accessible to instances of A > > def initialize > > @a = "foo" # A.__a > ># only accessible from c

Re: regular expression for nested parentheses

2007-12-09 Thread John Machin
On Dec 10, 8:13 am, Noah Hoffman <[EMAIL PROTECTED]> wrote: > I have been trying to write a regular expression that identifies a > block of text enclosed by (potentially nested) parentheses. I've found > solutions using other regular expression engines (for example, my text > editor, BBEdit, which

Re: Is a "real" C-Python possible?

2007-12-09 Thread Diez B. Roggisch
Jack schrieb: > I understand that the standard Python distribution is considered > the C-Python. Howerver, the current C-Python is really a combination > of C and Python implementation. There are about 2000 Python files > included in the Windows version of Python distribution. I'm not sure > how mu

Re: Is a "real" C-Python possible?

2007-12-09 Thread Jack
>> I'm not sure >>how much of the C-Python is implemented in C but I think the more >>modules implemented in C, the better performance and lower memory >>footprint it will get. > > Prove it. ;-) I guess this is subjective :) - that's what I felt in my experience with web applications developed i

Re: [Python-3000] Possible Duck Typing Problem in Python 2.5?

2007-12-09 Thread Guilherme Polo
2007/12/9, hashcollision <[EMAIL PROTECTED]>: > From http://ivory.idyll.org/blog/dec-07/conversions.html: > class X: > internal = [5,6,7,8] > def __getitem__(self, i): > return self.internal[i] > > x = X() > > l = [1,2,3] > print l + x > > > > fails withTypeError: can only concatenate list (not

Re: Is a "real" C-Python possible?

2007-12-09 Thread Jorge Godoy
Jack wrote: > I wonder if it's possible to have a Python that's completely (or at > least for the most part) implemented in C, just like PHP - I think > this is where PHP gets its performance advantage. Or maybe I'm wrong PHP is slower than Python. -- http://mail.python.org/mailman/listinfo/pyt

Re: Is a "real" C-Python possible?

2007-12-09 Thread Aahz
In article <[EMAIL PROTECTED]>, Jack <[EMAIL PROTECTED]> wrote: > >I understand that the standard Python distribution is considered >the C-Python. Howerver, the current C-Python is really a combination >of C and Python implementation. There are about 2000 Python files >included in the Windows versi

Re: a Python person's experience with Ruby

2007-12-09 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 8, 4:54 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >>MonkeeSage a écrit : >> >> >> >> >>>On Dec 8, 12:42 pm, Bruno Desthuilliers >>><[EMAIL PROTECTED]> wrote: >> MonkeeSage a écrit : >> >On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: >

Re: a Python person's experience with Ruby

2007-12-09 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 9, 1:58 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > >> Sure. But as I understand, every attribute in python is a value, > > > sorry...*references* a value > So make it: 'reference an object' -- http://mail.python.org/mailman/listinfo/python-list

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Jeremy C B Nicoll
Seongsu Lee <[EMAIL PROTECTED]> wrote: > Hi, > > I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > Follow is a simple example with 5 keys. > > dict = {1: [1, 2, 3, 4, 5], >2: [10, 11, 12], >90: [100, 101, 102, 103, 104, 1

Re: regular expression for nested parentheses

2007-12-09 Thread Noah Hoffman
On Dec 9, 1:41 pm, John Machin <[EMAIL PROTECTED]> wrote: > A pattern that can validly be described as a "regular expression" > cannot count and thus can't match balanced parentheses. Some "RE" > engines provide a method of tagging a sub-pattern so that a match must > include balanced () (or [] or

Re: a Python person's experience with Ruby

2007-12-09 Thread Bruno Desthuilliers
Steve Howell a écrit : (snip) > > Jordan and others, thanks for all your posts; I am > learning a lot about both languages. > > This is what I've gathered so far. > > Python philosophy: >passing around references to methods should be > natural (i.e. my_binary_op = math.add) >calling meth

Re: regular expression for nested parentheses

2007-12-09 Thread John Machin
On Dec 10, 8:53 am, Noah Hoffman <[EMAIL PROTECTED]> wrote: > On Dec 9, 1:41 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > A pattern that can validly be described as a "regular expression" > > cannot count and thus can't match balanced parentheses. Some "RE" > > engines provide a method of taggi

Re: Recommendations for writing a user guide with examples?

2007-12-09 Thread Terry Reedy
"Paddy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Dec 8, 9:22 pm, Neal Becker <[EMAIL PROTECTED]> wrote: | > I'm looking for recommendations for writing a user manual. It will need | > lots of examples of command line inputs and terminal outputs. | > | > I'd like to minim

Re: Is a "real" C-Python possible?

2007-12-09 Thread Shadowsithe
That first article is five years old... I wouldn't give too much weight to it. -- http://mail.python.org/mailman/listinfo/python-list

RE: changing fonts?

2007-12-09 Thread jyoung79
Hi Doug, > I'm not *that* familiar with the Terminal program on OS/X, but regardless > perhaps I can point out a possibly useful path to explore... Wow!! Thanks for all this info!! This is some good stuff!!! :-) Well, I got to experimenting with a lot of different stuff, as well as doing a l

Re: Is a "real" C-Python possible?

2007-12-09 Thread Christian Heimes
Jack wrote: > I guess this is subjective :) - that's what I felt in my experience > with web applications developed in Python and PHP. I wasn't able to > find a direct comparison online. Please compare the number of serious bugs and vulnerabilities in PHP and Python. > I understand. Python module

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread bearophileHUGS
Jeremy C B Nicoll: > The code someone else posted to reverse the keys is all very well, but > surely hugely wasteful on cpu, maybe storage, and elapsed time. If you are talking about my D code then I know it, the creation of the first dict has to be skipped, if possible... The code I have posted m

Re: Is a "real" C-Python possible?

2007-12-09 Thread Terry Reedy
"Jack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I understand that the standard Python distribution is considered | the C-Python. Howerver, the current C-Python is really a combination | of C and Python implementation. There are about 2000 Python files | included in the Windows

Are Python deques linked lists?

2007-12-09 Thread Just Another Victim of the Ambient Morality
I'm looking for a linked list implementation. Something iterable with constant time insertion anywhere in the list. I was wondering if deque() is the class to use or if there's something else. Is there? Thank you... -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python deques linked lists?

2007-12-09 Thread John Machin
On Dec 10, 9:43 am, "Just Another Victim of the Ambient Morality" <[EMAIL PROTECTED]> wrote: > I'm looking for a linked list implementation. Something iterable with > constant time insertion anywhere in the list. It's on the shelf between the jar of phlogiston and the perpetual motion machine

how to get module globals into a class ?

2007-12-09 Thread stef mientki
hello, this question may look a little weird, but I want to create library shells that are a simple as possible. So I've a module where one base class is defined, which looks like this (and might be complex) base_class_file.py class brick_base ( object ) : now I've a lot of l

ZODB List

2007-12-09 Thread Flavio
Hi, I am a big fan of ZODB and use it stand alone on many project of mine. One of the things I miss is a community around it. I don't care much about ZOPE (though I admire it) and have not being able to find a ZODB focused community. Is there one? thanks -- http://mail.python.org/mailman/listi

Re: Is a "real" C-Python possible?

2007-12-09 Thread Jack
>> I think most Java-Python benchmarks you can find online will indicate >> that Java is a 3-10 times faster. A few here: >> http://mail.python.org/pipermail/python-list/2002-January/125789.html >> http://blog.snaplogic.org/?p=55 > > There are lies, damn lies and benchmarks. :) > > Pure Python cod

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Jeremy C B Nicoll
[EMAIL PROTECTED] wrote: > Jeremy C B Nicoll: > > The code someone else posted ... > > If you are talking about my D code then I know it... No I meant the code that used python to iterate over the dict and create zillions of extra keys. I've deleted earlier posts in the thread and wasn't sure w

Re: changing fonts?

2007-12-09 Thread greg
[EMAIL PROTECTED] wrote: > I took Greg's idea and found this web-site: > > http://www.unicode.org/charts/PDF/U0370.pdf > > which gave me all the unicode characters for the Greek font. You can also use the MacOSX Character Palette to go hunting for unicode characters. You can get to it from Term

Re: a Python person's experience with Ruby

2007-12-09 Thread Steve Howell
--- Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Steve Howell a écrit : > (snip) > > > > Jordan and others, thanks for all your posts; I am > > learning a lot about both languages. > > > > This is what I've gathered so far. > > > > Python philosophy: > >passing around references to met

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
Hi Bruno, I think that we've been having a mainly "semantic" (pun intended) dispute. I think you're right, that we've been using the same words with different meanings. I would like to say firstly that I've been using python for a few years now (about three I think), and I think I have a basic gr

Re: a Python person's experience with Ruby

2007-12-09 Thread MonkeeSage
On Dec 9, 6:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > Hi Bruno, > > I think that we've been having a mainly "semantic" (pun intended) > dispute. I think you're right, that we've been using the same words > with different meanings. > > I would like to say firstly that I've been using python for

Re: Capturing global input?

2007-12-09 Thread nomihn0
Thanks to all, you were very helpful. I suppose I'll use Jython after all. On Dec 6, 10:17 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 6, 9:16 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > > > On Dec 6, 3:51 pm, nomihn0 <[EMAIL PROTECTED]> wrote: > > > > I'd like to accept mouse gestures

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Zepo Len
> I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > Follow is a simple example with 5 keys. > > dict = {1: [1, 2, 3, 4, 5], >2: [10, 11, 12], >90: [100, 101, 102, 103, 104, 105], >91: [20, 21, 22], >99: [15,

  1   2   >