Re: Question about weakref

2012-07-06 Thread Frank Millman
On 05/07/2012 19:47, Dieter Maurer wrote: Frank Millman writes: I would still like to know why weakref.proxy raised an exception. I have re-read the manual several times, and googled for similar problems, but am none the wiser. In fact, it is documented. Accessing a proxy will raise an excep

Re: Discussion on some Code Issues

2012-07-06 Thread Peter Otten
subhabangal...@gmail.com wrote: [Please don't top-post] >> start = 0 >> for match in re.finditer(r"\$", data): >> end = match.start() >> print(start, end) >> print(data[start:end]) >> start = match.end() > That is a nice one. I am thinking if I can write "for lines in f" sort of

Re: Apology for OT posts

2012-07-06 Thread Chris Angelico
On Fri, Jul 6, 2012 at 3:30 PM, Simon Cropper wrote: > bet this kills the conservation though... Probably. Until someone trolls the list again and sets us all going... I'm another of the worst perps, so in the words of Pooh-Bah, "I desire to associate myself with that expression of regret". It

Re: Which way is best to execute a Python script in Excel?

2012-07-06 Thread Maurizio Spadaccino
Hi Emile Thanks for the reply. Could you provide me a more detailed 'how-to' tutorial on implementing a VBA macro that calls a script or a function from python, or tell me where on the web I can find it? The OReilly chapter seems a bit hard for me at this stage? I dont know, for example, where i

Re: Apology for OT posts

2012-07-06 Thread Mark Lawrence
On 06/07/2012 08:45, Chris Angelico wrote: On Fri, Jul 6, 2012 at 3:30 PM, Simon Cropper wrote: bet this kills the conservation though... Probably. Until someone trolls the list again and sets us all going... I'm another of the worst perps, so in the words of Pooh-Bah, "I desire to associate

Re: Re: code review

2012-07-06 Thread lars van gemerden
On Sunday, July 1, 2012 5:48:40 PM UTC+2, Evan Driscoll wrote: > On 7/1/2012 4:54, Alister wrote: > > On Sat, 30 Jun 2012 23:45:25 -0500, Evan Driscoll wrote: > >> If I had seen that in a program, I'd have assumed it was a bug. > > > > You would? > > I have only been using python for 6 - 12 months

stuck in files!!

2012-07-06 Thread Chirag B
i want to kno how to link two applications using python for eg:notepad txt file and some docx file. like i wat to kno how to take path of those to files and run them simultaneously.like if i type something in notepad it has to come in wordpad whenever i run that code. -- http://mail.python.org/mai

RE: tkFileDialogs

2012-07-06 Thread brandon harris
It doesn't matter whether I pass the actual path in or the global variable name. The result is the same. Brandon L. Harris From: Karim [kliat...@gmail.com] Sent: Friday, July 06, 2012 12:42 AM To: brandon harris Subject: Re: tkFileDialogs Le 06/07/2012

Re: Which way is best to execute a Python script in Excel?

2012-07-06 Thread Emile van Sebille
On 7/6/2012 1:31 AM Maurizio Spadaccino said... Could you provide me a more detailed 'how-to' tutorial on implementing a VBA macro that calls a script or a function from python, or tell me where on the web I can find it? The OReilly chapter seems a bit hard for me at this stage? I'm not goin

Re: Creating an instance when the argument is already an instance.

2012-07-06 Thread Olive
On 05 Jul 2012 11:55:33 GMT Steven D'Aprano wrote: > On Thu, 05 Jul 2012 12:29:24 +0200, Olive wrote: > > > I am learning python -:) > > > > I am creating a new class: package (to analyse the packages > > database in some linux distros). I have created a class package > > such that package("str

Re: stuck in files!!

2012-07-06 Thread Thomas Jollans
On 07/06/2012 01:53 PM, Chirag B wrote: > i want to kno how to link two applications using python for eg:notepad > txt file and some docx file. like i wat to kno how to take path of > those to files and run them simultaneously.like if i type something in > notepad it has to come in wordpad whenever

Re: OAuth 2.0 implementation

2012-07-06 Thread Demian Brecht
Supported provider list (with example code) is now: * Facebook * Google * Foursquare * bitly * GitHub * StackExchange * Instagram Other providers may also be supported out of the box, but have been untested thus far. -- http://mail.python.org/mailman/listinfo/python-list

Re: tkFileDialogs

2012-07-06 Thread Rick Johnson
On Jul 6, 12:22 am, brandon harris wrote: > [...] > import tkFileDialog > # Won't start in or allow navigation to APPDATA > test = tkFileDialog.askdirectory(initialdir='%APPDATA%') > # Will start in and navigate to APPDATA > test = tkFileDialog.askopenfile(initialdir='%APPDATA%') Don't you just l

Re: Confusing datetime.datetime

2012-07-06 Thread Hans Mulder
On 6/07/12 00:55:48, Damjan wrote: > On 05.07.2012 16:10, Damjan wrote: >> I've been struggling with an app that uses >> Postgresql/Psycopg2/SQLAlchemy and I've come to this confusing >> behaviour of datetime.datetime. > > > Also this: > > #! /usr/bin/python2 > # retardations in python's dateti

Re: simpler increment of time values?

2012-07-06 Thread Rick Johnson
On Jul 5, 12:16 pm, Chris Angelico wrote: > > So it's even easier than I said. And bonus lesson for the day: Try > things in the interactive interpreter before you post. :) but first: be sure to familiarize yourself with the many built-in "python classes"(sic). Re-inventing the wheel is breaking

Re: stuck in files!!

2012-07-06 Thread andrea crotti
2012/7/6 Chirag B : > i want to kno how to link two applications using python for eg:notepad > txt file and some docx file. like i wat to kno how to take path of > those to files and run them simultaneously.like if i type something in > notepad it has to come in wordpad whenever i run that code. >

Issues with `codecs.register` and `codecs.CodecInfo` objects

2012-07-06 Thread Karl Knechtel
Hello all, While attempting to make a wrapper for opening multiple types of UTF-encoded files (more on that later, in a separate post, I guess), I ran into some oddities with the `codecs` module, specifically to do with `.register` ing `CodecInfo` objects. I'd like to report a bug or something, bu

Re: Question about weakref

2012-07-06 Thread Ian Kelly
On Fri, Jul 6, 2012 at 1:00 AM, Frank Millman wrote: > I have investigated a bit further, and now I have a clue as to what is > happening, though not a full understanding. > > If you use 'b = weakref.ref(obj)', 'b' refers to the weak reference, and > 'b()' refers to the referenced object. > > If y

Re: Question about weakref

2012-07-06 Thread Ian Kelly
On Fri, Jul 6, 2012 at 11:04 AM, Ian Kelly wrote: > On that, I'm really not sure. I tried to reproduce the problem > locally and wasn't able to. What build of Python are you using, and > on what platform? I spoke too soon, I am able to reproduce it. I think what's going on here is that when yo

Re: Question about weakref

2012-07-06 Thread Ian Kelly
On Fri, Jul 6, 2012 at 11:48 AM, Ian Kelly wrote: > def del_b(self, b): > for i, x in enumerate(self.array): > if b is x: > del self.array[i] That should probably have an explicit break on the end: def del_b(self, b): for i, x in enumerate(self

Re: Question about weakref

2012-07-06 Thread Ethan Furman
Ian Kelly wrote: def del_b(self, b): for i, x in enumerate(self.array): if b is x: del self.array[i] break Nice work, Ian. -- http://mail.python.org/mailman/listinfo/python-list

Re: stuck in files!!

2012-07-06 Thread Alex
Chirag B wrote: > i want to kno how to link two applications using python for eg:notepad > txt file and some docx file. like i wat to kno how to take path of > those to files and run them simultaneously.like if i type something in > notepad it has to come in wordpad whenever i run that code. Text

Re: OAuth 2.0 implementation

2012-07-06 Thread Alec Taylor
On Sat, Jul 7, 2012 at 1:38 AM, Demian Brecht wrote: > Supported provider list (with example code) is now: > * Facebook > * Google > * Foursquare > * bitly > * GitHub > * StackExchange > * Instagram > > Other providers may also be supported out of the box, but have been untested > thus far. Look

RE: OAuth 2.0 implementation

2012-07-06 Thread Demian Brecht
No worries, thanks for the request. Unfortunately AFAIK (according to the OAuth provider list on Wikipedia), both Twitter and LinkedIn still use OAuth 1.0a, so until they hop on the OAuth 2.0 bandwagon, they won't be added. -Original Message- From: Alec Taylor [mailto:alec.tayl...@gmail.c

Re: OAuth 2.0 implementation

2012-07-06 Thread Alec Taylor
Yeah, seems Twitter is still stuck on 1.0a... But LinkedIn seems to support 1.0a for REST and 2 for JS: https://developer.linkedin.com/apis So that could be a definite contender for Sanction support On Sat, Jul 7, 2012 at 4:49 AM, Demian Brecht wrote: > No worries, thanks for the request. > > U

Re: Which way is best to execute a Python script in Excel?

2012-07-06 Thread Colin J. Williams
On 06/07/2012 1:09 AM, Terry Reedy wrote: On 7/5/2012 10:30 PM, Karim wrote: An excellent link to derived all code example to python: http://www.pitonyak.org/AndrewMacro.sxw. Even though he only writes in OOBasic, you are right that he explains the basic concepts needed for accessing the api

API design question for dbf.py

2012-07-06 Thread Ethan Furman
I'm looking for some free advice. ;) My dbf module has three basic containers, all of which support list-like access: Table, List, and Index, each of which is filled with _DbfRecords. The fun part is that a _DbfRecord can compare equal to another _DbfRecord, a _DbfRecordTemplate, a tuple wi

PyEval_SetProfile usage ?

2012-07-06 Thread Salman Malik
Hi All, I have used the Python's C-API to call some Python code in my c code and now I want to know how much time does my Python part of the program takes. I came across the PyEval_SetProfile API and am not sure how to use it. Do I need to write my own profiling function? Any pointer to exam

Re: simpler increment of time values?

2012-07-06 Thread Vlastimil Brom
Thanks to all for further comments! Just for completeness and in case somebody would like to provide some suggestions or corrections; the following trivial class should be able to deal with the initial requirement of adding or subtracting dateless time values (hour:minute). regards, vbr # # # #

Re: stuck in files!!

2012-07-06 Thread Chris Angelico
On Sat, Jul 7, 2012 at 4:21 AM, Alex wrote: > Chirag B wrote: > >> i want to kno how to link two applications using python for eg:notepad >> txt file and some docx file. like i wat to kno how to take path of >> those to files and run them simultaneously.like if i type something in >> notepad it ha

Re: API design question for dbf.py

2012-07-06 Thread MRAB
On 06/07/2012 22:34, Ethan Furman wrote: I'm looking for some free advice. ;) My dbf module has three basic containers, all of which support list-like access: Table, List, and Index, each of which is filled with _DbfRecords. The fun part is that a _DbfRecord can compare equal to another _DbfR

How to print a number as if in the python interpreter?

2012-07-06 Thread Peng Yu
Hi, In [2]: sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) Out[2]: 0. In ipython, I got the above output. But I got a different output from "print". Is there a way to print exact what I saw in ipython? ~/linux/test/python/man/library/math/fsum$ cat main.py #!/usr/bin/env python pr

Re: API design question for dbf.py

2012-07-06 Thread Ethan Furman
MRAB wrote: On 06/07/2012 22:34, Ethan Furman wrote: I'm looking for some free advice. ;) My dbf module has three basic containers, all of which support list-like access: Table, List, and Index, each of which is filled with _DbfRecords. The fun part is that a _DbfRecord can compare equal t

Re: How to print a number as if in the python interpreter?

2012-07-06 Thread Chris Rebert
On Fri, Jul 6, 2012 at 3:38 PM, Peng Yu wrote: > Hi, > > In [2]: sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) > Out[2]: 0. > > In ipython, I got the above output. But I got a different output from > "print". Is there a way to print exact what I saw in ipython? > > ~/linux/test/pyt

Re: API design question for dbf.py

2012-07-06 Thread Devin Jeanpierre
On Fri, Jul 6, 2012 at 6:46 PM, Ethan Furman wrote: > It's checking for equality, not identity. >>> x = float('nan') >>> x in [x] True It's checking for equality OR identity. -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: API design question for dbf.py

2012-07-06 Thread Ethan Furman
Devin Jeanpierre wrote: On Fri, Jul 6, 2012 at 6:46 PM, Ethan Furman wrote: It's checking for equality, not identity. >>> x = float('nan') >>> x in [x] True It's checking for equality OR identity. Good point. In my case, checking for equality will cover both cases. ~Ethan~ -- http:

Re: Issues with `codecs.register` and `codecs.CodecInfo` objects

2012-07-06 Thread Steven D'Aprano
On Fri, 06 Jul 2012 12:55:31 -0400, Karl Knechtel wrote: > Hello all, > > While attempting to make a wrapper for opening multiple types of > UTF-encoded files (more on that later, in a separate post, I guess), I > ran into some oddities with the `codecs` module, specifically to do with > `.regist

What’s the differences between these two pieces of code ?

2012-07-06 Thread iMath
What’s the differences between these two pieces of code ? (1) for i in range(1, 7): print(2 * i, end=' ') (2) for i in range(1, 7): print(2 * i, end=' ') print() when executed both respectively in Python shell ,I get the same effect . Who can tell me why ? -- http://mail.python.o

Re: Question about weakref

2012-07-06 Thread Frank Millman
On 06/07/2012 20:12, Ethan Furman wrote: Ian Kelly wrote: def del_b(self, b): for i, x in enumerate(self.array): if b is x: del self.array[i] break Nice work, Ian. I second that. Thanks very much, Ian. Frank -- http://mail.python.org/mailman/listinfo/python-list

git_revision issues with scipy/numpy/matplotlib

2012-07-06 Thread Stephen Webb
I installed py27-numpy / scipy / matplotlib using macports, and it ran without failing. When I run Python I get the following error: $>> which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python $>> python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (

Re: What’s the differences between these two pieces of code ?

2012-07-06 Thread Gary Herron
On 07/06/2012 09:56 PM, iMath wrote: What’s the differences between these two pieces of code ? (1) for i in range(1, 7): print(2 * i, end=' ') (2) for i in range(1, 7): print(2 * i, end=' ') print() when executed both respectively in Python shell ,I get the same effect . Who can