Re: Technical Answer - Protecting code in python

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 22:59:46 -0700, flit wrote: > Going back in the beginning I said : > > "So PLEASE, don't try to convince me about the social / economical / > open source / give to all / be open / all people are honest until > prove contrary / dance with the rabbits... " I have done NONE of

Re: Technical Answer - Protecting code in python

2007-03-21 Thread flit
I didn´t reply to the last D´Aprano reply just to avoid this kind of social war. And yes, I know that if I want 100% security I should not distribute my code. And there is a better way that is not doing any code to be more secure and bug-free (now I am using irony). And no, I am not supporter of so

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 20:59:57 -0400, Bart Willems wrote: > Or the consultant wants to be sure that the two dimwitted nimcumpoops at > the office who /think/ they can write code don't screw up the script > when they're trying to 'fix' or 'improve' something. And blame the > consultant if the scri

Re: copying only recent files from one machine to another

2007-03-21 Thread Ben Finney
kadarla kiran kumar <[EMAIL PROTECTED]> writes: > Iam trying to copy files from one machine to another over SFTP > connection. For that Iam using sftp.get & sftp.put methods. Don't re-invent this wheel: http://rsync.samba.org/> -- \ "I think a good gift for the President would b

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Paddy
On Mar 21, 10:31 pm, [EMAIL PROTECTED] (Cameron Laird) wrote: > In article <[EMAIL PROTECTED]>, > > > > Paddy <[EMAIL PROTECTED]> wrote: > >On Mar 21, 8:20 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > >> "Paddy" <[EMAIL PROTECTED]> writes: > >> > I just had a link to Tim peters first post on doctes

interpreting glyph outlines from ttfquery?

2007-03-21 Thread swiftset
I'm try to convert a glyph into a format I can easily numerically manipulate. So far I've figured out how to use ttfquery to get a list that represents the outline of a contour in a glyph: from ttfquery import describe, glyphquery, glyph f = describe.openFont("/usr/share/fonts/truetype/freefont/ F

copying only recent files from one machine to another

2007-03-21 Thread kadarla kiran kumar
Hi Everybody, Iam trying to copy files from one machine to another over SFTP connection. For that Iam using sftp.get & sftp.put methods. Now, I have to copy only recently created/modified files,i.e, based on timestamps from remote machine to my machine. Is there any standard implemen

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Terry Reedy
"Mark T" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | This is interesting: | | >>> class Test(object): | ... def __getattribute__(self,n): | ... print 'reading',n | ... return object.__getattribute__(self,n) | ... def __setattr__(self,n,v): | ... print 'writing',n

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Paddy
On Mar 21, 8:39 pm, Paul Rubin wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > I just had a link to Tim peters first post on doctest: > >http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 > > removed fromhttp://en.wikipedia.org/wiki/Doctestas it doesn't

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Mark T
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > John Nagle <[EMAIL PROTECTED]> wrote: > >> Marcin Ciura wrote: >> >> > Neither would I. I must have expressed myself not clearly enough. >> > Currently >> > x = y = z >> > is roughly equivalent to >> > x = z >> > y = z

Re: When is List Comprehension inappropriate?

2007-03-21 Thread Paddy
On Mar 22, 4:56 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Paddy <[EMAIL PROTECTED]> wrote: > >... > > > I have found that I have gone too far when I used listcomps for their > > sideeffects rather than wanting the list produced, for example the > > I agree. > > > second listcomp below is a

Re: When is List Comprehension inappropriate?

2007-03-21 Thread Alex Martelli
Paddy <[EMAIL PROTECTED]> wrote: ... > I have found that I have gone too far when I used listcomps for their > sideeffects rather than wanting the list produced, for example the I agree. > second listcomp below is an expression as statement I don't want the > list produced - just the effect on

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Mark T
"Marcin Ciura" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Given > class Node(object): > pass > > node = Node() > nextnode = Node() > > I tried to refactor the following piece of code > node.next = nextnode > node = nextnode You have an error above. The first n

Python-URL! - weekly Python news and links (Mar 22)

2007-03-21 Thread Cameron Laird
This is the first time you've received "Python-URL!" in 2007. No, that's not the fault of your mail server; we've just been on sabbatical. Now we're back. QOTW: "'Doesn't seem to work' is effectivly even more useless than 'doesn't work' [as a symptomatic description]." - Bruno Desthuilliers

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Steve Holden
Virgil Dupras wrote: > On Mar 21, 9:24 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> Marcin Ciura wrote: >>> Steven D'Aprano wrote: >>> x, y, z = 1, 2, 3 >>> x = y = z >>> x, y, z (3, 3, 3) I certainly wouldn't expect to get (2, 3, 3). >>> Neither would I. I must have express

Re: Garbage collection

2007-03-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Wed, 21 Mar 2007 15:32:17 +, Tom Wright <[EMAIL PROTECTED]> >declaimed the following in comp.lang.python: > >> >> True, but why does Python hang on to the memory at all? As I understand it, >> it's keeping a big

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Virgil Dupras
On Mar 21, 10:05 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Virgil Dupras wrote: > > On Mar 21, 9:24 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > >> Marcin Ciura wrote: > >>> Steven D'Aprano wrote: > >>> x, y, z = 1, 2, 3 > >>> x = y = z > >>> x, y, z > (3, 3, 3) > I certa

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-21 Thread Carl Douglas
On 3/22/07, Giovanni Bajo <[EMAIL PROTECTED]> wrote: > On 21/03/2007 6.49, Carl Douglas wrote: > > > Hi John, > > > > In my case, all I needed was a PyFile_AsFile to get the File *. > > However I found that Python errors going to stdout/stderr were not > > being redirected properly when my code was

Re: How to receive a FILE* from Python under MinGW?

2007-03-21 Thread John Pye
On Mar 22, 10:55 am, Giovanni Bajo <[EMAIL PROTECTED]> wrote: > I suggest people to try my GCC 4.1.2 binary installer for Windows which fully > integrates with Python and has scripts in place to solve the MSVCR71.DLL > problem. It was announced on this very list a few days ago: > > http://www.devel

Re: splitting perl-style find/replace regexp using python

2007-03-21 Thread John Pye
Thanks all for your suggestions on this. The 'splitter' idea was particularly good, not something I'd thought of. Sorry for my late reply. -- http://mail.python.org/mailman/listinfo/python-list

Re: regex reading html

2007-03-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, ben miller <[EMAIL PROTECTED]> wrote: >Hello, >I've a program I'm working on where we scrape some of our web pages >using Mechanize libraries and then parse what we've scraped using >different regex functions. However, I've noticed that no matter what I >do with the

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Alex Martelli
John Nagle <[EMAIL PROTECTED]> wrote: > Marcin Ciura wrote: > > > Neither would I. I must have expressed myself not clearly enough. > > Currently > > x = y = z > > is roughly equivalent to > > x = z > > y = z > > I propose to change it to > > y = z > > x = z > > Actually, it is equivalent to >

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Virgil Dupras
On Mar 21, 9:24 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Marcin Ciura wrote: > > Steven D'Aprano wrote: > > x, y, z = 1, 2, 3 > > x = y = z > > x, y, z > >> (3, 3, 3) > > >> I certainly wouldn't expect to get (2, 3, 3). > > > Neither would I. I must have expressed myself not clearl

Re: the second of nested buttons using textvariable remains void!

2007-03-21 Thread jim-on-linux
On Wednesday 21 March 2007 20:11, Samkos wrote: > Hi there, > > I am fighting with a problem I intended to > believe trivial that I could not solve yet! > > I am trying to have a button with a variable > text, that pops up another button with a > variable text when pressed. > > I did that with the

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Steve Holden
Marcin Ciura wrote: > Steven D'Aprano wrote: > x, y, z = 1, 2, 3 > x = y = z > x, y, z >> (3, 3, 3) >> >> I certainly wouldn't expect to get (2, 3, 3). > > Neither would I. I must have expressed myself not clearly enough. > Currently > x = y = z > is roughly equivalent to > x = z > y =

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Paul Rubin
[EMAIL PROTECTED] (John J. Lee) writes: > You've explained that *linking* to a non-permanent URL would break the > rules. You haven't explained why *pasting in* the text of the post > would break the rules (I don't say it wouldn't break them, I'm just > curious). I've looked into this situation a

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread John J. Lee
"Paddy" <[EMAIL PROTECTED]> writes: > On Mar 21, 8:20 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > > "Paddy" <[EMAIL PROTECTED]> writes: > > > I just had a link to Tim peters first post on doctest: > > >http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 > > > removed fromhttp://e

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Bart Willems
Steven D'Aprano wrote: > Protect it from what? Viruses? Terrorists? The corrupt government? Your > ex-wife cutting it up with scissors? People who want to copy it? People > who will look at your code and laugh at you for being a bad programmer? > > Until you tell us what you are trying to protect

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread John Nagle
Marcin Ciura wrote: > Neither would I. I must have expressed myself not clearly enough. > Currently > x = y = z > is roughly equivalent to > x = z > y = z > I propose to change it to > y = z > x = z Actually, it is equivalent to y = z x = y > Python performs chained assignments

Re: the second of nested buttons using textvariable remains void!

2007-03-21 Thread James Stroud
Samkos wrote: > Hi there, > > I am fighting with a problem I intended to believe trivial that > I could not solve yet! > > I am trying to have a button with a variable text, that > pops up another button with a variable text when pressed. > > I did that with the following program in Python, bu

Re: Printing __doc__

2007-03-21 Thread Terry Reedy
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] || Peter is trying to communicate that some aspects of Python are | quite conservative, well-documented, and unlikely to change | across versions or implementations. The syntax of, let's say, | "def", is an example of su

the second of nested buttons using textvariable remains void!

2007-03-21 Thread Samkos
Hi there, I am fighting with a problem I intended to believe trivial that I could not solve yet! I am trying to have a button with a variable text, that pops up another button with a variable text when pressed. I did that with the following program in Python, but the second button remains alwa

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Terry Reedy
"Marcin Ciura" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Neither would I. I must have expressed myself not clearly enough. | Currently | x = y = z | is roughly equivalent to | x = z | y = z except that z is only evaluated once. | I propose to change it to | y = z | x = z Un

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Paul Boddie
flit wrote: > > OK, that kind of answer is what I was trying to avoid.. Perhaps, but it's possible that people get tired of answering the same questions over and over again. A search in comp.lang.python for "protect source code" will provide lots of answers, some as purely technical as you desire.

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-21 Thread Giovanni Bajo
On 21/03/2007 6.49, Carl Douglas wrote: > Hi John, > > In my case, all I needed was a PyFile_AsFile to get the File *. > However I found that Python errors going to stdout/stderr were not > being redirected properly when my code was linking to a different > version of the CRT than the build of Py

Re: Printing __doc__

2007-03-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, gtb <[EMAIL PROTECTED]> wrote: >On Mar 21, 3:35 pm, Peter Otten <[EMAIL PROTECTED]> wrote: . . . >> >>> import sys >> >>> def docstring(): >> >> ... return sys._getframe(1).f_code.co_consts[0

RE: Python COM Outlook Question

2007-03-21 Thread Patrick Vrijlandt
Hi, It seems that space.Folders["DailyGoodEmails"] might be a valid expression; otherwise you might have experiment with space.GetSharedDefaultFolder() HTH, Patrick -Oorspronkelijk bericht- On Mar 21, 2:15 pm, "liam_herron" <[EMAIL PROTECTED]> wrote: > Say I want to open a shared email

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: >On Mar 21, 8:20 pm, [EMAIL PROTECTED] (John J. Lee) wrote: >> "Paddy" <[EMAIL PROTECTED]> writes: >> > I just had a link to Tim peters first post on doctest: >> >http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 >>

[JOB] Sr. Python Developer, Northern VA

2007-03-21 Thread Steven D. Arnold
Neosynapse is seeking a senior software developer located in or willing to relocate to the Northern VA area to join a project building one of the largest grid computing data platforms in the world. Skill and experience required for this engagement include: * at least 7 years experience in p

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Marcin Ciura
Steven D'Aprano wrote: x, y, z = 1, 2, 3 x = y = z x, y, z > > (3, 3, 3) > > I certainly wouldn't expect to get (2, 3, 3). Neither would I. I must have expressed myself not clearly enough. Currently x = y = z is roughly equivalent to x = z y = z I propose to change it to y = z x = z

Re: Garbage collection

2007-03-21 Thread Aahz
In article <[EMAIL PROTECTED]>, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> Or you could just have an "object leak" somewhere. Do you have any >> complicated circular references that the garbage collector can't resolve? >> Lists-of-lists? Trees?

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 22:53:55 +0100, Marcin Ciura wrote: > Given >class Node(object): >pass > >node = Node() >nextnode = Node() > > I tried to refactor the following piece of code >node.next = nextnode >node = nextnode > > as >node = node.next = nextnode > > only

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Ben Finney
Marcin Ciura <[EMAIL PROTECTED]> writes: >node = node.next = nextnode > > only to discover that Python performs chained assignments > backwards compared to other languages, i.e. left-to-right > instead of right-to-left. What makes you think so? >>> a = "foo" >>> b = "bar" >>> c =

Re: When is List Comprehension inappropriate?

2007-03-21 Thread John J. Lee
Steve Holden <[EMAIL PROTECTED]> writes: > Alex Martelli wrote: > > BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > >... > >> even2 = [(pos, col) for pos, col in iterimage(im, width, height, 2)] > > list(iterimage(etc etc)) > > is surely a better way to express identical semantics. More > > gene

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Ben Finney
"Steven D'Aprano" <[EMAIL PROTECTED]> writes: > Is your program valuable? Is it worth money? Then the 90% of script > kiddies will just wait three days, and download the program off the > Internet after the real hackers have broken your protection. The real hackers wouldn't be doing that. The cr

Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Marcin Ciura
Given class Node(object): pass node = Node() nextnode = Node() I tried to refactor the following piece of code node.next = nextnode node = nextnode as node = node.next = nextnode only to discover that Python performs chained assignments backwards compared to other langu

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Sander Steffann
Hi, Op 21-mrt-2007, om 20:41 heeft [EMAIL PROTECTED] het volgende geschreven: > On Mar 21, 11:07 am, Jon Ribbens <[EMAIL PROTECTED]> wrote: >> In article <[EMAIL PROTECTED]>, Stargaming wrote: >>> from sys import version_info >>> if version_info[0] < 2 or version_info[1] < 4: >>> raise Run

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Bruno Desthuilliers
flit a écrit : > First I wanna thanks the all people who gives good contribution to > this thread, thank you all.. > Now I have something more to say: > > OK, that kind of answer is what I was trying to avoid.. > (snip half-angry answers to Steven) Flit, whether you like the way Steven expresses

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Bruno Desthuilliers
gtb a écrit : > On Mar 21, 8:36 am, "flit" <[EMAIL PROTECTED]> wrote: > (snip) >>2 - If I put the code in web like a web service, how can I protect my >>code from being ripped? There is a way to avoid someone using my site >>and ripping the .py files? >> >>Thanks and sorry for the introduction >

Re: Printing __doc__

2007-03-21 Thread gtb
On Mar 21, 3:35 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > gtb wrote: > > In a function I can use the statement n = > > sys._getframe().f_code.co_name to get the name of the current > > function. Given that I can get the name how can I print the __doc__ > > string? I cant use the following, it wi

Re: why brackets & commas in func calls can't be ommited? (maybe it couldbe PEP?)

2007-03-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I have nothing against brackets, and I think Python has used them for > too much time to allow a so big change in its syntax. > But I think in some situations Ruby allows to omit them, Yes. But in Ruby, there's a clear distinction between attributes and methods, and

Re: parsing combination strings

2007-03-21 Thread bearophileHUGS
Bruno Desthuilliers: > exp = re.compile(r'^([0-9]+)') > for s in ["12ABA", "1ACD", "123CSD"]: > print exp.match(line).group(0) This may be enough too: exp = re.compile(r'\d+') for s in ["12ABA", "1ACD", "123CSD"]: print exp.match(line).group(0) With it: exp.match("a123CSD") = None Bye,

Re: Make variable global

2007-03-21 Thread Steve Holden
abcd wrote: > I have a file, "a.py" > > blah = None > def go(): > global blah > blah = 5 > >>From the python interpreter I try > from a import * blah go() blah > > ...i was hoping to see "5" get printed out the second time I displayed > blah, but it doesn't.

Re: Make variable global

2007-03-21 Thread aspineux
try >>> import a >>> a.blah >>> a.go() >>> a.blah or rewrite a.py like this blah = [ None ] def go(): global blah blah[0] = 5 # and not blah=[5] then >>> from a import * >>> blah >>> go() >>> blah will work as expected in case 1 ( import a ) blah in a.py and a.blah in python interpr

Re: parsing combination strings

2007-03-21 Thread Bruno Desthuilliers
PKKR a écrit : > On Mar 21, 2:51 pm, "Steven D. Arnold" <[EMAIL PROTECTED]> wrote: > >>On Mar 21, 2007, at 2:42 PM, PKKR wrote: >> >> >>>I need a fast and efficient way to parse a combination string(digits + >>>chars) >> >>>ex: s = "12ABA" or "1ACD" or "123CSD" etc >> >>>I want to parse the the ab

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Paul Rubin
"Paddy" <[EMAIL PROTECTED]> writes: > I just had a link to Tim peters first post on doctest: > http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 > removed from http://en.wikipedia.org/wiki/Doctest as it doesn't fit > their guidelines for external links. Just sit tight for a whil

Re: Printing __doc__

2007-03-21 Thread gtb
On Mar 21, 3:11 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "gtb" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | Greetings, > | > | Don't know the daily limit for dumb questions so I will ask one or > | more. > | > | In a function I can use the statement n = > | sys._getfram

Re: Printing __doc__

2007-03-21 Thread Peter Otten
gtb wrote: > In a function I can use the statement n = > sys._getframe().f_code.co_name to get the name of the current > function. Given that I can get the name how can I print the __doc__ > string? I cant use the following, it will tell me to bugger off as the > string has no such attribute. > >

Re: Make variable global

2007-03-21 Thread Bruno Desthuilliers
abcd a écrit : > I have a file, "a.py" > > blah = None > def go(): > global blah > blah = 5 > >>From the python interpreter I try > > from a import * blah go() blah > > > ...i was hoping to see "5" get printed out the second time I displayed > blah, but it doe

Re: Make variable global

2007-03-21 Thread Gary Herron
abcd wrote: > I have a file, "a.py" > > blah = None > def go(): > global blah > blah = 5 > > >From the python interpreter I try > > from a import * blah go() blah > > ...i was hoping to see "5" get printed out the second time I displayed > blah,

Re: Make variable global

2007-03-21 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 abcd wrote: > I have a file, "a.py" > > blah = None def go(): global blah blah = 5 > >> From the python interpreter I try > from a import * blah go() blah > > ...i was hoping to see "5" get printed out the second time I > displayed blah,

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Paddy
On Mar 21, 8:20 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > I just had a link to Tim peters first post on doctest: > >http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 > > removed fromhttp://en.wikipedia.org/wiki/Doctestas it doesn't fit >

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread John J. Lee
"Paddy" <[EMAIL PROTECTED]> writes: > I just had a link to Tim peters first post on doctest: > http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 > removed from http://en.wikipedia.org/wiki/Doctest as it doesn't fit > their guidelines for external links. > I wonder, could maybe t

Re: Python COM Outlook Question

2007-03-21 Thread kyosohma
On Mar 21, 2:15 pm, "liam_herron" <[EMAIL PROTECTED]> wrote: > Say I want to open a shared email inbox (named "DailyGoodEmails") that > is different from my default Outlook inbox, how do I specify this? > > Currently, I would do: > > s = Dispatch("Outlook.Application") > space = s.GetNameSpace("MAP

Re: Printing __doc__

2007-03-21 Thread Terry Reedy
"gtb" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Greetings, | | Don't know the daily limit for dumb questions so I will ask one or | more. | | In a function I can use the statement n = | sys._getframe().f_code.co_name to get the name of the current | function. Given that I can

Re: Printing __doc__

2007-03-21 Thread Josh Bloom
This will work, but I'm getting out of my depth as to whether its a good idea to do or not. import sys def testFunc(): ''' Here is my doc string''' n = sys._getframe().f_code.co_name print eval(n).__doc__ testFunc() The issue being that n is a simply a string containing the name of th

Re: Mastering Python

2007-03-21 Thread Bruno Desthuilliers
Paul McGuire a écrit : (snip) > - Don't forget the ()'s. To invoke a method on an object, you must > include the parens. This wont do anything: > a = "some string" > a = a.lower It will actually do something: rebind name 'a' to the method lower() of the string previously binded to 'a' (sni

Re: Delete a function

2007-03-21 Thread gtb
On Mar 21, 12:45 pm, paul <[EMAIL PROTECTED]> wrote: > gtb schrieb:> On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: > >> gtb wrote: > >>> After a function has been imported to a shell how may it be deleted so > >>> that after editing it can reloaded anew? > >> Use the built-in reload(

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Carsten Haese
On Wed, 2007-03-21 at 11:33 -0700, gtb wrote: > On Mar 21, 8:36 am, "flit" <[EMAIL PROTECTED]> wrote: > > 2 - If I put the code in web like a web service, how can I protect my > > code from being ripped? There is a way to avoid someone using my site > > and ripping the .py files? > > Maybe an appli

Re: Wikipedia and a little piece of Python History

2007-03-21 Thread Sebastian Bassi
On 21 Mar 2007 12:18:50 -0700, Paddy <[EMAIL PROTECTED]> wrote: > I just had a link to Tim peters first post on doctest: > http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 AFAIK, Google doesn't offer a permalink to usenet/group post (since a mayor "upgrade" they made some

Make variable global

2007-03-21 Thread abcd
I have a file, "a.py" blah = None def go(): global blah blah = 5 >From the python interpreter I try >>> from a import * >>> blah >>> go() >>> blah >>> ...i was hoping to see "5" get printed out the second time I displayed blah, but it doesn't. Now, if I type this same code directly

Printing __doc__

2007-03-21 Thread gtb
Greetings, Don't know the daily limit for dumb questions so I will ask one or more. In a function I can use the statement n = sys._getframe().f_code.co_name to get the name of the current function. Given that I can get the name how can I print the __doc__ string? I cant use the following, it will

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread starGaming
On Mar 21, 11:07 am, Jon Ribbens <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, Stargaming wrote: > > from sys import version_info > > if version_info[0] < 2 or version_info[1] < 4: > > raise RuntimeError("You need at least python2.4 to run this script") > > That'll fail when the

Re: writing dictionaries to a file

2007-03-21 Thread Josh Bloom
Where have you defined the relationship between the 2 dictionaries? If you know that all the someys are related to the somex you can do something like this: somex = {'unit':'00', 'type':'processing'} somey1 = {'comment':'fair', 'code':'aaa'} somey2 = {'comment':'fair', 'code':'bbb'} somey3 = {'

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Erik Max Francis
Diez B. Roggisch wrote: > dmitrey wrote: > >> I looked to the PEPs & didn't find a proposition to remove brackets & >> commas for to make Python func call syntax caml- or tcl- like: instead >> of >> result = myfun(param1, myfun2(param5, param8), param3) >> just make possible using >> result = my

Re: Garbage collection

2007-03-21 Thread Nick Craig-Wood
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Or you could just have an "object leak" somewhere. Do you have any > complicated circular references that the garbage collector can't resolve? > Lists-of-lists? Trees? Anything where objects aren't being freed when you > think they are? Are you holdi

Re: python QT or python-GTK

2007-03-21 Thread Joshua J. Kugler
Dennis Lee Bieber wrote: > On Sun, 18 Mar 2007 11:55:47 -1000, "Jon Van DeVries" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> ** All the posts found in google are old. I'm assuming new improvements >> have been made to both IDEs. ** >> >> Please correct me if I'm wron

Wikipedia and a little piece of Python History

2007-03-21 Thread Paddy
I just had a link to Tim peters first post on doctest: http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 removed from http://en.wikipedia.org/wiki/Doctest as it doesn't fit their guidelines for external links. I wonder, could maybe the official website be persuaded to host a copy

Re: parsing combination strings

2007-03-21 Thread PKKR
On Mar 21, 2:51 pm, "Steven D. Arnold" <[EMAIL PROTECTED]> wrote: > On Mar 21, 2007, at 2:42 PM, PKKR wrote: > > > I need a fast and efficient way to parse a combination string(digits + > > chars) > > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > > I want to parse the the above string such that i

Python COM Outlook Question

2007-03-21 Thread liam_herron
Say I want to open a shared email inbox (named "DailyGoodEmails") that is different from my default Outlook inbox, how do I specify this? Currently, I would do: s = Dispatch("Outlook.Application") space = s.GetNameSpace("MAPI") inbox = space.GetDefaultFolder(6) myFolder = inbox.Folders[9] #open

Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-21 Thread Lew
Dr. Who wrote: > Don't Feed The Trolls :-) But, but - you fed me!? Oh, wait, I'm only a half-troll, on my father's side. Thanks for the attention. Kidding aside, a post like the OP's is useful as an exercise in finding the errors, grammatical and factual. It's like a math book I had in my firs

Re: parsing combination strings

2007-03-21 Thread PKKR
ah ok, i guess something like this should do it for me then? re.split('[^0-9]', str)[0] -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing combination strings

2007-03-21 Thread kyosohma
On Mar 21, 1:42 pm, "PKKR" <[EMAIL PROTECTED]> wrote: > I need a fast and efficient way to parse a combination string(digits + > chars) > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > I want to parse the the above string such that i can grab only the > first digits and ignore the rest of the chac

Re: parsing combination strings

2007-03-21 Thread Steven D. Arnold
On Mar 21, 2007, at 2:42 PM, PKKR wrote: > I need a fast and efficient way to parse a combination string(digits + > chars) > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > I want to parse the the above string such that i can grab only the > first digits and ignore the rest of the chacters, A rege

Re: parsing combination strings

2007-03-21 Thread Tommy Nordgren
On 21 mar 2007, at 19.42, PKKR wrote: > I need a fast and efficient way to parse a combination string(digits + > chars) > > ex: s = "12ABA" or "1ACD" or "123CSD" etc > > I want to parse the the above string such that i can grab only the > first digits and ignore the rest of the chacters, > > so i

Re: How to copy a ClassObject?

2007-03-21 Thread Karlo Lozovina
Duncan Booth <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Consider yourself corrected. > > You could do what you are attempting with: > >tmp = new.classobj('tmp', First.__bases__, dict(First.__dict__)) > > which creates a new class named 'tmp' with the same base classes and > a c

Re: why brackets & commas in func calls can't be ommited? (maybe it couldbe PEP?)

2007-03-21 Thread bearophileHUGS
I have nothing against brackets, and I think Python has used them for too much time to allow a so big change in its syntax. But I think in some situations Ruby allows to omit them, solving some of the "impossibile" problems shown in this thread. This makes Ruby a bit better than Python to create ap

Re: flattening/rolling up/aggregating a large sorted text file

2007-03-21 Thread Shane Geiger
Apparently you want to use this data to know how many blue circles, blue squares, red circles and red squares. In other words, I doubt you want to output redundant data columns, you just want this data in a more usable format and that you don't actually need to do multiple passes over it. Th

parsing combination strings

2007-03-21 Thread PKKR
I need a fast and efficient way to parse a combination string(digits + chars) ex: s = "12ABA" or "1ACD" or "123CSD" etc I want to parse the the above string such that i can grab only the first digits and ignore the rest of the chacters, so if i have s = "12ABA" , parser(s) should give me "12" or

Re: why brackets & commas in func calls can't be ommited? (maybe it couldbe PEP?)

2007-03-21 Thread Terry Reedy
You asked two questions; the first others have asked also. Mathematicians sometimes use brackets to indicate function application and sometimes just juxtaposition. When they do the latter and when there are things other than functions (to exclude pure lambda calculus), then there are usually (

Re: Technical Answer - Protecting code in python

2007-03-21 Thread gtb
On Mar 21, 8:36 am, "flit" <[EMAIL PROTECTED]> wrote: > Hello All, > > I have a hard question, every time I look for this answer its get out > from the technical domain and goes on in the moral/social domain. > First, I live in third world with bad gov., bad education, bad police > and a lot of tax

Re: replace illegal xml characters

2007-03-21 Thread Irmen de Jong
killkolor wrote: >> Does InDesign export broken XML documents? What exactly is your problem? > > yes, unfortunately it does. it uses all possible unicode characters, > though not all are alowed in valid xml (see link in the first post). Are you sure about this? Could you post a small example? I

Re: parsing tables with beautiful soup?

2007-03-21 Thread cjl
This works: for row in soup.find("table",{"class": "class_name"}): for cell in row: print cell.contents[0] Is there a better way to do this? -cjl -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing Python updates

2007-03-21 Thread Steve Holden
Matthew wrote: > Hello: > > What is the methodology for testing the updates to the Python > language? http://www.pybots.org/ regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve

Re: Garbage collection

2007-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2007 17:19:23 +, Tom Wright wrote: >> So what's your actual problem that you are trying to solve? > > I have a program which reads a few thousand text files, converts each to a > list (with readlines()), creates a short summary of the contents of each (a > few floating point nu

2 Command prompt at the same time

2007-03-21 Thread Boudreau, Emile
Hello, I have two batch files and I'm trying to run them in parallel. I haven't been able to find any information on how to make python open 2 command prompt and then make each prompt run one of the batch files. Can anyone point me in the right direction? Thanks, Emile Boudreau Th

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Steven Bethard
dmitrey wrote: > I looked to the PEPs & didn't find a proposition to remove brackets & > commas for to make Python func call syntax caml- or tcl- like: instead > of > result = myfun(param1, myfun2(param5, param8), param3) > just make possible using > result = myfun param1 (myfun2 param5 param8) pa

Re: Garbage collection

2007-03-21 Thread Steve Holden
Tom Wright wrote: > Steven D'Aprano wrote: >> You've described an extremely artificial set of circumstances: you create >> 40,000,000 distinct integers, then immediately destroy them. The obvious >> solution to that "problem" of Python caching millions of integers you >> don't need is not to create

Re: Delete a function

2007-03-21 Thread paul
gtb schrieb: > On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> gtb wrote: >>> After a function has been imported to a shell how may it be deleted so >>> that after editing it can reloaded anew? >> Use the built-in reload() function to reload the module that defines the >> function.

Re: Delete a function

2007-03-21 Thread Steve Holden
gtb wrote: > On Mar 21, 11:37 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> gtb wrote: >>> After a function has been imported to a shell how may it be deleted so >>> that after editing it can reloaded anew? >> Use the built-in reload() function to reload the module that defines the >> function. >>

  1   2   >