Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread Martin v. Löwis
> but no tcllib !!! > perhaps that's the problem? Did I assume that it was installed by the > tk mandriva module ? I see. I would have never guessed that you can manage to install Tk but not Tcl on Mandriva... Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

What is Jython?

2007-10-31 Thread sarup26
Hello .. I would like to know more about Python and Jython? What is the difference between both of them? What is the future for Jython and which are the areas where it is used? Swot -- http://mail.python.org/mailman/listinfo/python-list

ANN: O'Reilly e-book, "Getting Started with Pyparsing"

2007-10-31 Thread Paul McGuire
I'm happy to report the release of the O'Reilly ShortCut, "Getting Started With Pyparsing." This 65-page e-book goes into detail on Pyparsing's design rationale, basic features, and a succession of applications. "Getting Started With Pyparsing" covers a range of samples, from an extended version o

Re: py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-10-31 Thread GaryLee
On 10 31 , 8 08 , Michael <[EMAIL PROTECTED]> wrote: > I'm trying to build a exe on a vista system using py2exe. It will > deploy to vista and XP systems. If it matters, the application uses > pyserial, as well. I have VS Studio 2005 installed on this laptop as > well. I've found this so far that

Re: Python Interview Questions

2007-10-31 Thread Paul Rubin
Rhamphoryncus <[EMAIL PROTECTED]> writes: > += shouldn't be an obvious choice for sequences. If it's mutable, > use .append(). If it's immutable, build up in a mutable sequence, > then convert. I generally prefer to do this with generators rather than mutation. I.e. instead of blech = [

Re: A Python 3000 Question

2007-10-31 Thread Carl Banks
On Oct 30, 1:30 am, George Sakkis <[EMAIL PROTECTED]> wrote: > Having a builtin len() that calls the method __len__ > seems (using your words) "not only foolish but wasteful". But what about (for instance) having the bitwise not operator (^) calling __bitwise_not__. Is that foolish and wasteful?

Re: A Python 3000 Question

2007-10-31 Thread Carl Banks
On Oct 31, 6:29 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 31 Oct 2007 07:59:58 -0700, Carl Banks wrote: > > Python considers len to be an operator for all intents and purposes. > > Python chose to spell this operator like a regular function, but it > > could easily

Re: Dictionary help

2007-10-31 Thread Steve
On Wed, 31 Oct 2007 17:02:49 -0500, Larry Bates wrote: > Steve wrote: >> I'm currently working on a little database type program is which I'm >> using a dictionary to store the information. The key is a component a >> and the definition is a list of parts that make up the component. My >> problem

Re: basic threading question

2007-10-31 Thread [david]
thanx :~) -- http://mail.python.org/mailman/listinfo/python-list

Re: PyDict_*() refcount assumptions

2007-10-31 Thread Gabriel Genellina
En Wed, 31 Oct 2007 22:01:53 -0300, <[EMAIL PROTECTED]> escribió: > i checked this: > http://svn.python.org/projects/python/trunk/Doc/data/refcounts.dat > and it seems that > PyDict_SetItem incref the value being added and the key > and PyDict_DelItem does not decrement any refcounts > so i have

Re: jpeg image read class

2007-10-31 Thread [EMAIL PROTECTED]
Marc thanx for the reply..it wd help me to write better code..i was trying to learn PIL and python and may be my java background made it unpythonic..will try to improve it again many thanx dn -- http://mail.python.org/mailman/listinfo/python-list

Re: marshal vs pickle

2007-10-31 Thread Paul Rubin
Raymond Hettinger <[EMAIL PROTECTED]> writes: > ''' This is not a general "persistence" module. For general > persistence and transfer of Python objects through RPC calls, see > the modules :mod:`pickle` and :mod:`shelve`. That advice should be removed since Python currently does not have a gene

Re: capturing output of command line in an array

2007-10-31 Thread amjadcsu
thanks Lee, I would just like to get the "node" in that list. so it would be something like this alist=[node13,node12,node8,node2,node1.] I dont want the whole info is it possible?? On Oct 31, 9:44 am, Lee Capps <[EMAIL PROTECTED]> wrote: > On Oct 31, 2007, at 11:01 AM, [EMAIL PROTECTED] wrot

Re: marshal vs pickle

2007-10-31 Thread Gabriel Genellina
En Wed, 31 Oct 2007 19:10:48 -0300, Raymond Hettinger <[EMAIL PROTECTED]> escribió: > FWIW, I've updated the docs to be absolutely clear on the subject: As you are into it, the list of supported types should be updated too: > The following types are supported: ``None``, integers, > long > inte

Re: XML DOM, but in chunks

2007-10-31 Thread George Sakkis
On Oct 31, 4:43 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 31 Oct 2007 20:24:43 +, Sean Davis wrote: > > I have some very large XML files that are basically recordsets. I > > would like to access each record, one-at-a-time, and I particularly > > like the ElementTree lib

Re: capturing output of command line in an array

2007-10-31 Thread Gabriel Genellina
En Wed, 31 Oct 2007 19:20:56 -0300, <[EMAIL PROTECTED]> escribió: > I am looking to just get the node name from that info. > I dont need all other info > so my list would be just > alist=[node13,node12,node8,node1 ] > is it possible?? > >> > node13 2 (0/ 56) [ 0.00, 0.00, 0.00] [

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread wyleu
On 31 Oct, 18:46, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Those TK libraries tcllib=None tklib=None tcl_includes=None > > tk_includes=None > > This also contradicts your earlier statement that you have libtk8.4.so > on your machine. [EMAIL PROTECTED] Python-2.5.1]$ ls -las /usr/lib/lib

XML document causes pickle to go into infinite recursion

2007-10-31 Thread Orest Kozyar
I'm working on a CGI script that pulls XML data from a public database (Medline) and caches this data using shelveleto minimize load on the database. In general, the script works quite well, but keeps crashing every time I try to pickle a particular XML document. Below is a script that illustrate

Re: object inheritance

2007-10-31 Thread Gabriel Genellina
En Wed, 31 Oct 2007 19:26:17 -0300, Anand <[EMAIL PROTECTED]> escribió: > On Oct 31, 9:57 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> >> If you know at compile time which features you want, you can use >> multiple >> inheritance to define the new class. >> If you only know the set of

Re: Endless GIL and thread confusion

2007-10-31 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >I use the Threading module whenever I need to use threads. It works >quite nicely and I have yet to have any problems with it, except for a >little goofiness with WMI that was explained to me long ago. You might >check that module out.

Re: Endless GIL and thread confusion

2007-10-31 Thread Aahz
In article <[EMAIL PROTECTED]>, enska <[EMAIL PROTECTED]> wrote: > >Can someone clarify the steps needed to make access to the interpreter >safe from multiple threads? > >I've been reading the docs for days and I still find them very confusing >and misleading. For example does the PyGILState_Ensur

Re: Method needed for skipping lines

2007-10-31 Thread Anand
On Nov 1, 5:04 am, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Oct 31, 5:02 pm, Gustaf <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > Just for fun, I'm working on a script to count the number of lines in > > source files. Some lines are auto-generated (by the IDE) and shouldn't be > > counted. Th

Re: XML DOM, but in chunks

2007-10-31 Thread Tommy Nordgren
On 31 okt 2007, at 22.36, Tommy Nordgren wrote: > > On 31 okt 2007, at 21.24, Sean Davis wrote: > >> I have some very large XML files that are basically recordsets. I >> would like to access each record, one-at-a-time, and I particularly >> like the ElementTree library for accessing the data. I

Re: 3 number and dot..

2007-10-31 Thread Paul Rubin
Abandoned <[EMAIL PROTECTED]> writes: > 12332321 ==> 12.332.321 Untested: def convert(n): assert type(n) in (int,long) if n < 0: return '-%s'% convert(-n) if n < 1000: return str(n) return '%s.%03d' % (convert(n//1000), n % 1000) -- http://mail.python.org/mailman/listinfo/python-list

Re: 3 number and dot..

2007-10-31 Thread George Sakkis
On Oct 31, 7:32 pm, [EMAIL PROTECTED] wrote: > Hrvoje Niksic: > > > I'm surprised that no one has proposed a regex solution, such as: > > I presume many Python programmers aren't much used in using REs. > > > >>> import re > > >>> re.sub(r'\d{1,3}(?=(?:\d{3})+$)', r'\g<0>.', str(1234567)) > > '1.23

PyDict_*() refcount assumptions

2007-10-31 Thread sndive
i checked this: http://svn.python.org/projects/python/trunk/Doc/data/refcounts.dat and it seems that PyDict_SetItem incref the value being added and the key and PyDict_DelItem does not decrement any refcounts so i have to do so manually for the key and for the data( by calling PyDict_GetItem first

Re: setting variables in outer functions

2007-10-31 Thread Diez B. Roggisch
Hrvoje Niksic schrieb: > "Chris Mellon" <[EMAIL PROTECTED]> writes: > >> I have no idea why someone who already has a working, object system >> would want to implement their own on top of closures. > > This subthread is getting ridiculous -- closures are *not* useful only > for implementing objec

Re: a few questions.

2007-10-31 Thread Paul Hankin
On Oct 31, 10:10 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > for i in xrange(0,5): > hundreds, remainder=divmod(stores[i], 100) > print "Store: %i %s" % (i+1, hundreds*"*") Yes, or since you don't need 'remainder'... for i in range(5): hundreds = stores[i] // 100 print "Sto

Re: Method needed for skipping lines

2007-10-31 Thread Paul Hankin
On Oct 31, 5:02 pm, Gustaf <[EMAIL PROTECTED]> wrote: > Hi all, > > Just for fun, I'm working on a script to count the number of lines in source > files. Some lines are auto-generated (by the IDE) and shouldn't be counted. > The auto-generated part of files start with "Begin VB.Form" and end with

Re: A Python 3000 Question

2007-10-31 Thread Chris Mellon
On Oct 31, 2007 6:02 PM, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 31, 6:13 pm, Steven D'Aprano > > > What you have measured is a local optimization that is only useful when > > you have a tight loop with lots of calls to the same len(): > > > > Len = sequence.__len__ > > while Len() < 1000

Re: 3 number and dot..

2007-10-31 Thread Paul Hankin
On Oct 31, 7:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? Short without being too unreadable: def conv(x, sep='.'): x = str(x)[::-1] return sep.join(x[i:i + 3] for i in range(0, len(x), 3))[::-1] Or more

Re: setting variables in outer functions

2007-10-31 Thread Hrvoje Niksic
"Chris Mellon" <[EMAIL PROTECTED]> writes: > I have no idea why someone who already has a working, object system > would want to implement their own on top of closures. This subthread is getting ridiculous -- closures are *not* useful only for implementing object systems! The object system thing

Re: 3 number and dot..

2007-10-31 Thread bearophileHUGS
Hrvoje Niksic: > I'm surprised that no one has proposed a regex solution, such as: I presume many Python programmers aren't much used in using REs. > >>> import re > >>> re.sub(r'\d{1,3}(?=(?:\d{3})+$)', r'\g<0>.', str(1234567)) > '1.234.567' It works with negative numbers too. It's a very nice

Re: appending into a list

2007-10-31 Thread Ricardo Aráoz
Beema shafreen wrote: > hi everybody, > I have a file : >A B C D E > > 2717353 2717412A_16_P03641964214-59 > 2717626 2717685A_16_P4156365525-59 > 2717710 2717754

Re: Need some help...

2007-10-31 Thread Ricardo Aráoz
Boris Borcic wrote: > [EMAIL PROTECTED] wrote: >> I want to create a program that I type in a word. >> >> for example... >> >> chaos >> >> each letter equals a number >> >> A=1 >> B=20 >> >> and so on. >> >> So Chaos would be >> >> C=13 H=4 A=1 O=7 S=5 >> >> I want to then have those numbers >

Re: dictionary and list

2007-10-31 Thread Ricardo Aráoz
Beema shafreen wrote: > hi everbody, >I have a file, > a b c d e > 2722316 2722360A_16_P03641972150-44 > 2722510 2722554A_16_P2136023916-44 > 2722570 2722614A_16_P03

Re: two files into an alternate list

2007-10-31 Thread Ricardo Aráoz
Tim Chase wrote: >> i have a file : >> file 1: >> 1 >> 2 >> 3 >> 4 >> 5 >> 6 >> >> file2: >> a >> b >> c >> d >> e >> f >> how do i make the two files into list like this = >> [1,a,2,b,3,c,4,d,5,e,6,f] > > from itertools import cycle > def serialize(*sources): > while True: >

Re: A Python 3000 Question

2007-10-31 Thread George Sakkis
On Oct 31, 6:13 pm, Steven D'Aprano > What you have measured is a local optimization that is only useful when > you have a tight loop with lots of calls to the same len(): > > Len = sequence.__len__ > while Len() < 10: > foo(sequence) Exactly what timeit() does, a tight loop. > But what

Re: setting variables in outer functions

2007-10-31 Thread Chris Mellon
On Oct 31, 2007 5:49 PM, Dustan <[EMAIL PROTECTED]> wrote: > On Oct 31, 7:08 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > Dustan <[EMAIL PROTECTED]> wrote: > > > On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]> > > > wrote: > > >> Neil Cerutti <[EMAIL PROTECTED]> wrote: > > >> > It's allo

Re: setting variables in outer functions

2007-10-31 Thread Dustan
On Oct 31, 7:08 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Dustan <[EMAIL PROTECTED]> wrote: > > On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]> > > wrote: > >> Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> > It's allows a standard programming idiom which provides a > >> > primitive form of

Re: Print a list to a string?

2007-10-31 Thread Steven D'Aprano
On Wed, 31 Oct 2007 22:17:48 +, mrstephengross wrote: > I would like to get the results of a print operation placed in a string. s = str(x) If you specifically need to capture the output of print, then something like this: >>> import cStringIO >>> s = cStringIO.StringIO() >>> print >>s,

Re: Print a list to a string?

2007-10-31 Thread Bruno Desthuilliers
mrstephengross a écrit : > I would like to get the results of a print operation print is a statement, it doesn't yield any 'result'. > placed in a > string. For instance, you can very easily create a list and print it > to stdout: > > x = [1,2,3] > print x # Will print [1,2,3] > > What if

Re: Method needed for skipping lines

2007-10-31 Thread Bruno Desthuilliers
Gustaf a écrit : > Hi all, > > Just for fun, I'm working on a script to count the number of lines in > source files. Some lines are auto-generated (by the IDE) and shouldn't > be counted. The auto-generated part of files start with "Begin VB.Form" > and end with "End" (first thing on the line).

Re: Python Interview Questions

2007-10-31 Thread Rhamphoryncus
On Oct 31, 2:58 am, konryd <[EMAIL PROTECTED]> wrote: > > - string building...do they use "+=" or do they build a list > >and use .join() to recombine them efficiently > > I'm not dead sure about that, but I heard recently that python's been > optimized for that behaviour. That means: using +=

Re: Print a list to a string?

2007-10-31 Thread Gary Herron
mrstephengross wrote: > I would like to get the results of a print operation placed in a > string. For instance, you can very easily create a list and print it > to stdout: > > x = [1,2,3] > print x # Will print [1,2,3] > > What if I want the text "[1,2,3]" placed in a string? For instance, > s

Re: A Python 3000 Question

2007-10-31 Thread Steven D'Aprano
On Wed, 31 Oct 2007 07:59:58 -0700, Carl Banks wrote: > Python considers len to be an operator for all intents and purposes. > Python chose to spell this operator like a regular function, but it > could easily have given a special syntax to the length operation (for > instance, $#x). I hope you'r

Re: object inheritance

2007-10-31 Thread Anand
On Oct 31, 9:57 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 31 Oct 2007 00:36:34 -0300, Anand <[EMAIL PROTECTED]> escribió: > > >> No, that is an argument for multiple-inheritance, mixin classes etc. You > >> know when constructing the object what behaviour you want it to have. It

Re: capturing output of command line in an array

2007-10-31 Thread amjadcsu
Thanks Lee I am looking to just get the node name from that info. I dont need all other info so my list would be just alist=[node13,node12,node8,node1 ] is it possible?? On Oct 31, 9:44 am, Lee Capps <[EMAIL PROTECTED]> wrote: > On Oct 31, 2007, at 11:01 AM, [EMAIL PROTECTED] wrote: > > > > >

Re: 3 number and dot..

2007-10-31 Thread Hrvoje Niksic
Paul McNett <[EMAIL PROTECTED]> writes: > Chris Mellon has given you the best response: use the locale module > for this. It may be the best choice as far as reuse is concerned, but it's not without serious drawbacks. For one, the locale model doesn't really allow forcing of the separators. Som

Print a list to a string?

2007-10-31 Thread mrstephengross
I would like to get the results of a print operation placed in a string. For instance, you can very easily create a list and print it to stdout: x = [1,2,3] print x # Will print [1,2,3] What if I want the text "[1,2,3]" placed in a string? For instance, something like: x = [1,2,3] str =

Re: A Python 3000 Question

2007-10-31 Thread Steven D'Aprano
On Wed, 31 Oct 2007 13:14:41 +, George Sakkis wrote: > On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote: >> >> >> >> > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> >> On 2007-10-30, Eduardo O. Padoan <[EMAI

Re: marshal vs pickle

2007-10-31 Thread Raymond Hettinger
On Oct 31, 12:27 pm, Aaron Watters <[EMAIL PROTECTED]> wrote: > Anyway since it's easy and makes sense I think > the next version of nucular will have a > switchable option between marshal and cPickle > for persistant storage. Makes more sense to use cPickle and be done with it. FWIW, I've update

Re: a few questions.

2007-10-31 Thread Larry Bates
Shawn Minisall wrote: > 1. whats the best way to round a result to 4 decimal places? > > I tried round, but then read that it only works with exponents of 10. > > I'm trying to do it on this piece of code. > > time = (distance / 4900) > > 2. What direction would I go in if I'm getting 5 inputs

Re: Dictionary help

2007-10-31 Thread Larry Bates
Steve wrote: > I'm currently working on a little database type program is which I'm > using a dictionary to store the information. The key is a component a and > the definition is a list of parts that make up the component. My problem > is I need to list out several components, but not all, and

Re: A Python 3000 Question

2007-10-31 Thread Steven D'Aprano
On Wed, 31 Oct 2007 14:45:59 +, Duncan Booth wrote: >> Thanks for the interesting note. I didn't know that tuples originally >> had no methods. That made len mandatory, I suppose. >> > Only if you think tuples are a sequence rather than a record. Even records have a length. The length of a r

Re: 3 number and dot..

2007-10-31 Thread Steven D'Aprano
On Wed, 31 Oct 2007 21:39:05 +, Abandoned wrote: > On Oct 31, 10:50 pm, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: >> On 31 oct, 16:58, Abandoned <[EMAIL PROTECTED]> wrote: >> >> >> >> > Hi.. >> > I want to do this: >> > for examle: >> > 12332321 ==> 12.332.321 >> >> > How can i do? >> >>> x

Re: 3 number and dot..

2007-10-31 Thread Hrvoje Niksic
Abandoned <[EMAIL PROTECTED]> writes: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? I'm surprised that no one has proposed a regex solution, such as: >>> import re >>> re.sub(r'\d{1,3}(?=(?:\d{3})+$)', r'\g<0>.', str(1234567)) '1.234.567' -- http://mail.p

Re: 3 number and dot..

2007-10-31 Thread Paul McNett
Abandoned wrote: > On Oct 31, 10:18 pm, Paul McNett <[EMAIL PROTECTED]> wrote: >> Abandoned wrote: >> > Hi.. >> > I want to do this: >> > for examle: >> > 12332321 ==> 12.332.321 >> >> > How can i do? >> >> Assuming that the dots are always in the 3rd and 7th position in the string: >> >> def conv

Re: 3 number and dot..

2007-10-31 Thread Abandoned
On Oct 31, 10:50 pm, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > On 31 oct, 16:58, Abandoned <[EMAIL PROTECTED]> wrote: > > > > > Hi.. > > I want to do this: > > for examle: > > 12332321 ==> 12.332.321 > > > How can i do? > >>> x = 12332321 > >>> '.'.join(''.join(i for n, i in g) for k, g in >

Re: XML DOM, but in chunks

2007-10-31 Thread Tommy Nordgren
On 31 okt 2007, at 21.24, Sean Davis wrote: > I have some very large XML files that are basically recordsets. I > would like to access each record, one-at-a-time, and I particularly > like the ElementTree library for accessing the data. Is there a way > to have ElementTree read only one record

a few questions.

2007-10-31 Thread Shawn Minisall
1. whats the best way to round a result to 4 decimal places? I tried round, but then read that it only works with exponents of 10. I'm trying to do it on this piece of code. time = (distance / 4900) 2. What direction would I go in if I'm getting 5 inputs from the user and want to make a bar t

Re: 3 number and dot..

2007-10-31 Thread elf
On Oct 31, 9:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? Hi, If you want to define your own function, no matter what the length of the number is or what separator you want to choose, this will work: def conv(s,

Re: 3 number and dot..

2007-10-31 Thread Abandoned
On Oct 31, 10:50 pm, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > On 31 oct, 16:58, Abandoned <[EMAIL PROTECTED]> wrote: > > > > > Hi.. > > I want to do this: > > for examle: > > 12332321 ==> 12.332.321 > > > How can i do? > >>> x = 12332321 > >>> '.'.join(''.join(i for n, i in g) for k, g in >

Re: 3 number and dot..

2007-10-31 Thread elf
On Oct 31, 9:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? If you want do define your own function this will work, no matter how long the number is, or what separator you choose: def conv(s, sep='.'): start=le

Re: 3 number and dot..

2007-10-31 Thread Abandoned
On Oct 31, 10:38 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Oct 31, 2:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > > > Hi.. > > I want to do this: > > for examle: > > 12332321 ==> 12.332.321 > > > How can i do? > >>> x = (12332321,) > >>> while (x[0]>0): x=divmod(x[0],1000)+x[1:] > ... > >>>

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread TheFlyingDutchman
On Oct 31, 8:11 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > string.find has always been kind of a wart in Python; that's why > they're getting rid of it. For testing for the presence of a > substring, use the in operator: Per the Python 3000 presentation given by Guido Van Rossum at PyCon Feb

Re: 3 number and dot..

2007-10-31 Thread Roberto Bonvallet
On 31 oct, 16:58, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? >>> x = 12332321 >>> '.'.join(''.join(i for n, i in g) for k, g in >>> groupby(enumerate(reversed(str(x))), lambda (n, i): n//3))[::-1] '12.332.321' >>> --

Re: Method needed for skipping lines

2007-10-31 Thread Yu-Xi Lim
Gustaf wrote: > Hi all, > > Just for fun, I'm working on a script to count the number of lines in > source files. Some lines are auto-generated (by the IDE) and shouldn't > be counted. The auto-generated part of files start with "Begin VB.Form" > and end with "End" (first thing on the line). Th

Re: 3 number and dot..

2007-10-31 Thread Chris Mellon
On Oct 31, 2007 3:24 PM, Abandoned <[EMAIL PROTECTED]> wrote: > On Oct 31, 10:18 pm, Paul McNett <[EMAIL PROTECTED]> wrote: > > Abandoned wrote: > > > Hi.. > > > I want to do this: > > > for examle: > > > 12332321 ==> 12.332.321 > > > > > How can i do? > > > > Assuming that the dots are always in t

Re: 3 number and dot..

2007-10-31 Thread Abandoned
On Oct 31, 10:38 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Oct 31, 2:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > > > Hi.. > > I want to do this: > > for examle: > > 12332321 ==> 12.332.321 > > > How can i do? > >>> x = (12332321,) > >>> while (x[0]>0): x=divmod(x[0],1000)+x[1:] > ... > >>>

Re: XML DOM, but in chunks

2007-10-31 Thread Marc 'BlackJack' Rintsch
On Wed, 31 Oct 2007 20:24:43 +, Sean Davis wrote: > I have some very large XML files that are basically recordsets. I > would like to access each record, one-at-a-time, and I particularly > like the ElementTree library for accessing the data. Is there a way > to have ElementTree read only on

Re: 3 number and dot..

2007-10-31 Thread Paul McGuire
On Oct 31, 2:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? >>> x = (12332321,) >>> while (x[0]>0): x=divmod(x[0],1000)+x[1:] ... >>> x (0, 12, 332, 321) >>> ".".join(map(str,x[1:])) '12.332.321' -- Paul -- http:

XML DOM, but in chunks

2007-10-31 Thread Sean Davis
I have some very large XML files that are basically recordsets. I would like to access each record, one-at-a-time, and I particularly like the ElementTree library for accessing the data. Is there a way to have ElementTree read only one record of the data at a time? Alternatively, are there other

Re: 3 number and dot..

2007-10-31 Thread Abandoned
On Oct 31, 10:18 pm, Paul McNett <[EMAIL PROTECTED]> wrote: > Abandoned wrote: > > Hi.. > > I want to do this: > > for examle: > > 12332321 ==> 12.332.321 > > > How can i do? > > Assuming that the dots are always in the 3rd and 7th position in the string: > > def conv(s, sep="."): >l = [s[0:3],

Re: 3 number and dot..

2007-10-31 Thread Paul McNett
Abandoned wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? Assuming that the dots are always in the 3rd and 7th position in the string: def conv(s, sep="."): l = [s[0:3], s[3:6], s[6:]] return sep.join(l) print conv("12332321") -- pkm ~ htt

Re: Namespace question

2007-10-31 Thread Chris M
On Oct 31, 10:06 am, Frank Aune <[EMAIL PROTECTED]> wrote: > Hello, > > Is it possible writing custom modules named the same as modules in the > standard library, which in turn use the same module from the standard > library? > > Say I want my application to have a random.py module, which in turn m

3 number and dot..

2007-10-31 Thread Abandoned
Hi.. I want to do this: for examle: 12332321 ==> 12.332.321 How can i do? -- http://mail.python.org/mailman/listinfo/python-list

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Chris Mellon
On Oct 31, 2007 2:01 PM, chewie54 <[EMAIL PROTECTED]> wrote: > On Oct 31, 3:06 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > > chewie54 <[EMAIL PROTECTED]> wrote: > > > > >As an electronics engineer I use some very expensive EDA CAD tool > > >programs that are scriptable using Tcl. I was wondering

Re: marshal vs pickle

2007-10-31 Thread Aaron Watters
On Oct 31, 1:37 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Oct 31, 6:45 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > > > I like to use > > marshal a lot because it's the absolutely fastest > > way to store and load data to/from Python > > I believe this FUD is somewhat out-of-date

Re: why did these companies choose Tcl over Python

2007-10-31 Thread chewie54
On Oct 31, 3:06 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > chewie54 <[EMAIL PROTECTED]> wrote: > > >As an electronics engineer I use some very expensive EDA CAD tool > >programs that are scriptable using Tcl. I was wondering why these > >companies have choose to use Tcl instead of Python. Some

Dictionary help

2007-10-31 Thread Steve
I'm currently working on a little database type program is which I'm using a dictionary to store the information. The key is a component a and the definition is a list of parts that make up the component. My problem is I need to list out several components, but not all, and there associated par

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread Martin v. Löwis
> Those TK libraries tcllib=None tklib=None tcl_includes=None > tk_includes=None This also contradicts your earlier statement that you have libtk8.4.so on your machine. > I don't understand why the headers report None as the file tk.h is > in /usr/include ... or is the lack of the word gener

Re: py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-10-31 Thread Michael
Björn, what library files end up being in your dist directory for that project? Would you mind posting a copy of the output of dir? I'm curious to see if there is a discrepancy. --Michael On Oct 31, 9:22 am, Bjoern Schliessmann wrote: > Michael wrote: > > [py2exe on Vista and XP] > > >

PyCon 2008 - Tutorial HowTo

2007-10-31 Thread Greg Lindstrom
Thinking about presenting a tutorial at PyCon 2008? Here's a link with everything you would ever want to know. http://us.pycon.org/2008/tutorials/proposals/ PyCon simply would not exist without volunteers like YOU. Get involved today! --greg -- http://mail.python.org/mailman/listinfo/python-

Re: permuting over nested dicts?

2007-10-31 Thread Paddy
On Oct 31, 5:21 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > Hoi, > > I have the following data structure (of variable size actually, to make > things simple, just that one): > d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, > 'b': {'x':[7,8,9], 'y':[10,11,12]}} > This can be read as a dict of po

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread wyleu
> tk.h is searched-for in detect_tkinter. Check whether tklib, tcllib, > tcl_includes and tk_includes all get set. This should take only > a single print statement. > > Regards, > Martin Ok I've cleared my increasingly frantic copies out [EMAIL PROTECTED] python2.5]# find / -name tk.h /usr/inclu

Re: Metaclass vs Class factory

2007-10-31 Thread [EMAIL PROTECTED]
On Oct 30, 10:46 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > The same as the difference between a class and a function that returns > an instance. Thanks Bruno. Lorenzo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python bug tracker now secret?

2007-10-31 Thread Terry Reedy
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I'm now getting messages like this from the Python bug tracker on | SourceForge: | | Artifact: This Artifact Has Been Made Private. Only Group Members Can | View Private ArtifactTypes. This message actually comes from

Re: marshal vs pickle

2007-10-31 Thread Raymond Hettinger
On Oct 31, 6:45 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > I like to use > marshal a lot because it's the absolutely fastest > way to store and load data to/from Python. Furthermore > because marshal is "stupid" the programmer has complete > control. A lot of the overhead you get with the > p

Re: Method needed for skipping lines

2007-10-31 Thread Marc 'BlackJack' Rintsch
On Wed, 31 Oct 2007 18:02:26 +0100, Gustaf wrote: > Just for fun, I'm working on a script to count the number of lines in > source files. Some lines are auto-generated (by the IDE) and shouldn't be > counted. The auto-generated part of files start with "Begin VB.Form" and > end with "End" (first t

permuting over nested dicts?

2007-10-31 Thread Christian Meesters
Hoi, I have the following data structure (of variable size actually, to make things simple, just that one): d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, 'b': {'x':[7,8,9], 'y':[10,11,12]}} This can be read as a dict of possibilities: The entities 'a' and 'b' have the parameters 'x' and 'y', each. An

Building libraries that my extensions can use. [distutils]

2007-10-31 Thread [EMAIL PROTECTED]
Hello all, I want to create a shared object that my extension modules can dynamically load with intact symbols across modules. Searching the documentation lead me to distutils.ccompiler. Quite frankly comprehending this has been difficult for the newbie in me. I did google (..and krugle) for setup

Method needed for skipping lines

2007-10-31 Thread Gustaf
Hi all, Just for fun, I'm working on a script to count the number of lines in source files. Some lines are auto-generated (by the IDE) and shouldn't be counted. The auto-generated part of files start with "Begin VB.Form" and end with "End" (first thing on the line). The "End" keyword may appear

Re: simple? embedding question

2007-10-31 Thread Farshid Lashkari
[EMAIL PROTECTED] wrote: > it works! > could i cache maindict pointer in a global var or am i condemned to > call > PyObject* mainmod = PyImport_AddModule("__main__"); > assert(mainmod); > PyObject* maindict = PyModule_GetDict(mainmod); >

Re: Fwd: Namespace question

2007-10-31 Thread Frank Aune
On Wednesday 31 October 2007 15:19:25 Andrii V. Mishkovskyi wrote: > You mean something like this: > >>>import random > >>>def foo(): > > ...print '42' > > >>>random.randit = foo > >>>random.randit() > > 42 > > am I right? > -- I was thinking more of the line: random.py: (my custom random.py

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread Martin v. Löwis
> tk.h is now in just about every directory called include that could in > anyway be connected with this and indeed it does appear in the make > file printout: > > /usr/bin/install -c -m 644 ./Include/tk.h /usr/local/include/python2.5 How did you get tk.h into the Include directory? You shouldn't

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Robin Becker
Martin v. Löwis wrote: ... > I think this question needs to be answered on a case-by-case basis, > but my guess is that it is in most cases historical. Work on Tcl > started in 1988, and it was the first (major?) embeddable scripting > language (that is also free software etc). Python wasn't re

Re: Python bug tracker now secret?

2007-10-31 Thread Martin v. Löwis
> Though it also means all old links are broken and there's no obvious > pointer to the new information. Not all of them, no. For a long time, people could use links of the form www.python.org/sf/, and these links continue to work. Most other links on www.python.org have been fixed. I believe mos

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread wyleu
> So where it tk.h located? tk.h is now in just about every directory called include that could in anyway be connected with this and indeed it does appear in the make file printout: /usr/bin/install -c -m 644 ./Include/sysmodule.h /usr/local/include/ python2.5 /usr/bin/install -c -m 644 ./Inclu

PyCon 2008 - Call for Tutorials

2007-10-31 Thread Greg Lindstrom
PyCon 2008 is being held in Chicago this year. The general conference is March 14-16 with the proceeding day, March 13th, being the traditional "tutorial day". We have had a lot of input on topics to cover and now we are looking for qualified instructors to sign up to present the sessions. Tutoria

  1   2   >