Re: problem with Sorting from Array

2011-02-02 Thread Chris Rebert
On Wed, Feb 2, 2011 at 10:30 PM, shanti bhushan wrote: > Dear All, > > funtion "textPosValue " will give me key ,type and pos values from the > arrays. > This an embedded application code . > I want to execute some thing when key ==0 && type ==0 please let me >                if (key ==0 && type

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Steven D'Aprano
On Wed, 02 Feb 2011 20:01:11 -0800, alex23 wrote: > rantingrick wrote: >> No they are trolls and they have demonstrated trollish behavior on many >> occasions. Some have even threatened to kill me. Can you believe that? > > No. Link or it did not happen. Ha ha ha ha, did RR actually say that??

Re: os.path.join doubt

2011-02-02 Thread Steven D'Aprano
On Wed, 02 Feb 2011 20:46:12 -0800, harryos wrote: > In windows ,I tried this > > p1 = "C:\Users\me\Documents" > p2 = "..\Pictures\images\my.jpg" > > print os.path.join(p1,p2) > This gives > 'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' > > I expected I would get > 'C:\\Users\\me\\Pi

problem with Sorting from Array

2011-02-02 Thread shanti bhushan
Dear All, funtion "textPosValue " will give me key ,type and pos values from the arrays. This an embedded application code . I want to execute some thing when key ==0 && type ==0 please let me know where to put such code i am getting confused with it def textPosValue(data): str_arr1=[" 0",".

Re: os.path.join doubt

2011-02-02 Thread Chris Rebert
On Wed, Feb 2, 2011 at 8:46 PM, harryos wrote: > In windows ,I tried this > > p1 = "C:\Users\me\Documents" > p2 = "..\Pictures\images\my.jpg" > > print os.path.join(p1,p2) > This gives > 'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' > > I expected I would get > 'C:\\Users\\me\\Pictures\

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Jason Swails
On Wed, Feb 2, 2011 at 11:44 PM, Mel wrote: > alex23 wrote: > > >> Why is it necessarily for you guys to advertise when you plonk. Just > >> plonk and shut up about it. Nobody cares what you do with your own > >> incoming email. Really, are you that self centered as to think we > >> actually care

os.path.join doubt

2011-02-02 Thread harryos
In windows ,I tried this p1 = "C:\Users\me\Documents" p2 = "..\Pictures\images\my.jpg" print os.path.join(p1,p2) This gives 'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' I expected I would get 'C:\\Users\\me\\Pictures\\images\\my.jpg' I thought os.path.join would join the paths more

Re: How can I tell if I am inside a context manager?

2011-02-02 Thread alex23
On Feb 2, 1:28 am, Gerald Britton wrote: > I'd like to know how (perhaps with the inspect module) I can tell if I > am running in a context manager. Actually, it occurs to me the simplest way is to use the context manager itself to keep track: class F(object): def __init__(self): sel

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Mel
alex23 wrote: >> Why is it necessarily for you guys to advertise when you plonk. Just >> plonk and shut up about it. Nobody cares what you do with your own >> incoming email. Really, are you that self centered as to think we >> actually care? > > Citation: http://goo.gl/LlBFj Actually, FWIW, not

Re: How can I tell if I am inside a context manager?

2011-02-02 Thread alex23
Gerald Britton wrote: > >>> x = f() > >>> hasattr(x, '__enter__') > True > >>> with f() as x: >         hasattr(x,'__enter__') > True > > As you can see, the object has a '__enter__' method regardless of how > it was created.  Whatever the test, it needs to return False in the > first case and Tru

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread alex23
rantingrick wrote: > That is all you have brought to this conversion so far. You have not > offered solutions for IDLE, heck you don't even inject an opinion of > IDLE. You just spew bile. Have fun with your new playmates. > > py> flamer_group.append(troll_group.pop("Corey Richardson")) Ah, the h

Re: wxPython's "Print" Help

2011-02-02 Thread Akand Islam
On Feb 2, 3:24 pm, Terry Reedy wrote: > On 2/2/2011 12:36 AM, Akand Islam wrote: > > wxPython has its own mailing list. > > If you prefer newsgroups, like I do, connect to news.gmane.org and > subscribe to comp.lang.python.wxpython. > -- > Terry Jan Reedy Thanks for your response. -- Akand -- h

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread alex23
rantingrick wrote: > Hmm, that coming from someone who has two posts in this group. And the > last he posted was a year ago! Wait, I thought you had the approval of the silent majority? So once anyone actually posts, they lost the right to be counted, because only when they shut up can you consi

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread alex23
rantingrick wrote: >Well your statment completely ignores the silent majority. There's a term for people who believe they act with the tacit approval of the majority: megalomania. It's also known as narcissistic personality disorder. > No they are trolls and they have demonstrated trollish beha

looking for new members to join grid of storage nodes using tahoe-lafs which is implemented in python.

2011-02-02 Thread Billy Earney
Would you like to be able to back up ~1 TB of data to secure, highly-reliable, off-site storage, for free? By "highly-reliable" I mean that your data should survive pretty much anything short of the collapse of civilization. By "free" I mean "no monetary cost, although you have to provide some har

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Steven D'Aprano
On Wed, 02 Feb 2011 11:00:11 -0500, Gary Chambers wrote: > Finally, the problem I encountered in the Python code was having the > script fail when it encountered a line that didn't match either of the > two regular expressions. What I'm seeking is either some Python code > that mimics what my Perl

Re: PyQT: QWebView with custom QNetworkAccessManager

2011-02-02 Thread David Boddie
On Wednesday 02 February 2011 00:31, Gelonida wrote: > I would like to subclass QNetworkAccessManager and > create a subclass of QWebView, that will use the subclassed > QNetworkAccessManager for all accesses. > > Is this possible? > I have really no idea when and how I could achieve this. > > T

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Jason Swails
On Wed, Feb 2, 2011 at 4:45 PM, rantingrick wrote: > On Feb 2, 2:41 pm, Corey Richardson wrote: > > > I don't recall ever doing anything but injecting my honest opinion. If > > my opinion may be flawed (or appears to be flawed, I usually don't > > elaborate on my ideas enough), so be it. > > Yes

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Grant Edwards
On 2011-01-31, rantingrick wrote: > IDLE: A cornicopia of mediocrity and obfuscation. > -- by Rick Johnson RR's postings are generally tossed out by my score file, but after seeing so many replies, my morbid curiousity finally got the best of me, and I read (well, mostly) RR's posting on what's

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Ben Finney
Gary Chambers writes: > If you can't make heads or tails of the Perl code, all I'm trying to > do is loop through some dig output of a DNS zone transfer. The request to see your Python code was partly because Perl is foreign here, yes. But another, more significant reason is: we want to see *yo

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Carl Banks
On Feb 2, 8:00 am, Gary Chambers wrote: > All, > > > Insight will be easier to provide once we see your Python code. > > Thanks to all of you who replied to my original request for assistance.  All > points are valid and well-taken. > > I'm afraid that I can no longer locate the original Python co

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread rantingrick
On Feb 2, 2:41 pm, Corey Richardson wrote: > I don't recall ever doing anything but injecting my honest opinion. If > my opinion may be flawed (or appears to be flawed, I usually don't > elaborate on my ideas enough), so be it. Yes you are correct. When i added you to the troll list that was by

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Robert
On 2011-02-02 16:11:26 -0500, Terry Reedy said: On 2/1/2011 7:46 PM, Corey Richardson wrote: On 02/01/2011 07:42 PM, Robert wrote: On 2011-02-01 10:54:26 -0500, Terry Reedy said: Perhaps, after the repository moves from svn to hg, some 'we' will. If he does not, I think I might. Is there

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Noah Hall
On Wed, Feb 2, 2011 at 9:25 PM, Emile van Sebille wrote: > ActivePython 2.6.1.1 (ActiveState Software Inc.) based on > Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. import sys

Re: python crash problem

2011-02-02 Thread Emile van Sebille
On 2/2/2011 11:19 AM Yelena said... This application has requested the Runtime to terminate it in an unusual way This is a MS message -- did you look in the application event viewer? Otherwise, you could try upping/reducing memory and confirm it dies later/earlier. Perhaps there's an at or

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Emile van Sebille
On 2/2/2011 1:09 PM Noah Hall said... On Wed, Feb 2, 2011 at 7:44 PM, rantingrick wrote: On Feb 1, 11:23 am, rantingrick wrote: py> troll_group.append("Red John") py> flamer_group.append(troll_group.pop("Corey Richardson")) Out of interest, what interpretor uses "py>"? I've never seen a

Re: wxPython's "Print" Help

2011-02-02 Thread Terry Reedy
On 2/2/2011 12:36 AM, Akand Islam wrote: wxPython has its own mailing list. If you prefer newsgroups, like I do, connect to news.gmane.org and subscribe to comp.lang.python.wxpython. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: python crash problem

2011-02-02 Thread Terry Reedy
On 2/2/2011 2:19 PM, Yelena wrote: I've been using python Which version? > to run some large database recently. I used dbfpy module to access some information stored in dbf format. When having a problem with a 3rd party module, not part of the stdlib, you should give a source. http://so

Re: python question

2011-02-02 Thread Benjamin Kaplan
On Wed, Feb 2, 2011 at 4:08 PM, Robin wrote: > > how do you acccess a hash element in python 3? It completely changed > from version 2 and earlier, I think. > What do you mean by accessing a hash element? Do you mean the hash of an object? Because that's stayed the same: hash(obj). Do you mean ac

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Terry Reedy
On 2/1/2011 7:46 PM, Corey Richardson wrote: On 02/01/2011 07:42 PM, Robert wrote: On 2011-02-01 10:54:26 -0500, Terry Reedy said: Perhaps, after the repository moves from svn to hg, some 'we' will. If he does not, I think I might. Is there a timeline for the move? Unclear. Many want imm

python question

2011-02-02 Thread Robin
how do you acccess a hash element in python 3? It completely changed from version 2 and earlier, I think. stop war straight up, direct or indectly, -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Noah Hall
On Wed, Feb 2, 2011 at 7:44 PM, rantingrick wrote: >> On Feb 1, 11:23 am, rantingrick wrote: >> > py> troll_group.append("Red John") > py> flamer_group.append(troll_group.pop("Corey Richardson")) Out of interest, what interpretor uses "py>"? I've never seen any. Just sayin'. -- http://mail.pyt

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Corey Richardson
On 2/2/2011 2:44 PM, rantingrick wrote: [snip] py> flamer_group.append(troll_group.pop("Corey Richardson")) Your moving up Corey. Keep up the good work! I don't recall ever doing anything but injecting my honest opinion. If my opinion may be flawed (or appears to be flawed, I usually don't

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Marc Aymerich
On Feb 2, 5:58 pm, Michele Simionato wrote: > Notice that Peter's approach also works without inheritance: > > registries = {} > > @property > def per_class(self): >    cls = type(self) >    try: >       return registries[cls] >    except KeyError: >       result = registries[cls] = [] >       ret

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread rantingrick
On Feb 2, 12:12 pm, Red John wrote: > On Feb 1, 11:23 am, rantingrick wrote: > > > Hmm, that coming from someone who has two posts in this group. And the > > last he posted was a year ago! Alright, let me add you to the proper > > category... > > > py> troll_group.append("Red John") > > I realize

Re: python crash problem

2011-02-02 Thread Yelena
Here is the code, I edited out some private info: import sys import urllib2 import string import re import datetime from mx import DateTime from dbfpy import dbf addylist = ['add.dbf'] okset = ['P','L','I','B'] for addy in addylist: db = dbf.Dbf(addy) print (addy) count = len(db)

python crash problem

2011-02-02 Thread Yelena
I've been using python to run some large database recently. I used dbfpy module to access some information stored in dbf format. However, after 20hrs of running it gave me an error of : Runtime Error! This application has requested the Runtime to terminate it in an unusual way.Please contact the ap

Re: PyQT: QWebView with custom QNetworkAccessManager

2011-02-02 Thread Phil Thompson
On Wed, 02 Feb 2011 10:53:54 +0100, Gelonida Gmail wrote: > Hi Phil, > > On 02/02/2011 09:28 AM, Phil Thompson wrote: >> On Wed, 02 Feb 2011 02:37:06 +0100, Gelonida wrote >> >> In fact my first experiments failed horribly due to a tiny PyQt detail. >> >> I expected that, the variable new_manage

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Red John
On Feb 1, 11:23 am, rantingrick wrote: > Hmm, that coming from someone who has two posts in this group. And the > last he posted was a year ago! Alright, let me add you to the proper > category... > > py> troll_group.append("Red John") I realize that not agreeing with you is enough to be labeled

Re: Python/C API Inheritance

2011-02-02 Thread Stefan Behnel
Евгений Почитаев, 02.02.2011 18:21: May be someone do class inheritance in Python/C API, I know how create superclass/subclass. But how I can initialize superclass from subclass initializer? struct SuperClass { PyObject_HEAD; //... }; struct SubClass { PyObject_HEAD; You need t

Python/C API Inheritance

2011-02-02 Thread Евгений Почитаев
Hi to all. May be someone do class inheritance in Python/C API, I know how create superclass/subclass. But how I can initialize superclass from subclass initializer? struct SuperClass { PyObject_HEAD; //... }; struct SubClass { PyObject_HEAD; //... }; static int SubClassInit(SubC

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Michele Simionato
Notice that Peter's approach also works without inheritance: registries = {} @property def per_class(self): cls = type(self) try: return registries[cls] except KeyError: result = registries[cls] = [] return result class A(object): per_class=per_class class B(object): p

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Gary Chambers
All, Insight will be easier to provide once we see your Python code. Thanks to all of you who replied to my original request for assistance. All points are valid and well-taken. I'm afraid that I can no longer locate the original Python code where I was encountering the problem I described i

Re: Converting getCSS Count Code from java to python

2011-02-02 Thread Duncan Booth
Stefan Behnel wrote: > You are using Selenium RC here. I have no idea if there is a Python > API to it or what that API looks like. The rest is just trivial code > that you can map 1:1 to Python: > > def count_css_matches(css_locator): > java_script_code = ''' > var cs

[Announce] Python Lansing (MI) User Group first meeting Feb. 24 2011

2011-02-02 Thread Bill Felton
This is to announce the first meeting of the newly formed Python Lansing User Group in Lansing Michigan. The group has been organized on Meetup.com. The meeting will be held at Second Gear Coworking, 1134 N. Washington Lansing, MI at 6PM. Please join us on meetup and at the kick-off meeting. Loo

Re: Converting getCSS Count Code from java to python

2011-02-02 Thread Stefan Behnel
SMERSH009, 01.02.2011 05:23: Hi, I'd love some help converting this code to the python equivalent: private int getCSSCount(String aCSSLocator){ String jsScript = "var cssMatches = eval_css(\"%s\", window.document);cssMatches.length;"; return Integer.parseInt(selenium.getEval(String.for

Re: Converting getCSS Count Code from java to python

2011-02-02 Thread Jon Clements
On Feb 1, 4:23 am, SMERSH009 wrote: > Hi, I'd love some help converting this code to the python equivalent: > > private int getCSSCount(String aCSSLocator){ >     String jsScript = "var cssMatches = eval_css(\"%s\", > window.document);cssMatches.length;"; >     return Integer.parseInt(selenium.get

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Marc Aymerich
On Feb 2, 12:18 pm, Peter Otten <__pete...@web.de> wrote: > Marc Aymerich wrote: > > On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote: > >> Marc Aymerich wrote: > >> > Hi all, > >> > I want to provide an encapsulated static attribute called _registry > >> > for several classes. > > >> > I t

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Tom Boland
if you want to do dns lookups on a large number of hosts, then try looking at gnu adns, or if you don't mind each request blocking until it's complete, then see Alain's response below. I have written some scripts myself which do massively parallel dns lookups quickly using twisted. If this i

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Marc Aymerich
On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote: > Marc Aymerich wrote: > > Hi all, > > I want to provide an encapsulated static attribute called _registry > > for several classes. > > > I try to use inheritance in order to make it DRY: all classes inherit > > from a BaseClass that impleme

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Peter Otten
Marc Aymerich wrote: > On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote: >> Marc Aymerich wrote: >> > Hi all, >> > I want to provide an encapsulated static attribute called _registry >> > for several classes. >> >> > I try to use inheritance in order to make it DRY: all classes inherit >>

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Westley Martínez
What does Chopin have to do with IDLE? And can you put me on your troll group? It looks like a pretty fun bunch. On Tue, 2011-02-01 at 09:26 -0800, rantingrick wrote: > On Feb 1, 10:29 am, "Littlefield, Tyler" wrote: > > > I hope everyone will > > excuse me now, I must dash off to slit my wri

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Alain Ketterlin
Gary Chambers writes: > Given the following Perl script: [41 lines of Perl removed] Sorry, I'm lucky enough to be able to completely ignore Perl. > Will someone please provide some insight on how to accomplish that task in > Python? >From what I understood in the comments of your script, here

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Steven D'Aprano
On Tue, 01 Feb 2011 23:36:27 -0500, Gary Chambers wrote: > All, > > Given the following Perl script: [snip line noise] > Will someone please provide some insight on how to accomplish that task > in Python? No idea, I can't read Perl, and you shouldn't assume that people will be able to. Can

Re: Print docstrings to shell

2011-02-02 Thread Steven D'Aprano
On Tue, 01 Feb 2011 16:11:51 -0800, Gnarlodious wrote: > Can I run a script in bash and print out its docstrings to the bash > shell? I tried this at the end: [...] > However in the interactive shell it prints out the class structure > nicely. What I really want to see is this output in the bash w

Re: PyQT: QWebView with custom QNetworkAccessManager

2011-02-02 Thread Gelonida Gmail
Hi Phil, On 02/02/2011 09:28 AM, Phil Thompson wrote: > On Wed, 02 Feb 2011 02:37:06 +0100, Gelonida wrote > > In fact my first experiments failed horribly due to a tiny PyQt detail. > > I expected that, the variable new_manager does not have to be > persistent. >> I naively assumed, that a call

Re: Perl Hacker, Python Initiate

2011-02-02 Thread wander.lairson
2011/2/2 Gary Chambers : > All, > > Given the following Perl script: > > #!/usr/bin/perl > > %dig = ( >    solaris => "/usr/sbin/dig", >    linux   => "/usr/bin/dig", >    darwin  => "/usr/bin/dig" > ); > > $DIG = $dig{"$^O"}; > $DOMAIN = "example.com"; > $DNS = "ns.example.com"; > $DIGCMD = qq/$DI

Re: test: please ignore

2011-02-02 Thread Steven D'Aprano
On Tue, 01 Feb 2011 22:44:20 +0100, Gelonida wrote: > Somehow I can't post anymore to gmane. > > Would like to know why. I have the answer, but since you've told me to ignore this post, I can't tell you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create an entry in the "Program menu" of Windows?

2011-02-02 Thread Steven D'Aprano
On Tue, 01 Feb 2011 21:43:26 +, Diesel wrote: > Hi, > > I'd like to add menu entry in the Program Menu as part of the > installation of an application. Is it possible to do that from Python? Of course. Python is Turing complete, if any language can do it, Python can too (although not necess

Re: How to create an entry in the "Program menu" of Windows?

2011-02-02 Thread sandro
Alexander Kapps wrote: > On 01.02.2011 22:43, Diesel wrote: >> >> Hi, >> >> I'd like to add menu entry in the Program Menu as part of the >> installation of an application. Is it possible to do that from Python? >> >> Any examples or link? I have not been able to find anything with >> google... >>

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Marc Aymerich
On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote: > Marc Aymerich wrote: > > Hi all, > > I want to provide an encapsulated static attribute called _registry > > for several classes. > > > I try to use inheritance in order to make it DRY: all classes inherit > > from a BaseClass that impleme

Re: PyQT: QWebView with custom QNetworkAccessManager

2011-02-02 Thread Phil Thompson
On Wed, 02 Feb 2011 02:37:06 +0100, Gelonida wrote: > On 02/02/2011 12:31 AM, Gelonida wrote: >> Hi, >> >> I would like to subclass QNetworkAccessManager and >> create a subclass of QWebView, that will use the subclassed >> QNetworkAccessManager for all accesses. >> >> Is this possible? >> I hav