Class decorator to capture the creation and deletion of objects

2014-02-24 Thread Sangeeth Saravanaraj
This question was initially asked in tu...@python.org; Now I am widening the audience to gain attention. I want to create a decorator which should do the following things: => When an object of the decorated class is created, the objects name (say the value of the incoming "id" argument) should be

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Steven D'Aprano
On Mon, 24 Feb 2014 16:10:53 -0800, Ethan Furman wrote: > On 02/24/2014 03:55 PM, Steven D'Aprano wrote: >> Will b'%s' take any arbitrary object, as in: >> >> b'Key: %s' % [1, 2, 3, 4] >> => b'Key: [1, 2, 3, 4]' > > No. Very glad to hear it. [...] >>> Can anybody think of a use-case for this

Re: Problem with the console on the new python.org site

2014-02-24 Thread Pierre Quentel
Le lundi 24 février 2014 14:19:12 UTC+1, Jean-Michel Pichavant a écrit : > - Original Message - > > On Sun, 23 Feb 2014 10:20:15 -0800, Pierre Quentel wrote: > > > > > The new home page of python.org is very nice, congratulations ! > > > > The best I can say about it is that I'm extremely

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects

2014-02-24 Thread Chris Angelico
On Tue, Feb 25, 2014 at 4:26 PM, alex23 wrote: > On 25/02/2014 12:34 PM, Chris Angelico wrote: >> >> On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli wrote: >>> >>> At this point, all entries in the table should be deleted; query should >>> return an empty list! >> >> >> You can't actually depend o

Re: Help father help son / Install Version 2.6 on Mac OSX 10.9

2014-02-24 Thread Ned Deily
In article , Chris Angelico wrote: > On Tue, Feb 25, 2014 at 4:28 PM, wrote: > > Trying to install Python 2.6 because PyGames says it will only install if > > Python 2.6 is present. > > Are you sure you need 2.6 and not 2.7? This suggests 2.7 works: > > http://pygame.org/wiki/MacCompile A

Re: Help father help son / Install Version 2.6 on Mac OSX 10.9

2014-02-24 Thread Chris Angelico
On Tue, Feb 25, 2014 at 4:28 PM, wrote: > Trying to install Python 2.6 because PyGames says it will only install if > Python 2.6 is present. Are you sure you need 2.6 and not 2.7? This suggests 2.7 works: http://pygame.org/wiki/MacCompile ChrisA -- https://mail.python.org/mailman/listinfo/py

Help father help son / Install Version 2.6 on Mac OSX 10.9

2014-02-24 Thread quequegg
I just want to help him get the environment set up. Running Mac Maverick, OSX 10.9 Trying to install Python 2.6 because PyGames says it will only install if Python 2.6 is present. When I run make framework install I am treated to: gcc -c -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwra

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects

2014-02-24 Thread alex23
On 25/02/2014 12:34 PM, Chris Angelico wrote: On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli wrote: At this point, all entries in the table should be deleted; query should return an empty list! You can't actually depend on del resulting in __del__ being called. Mind those attributions, Chri

Re: Coding a simple state machine in python

2014-02-24 Thread alex23
On 25/02/2014 1:27 PM, Tim Daneliuk wrote: On 02/24/2014 08:55 PM, William Ray Wing wrote: On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? >> Stackoverflow has a couple of compact examples here: Now you're making it TOO easy Bill ;) No, the _easy_ so

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects

2014-02-24 Thread Jacob Alheid
— Sent from Mailbox for iPad On Mon, Feb 24, 2014 at 8:49 PM, David Lawrence wrote: > If as according to the docs, there is no guarantee of __del__ being called, > anything that relies on that seems unsafe (depending on how robust one > needs the solutions to be). Solutions I've seen elsewhere

Docs related python powerpoint automation using pywin32

2014-02-24 Thread Jaydeep Patil
Hi, Required help regarding python powerpoint automation using pywin32. provide some reference or guides? Regards Jaydeep -- https://mail.python.org/mailman/listinfo/python-list

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects

2014-02-24 Thread David Lawrence
If as according to the docs, there is no guarantee of __del__ being called, anything that relies on that seems unsafe (depending on how robust one needs the solutions to be). Solutions I've seen elsewhere suggest creating something like a *release()* method on your objects and calling it explicitl

Re: Python powerpoint automation using pywin32

2014-02-24 Thread Jaydeep Patil
On Monday, 24 February 2014 17:27:23 UTC+5:30, sffj...@gmail.com wrote: > On Monday, 24 February 2014 11:35:08 UTC, Jaydeep Patil wrote: > > > I need to create a new powerpoint presentation. I need to add images, paste > > some graphs, add texts, tables into powerpoint. > > > > > > Is any li

Re: Coding a simple state machine in python

2014-02-24 Thread Tim Daneliuk
On 02/24/2014 08:55 PM, William Ray Wing wrote: On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code: if state == "AB

Re: Coding a simple state machine in python

2014-02-24 Thread William Ray Wing
On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: > How do I write a state machine in python? I have identified the states and > the conditions. Is it possible to do simple a if-then-else sort of an > algorithm? Below is some pseudo code: > > if state == "ABC": > do_something() > change state t

Re: [Baypiggies] Class decorator to capture the creation and deletion of objects

2014-02-24 Thread Chris Angelico
On Tue, Feb 25, 2014 at 1:24 PM, Alex Martelli wrote: > del a1 > del a2 > del a3 > del b1 > del b2 > > At this point, all entries in the table should be deleted; query should > return an empty list! > You can't actually depend on del resulting in __del__ being called. The two are tangentially rel

Re: Coding a simple state machine in python

2014-02-24 Thread Tim Daneliuk
On 02/24/2014 07:30 PM, Ronaldo wrote: How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code: if state == "ABC": do_something() change state to DEF if state

Coding a simple state machine in python

2014-02-24 Thread Ronaldo
How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code: if state == "ABC": do_something() change state to DEF if state == "DEF" perform_the_next_function() ...

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Ethan Furman
On 02/24/2014 03:55 PM, Steven D'Aprano wrote: On Mon, 24 Feb 2014 11:54:54 -0800, Ethan Furman wrote: Greetings! A PEP is under discussion to add %-interpolation back to the bytes type in Python 3.5. Assuming the PEP is accepted, what *will* be added back is: Numerics: b'%d' % 10 -->

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Steven D'Aprano
On Tue, 25 Feb 2014 00:18:53 +0200, Marko Rauhamaa wrote: > random...@fastmail.us: > >> On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: >>> That is: >>> >>> 1. ineffient (encode/decode shuffle) >>> >>> 2. unnatural (strings usually have no place in protocols) >> >> That's not at all cle

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Steven D'Aprano
On Mon, 24 Feb 2014 11:54:54 -0800, Ethan Furman wrote: > Greetings! > > A PEP is under discussion to add %-interpolation back to the bytes type > in Python 3.5. > > Assuming the PEP is accepted, what *will* be added back is: > > Numerics: > >b'%d' % 10 --> b'10' >b'%02x' % 10 --> b'

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Ethan Furman
On 02/24/2014 01:04 PM, random...@fastmail.us wrote: On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: That is: 1. ineffient (encode/decode shuffle) 2. unnatural (strings usually have no place in protocols) That's not at all clear. Why _aren't_ these protocols considered text protoco

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Marko Rauhamaa
random...@fastmail.us: > On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: >> That is: >> >> 1. ineffient (encode/decode shuffle) >> >> 2. unnatural (strings usually have no place in protocols) > > That's not at all clear. Why _aren't_ these protocols considered text > protocols? Why can't

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: > That is: > > 1. ineffient (encode/decode shuffle) > > 2. unnatural (strings usually have no place in protocols) That's not at all clear. Why _aren't_ these protocols considered text protocols? Why can't you add a string directly to header

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Marko Rauhamaa
Ethan Furman : > Can anybody think of a use-case for this particular feature? Internet protocol entities constantly have to format (and parse) ASCII-esque octet strings: headers.append(b'Content-length: %d\r\n' % len(blob)) headers.append(b'Content-length: {}\r\n'.format(len(blob))) No

Re: Can global variable be passed into Python function?

2014-02-24 Thread Mark Lawrence
On 24/02/2014 18:05, j.e.ha...@gmail.com wrote: On Sunday, February 23, 2014 5:01:25 AM UTC-6, Marko Rauhamaa wrote: Chris Angelico : That's the exact line of thinking that leads to problems. You are not placing a number at the address "xyz", you are pointing the name "xyz" to the number

Re: Python Distributors

2014-02-24 Thread Mark Lawrence
On 24/02/2014 19:40, ed...@cornell.edu wrote: I am researching the best Python Distributors based on mainly on convenience and performance and I am wondering if anyone has any opinions on which are the best to use. Thanks! Given in no particular order I'd have said Peter Otten, Steven D'Apra

Re: Python Distributors

2014-02-24 Thread Nafiul Islam
On Tuesday, February 25, 2014 1:40:35 AM UTC+6, ed...@cornell.edu wrote: > I am researching the best Python Distributors based on mainly on convenience > and performance and I am wondering if anyone has any opinions on which are > the best to use. Thanks! I don't know if you're looking for distr

Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread Ethan Furman
Greetings! A PEP is under discussion to add %-interpolation back to the bytes type in Python 3.5. Assuming the PEP is accepted, what *will* be added back is: Numerics: b'%d' % 10 --> b'10' b'%02x' % 10 --> b'0a' Single byte: b'%c' % 80 --> b'P' and generic: b'%s' % some_binary_

Python Distributors

2014-02-24 Thread ed352
I am researching the best Python Distributors based on mainly on convenience and performance and I am wondering if anyone has any opinions on which are the best to use. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: python

2014-02-24 Thread CM
On Monday, February 24, 2014 3:31:11 AM UTC-5, Karthik Reddy wrote: > I worked as a weblogic administrator and now i am changing to development and > i am very much interested in python . please suggest me what are the > things i need to learn more rather than python to get an I.T job. I

Re: Install python 2 and 3 in the "wrong" order

2014-02-24 Thread Tim Golden
On 15/02/2014 11:25, Nagy László Zsolt wrote: From a cmd window: ftype python.file="C:\Windows\py.exe" "%1" %* ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* There is a serious problem with this! Example code test.py: #!/usr/bin/env python3 import sys print(sys.argv) Test run: C:\Te

Re: Mac vs. Linux for Python Development

2014-02-24 Thread Chris Angelico
On Tue, Feb 25, 2014 at 5:25 AM, Jean-Michel Pichavant wrote: > If you go for Linux, know that ubuntu would not be the first choice, ubuntu > prefers user experience over stability. Debian for instance is a distribution > largely used in the industry. > What you'll generally find, actually, is

Re: python

2014-02-24 Thread Emile van Sebille
On 2/24/2014 12:31 AM, Karthik Reddy wrote: I worked as a weblogic administrator and now i am changing to development and i am very much interested in python . please suggest me what are the things i need to learn more rather than python to get an I.T job. I came to know about Django

Re: Mac vs. Linux for Python Development

2014-02-24 Thread Jean-Michel Pichavant
- Original Message - > Hello, > > I'm sure this is a common question but I can't seem to find a > previous thread that addresses it. If one one exists, please point > me to it. > > I've been developing with python recreationally for a while on Ubuntu > but will soon be transitioning to

Re: Can global variable be passed into Python function?

2014-02-24 Thread Chris Angelico
On Tue, Feb 25, 2014 at 5:20 AM, wrote: > On Mon, Feb 24, 2014, at 13:05, j.e.ha...@gmail.com wrote: >> typedef struct { >> int value; >> } Number; >> >> Number *o; >> o = malloc(sizeof(*o)); >> o->value=3; >> printf("o<%p>, o->value<%p>\n", o, &o->value); >> >> o<0x9fe5008>, o->value<0

Re: Can global variable be passed into Python function?

2014-02-24 Thread Chris Angelico
On Tue, Feb 25, 2014 at 5:05 AM, wrote: > typedef struct { > int value; > } Number; > > Number *o; > o = malloc(sizeof(*o)); > o->value=3; > printf("o<%p>, o->value<%p>\n", o, &o->value); > > o<0x9fe5008>, o->value<0x9fe5008> > > Is the compiler borked? No, because a structure in C is

Re: [OT] Can global variable be passed into Python function?

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 13:19, Michael Torrie wrote: > Why would you think that? The address of the start of your malloc'ed > structure is the same as the address of the first element. Surely this > is logical? And of course all this is quite off topic. That's not helpful - the problem, in cont

Re: Can global variable be passed into Python function?

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 13:05, j.e.ha...@gmail.com wrote: > typedef struct { > int value; > } Number; > > Number *o; > o = malloc(sizeof(*o)); > o->value=3; > printf("o<%p>, o->value<%p>\n", o, &o->value); > > o<0x9fe5008>, o->value<0x9fe5008> > > Is the compiler borked? That's cheat

Re: [OT] Can global variable be passed into Python function?

2014-02-24 Thread Michael Torrie
On 02/24/2014 11:05 AM, j.e.ha...@gmail.com wrote: > typedef struct { > int value; > } Number; > > Number *o; > o = malloc(sizeof(*o)); > o->value=3; > printf("o<%p>, o->value<%p>\n", o, &o->value); > > o<0x9fe5008>, o->value<0x9fe5008> > > Is the compiler borked? Why would you think

Re: Can global variable be passed into Python function?

2014-02-24 Thread j . e . haque
On Sunday, February 23, 2014 5:01:25 AM UTC-6, Marko Rauhamaa wrote: > Chris Angelico : > > > That's the exact line of thinking that leads to problems. You are not > > > placing a number at the address "xyz", you are pointing the name "xyz" > > > to the number 3. That number still exists elsewhe

Re: Mac vs. Linux for Python Development

2014-02-24 Thread Michael Torrie
On 02/24/2014 10:34 AM, Michael Torrie wrote: > I know a lot of Mac developers that love the Sublime text editor. And > if you combine it with https://github.com/lunixbochs/actualvim, it's > even better. Sublime is actually on all platforms, and lots of people like it. http://www.sublimetext.com

Re: Mac vs. Linux for Python Development

2014-02-24 Thread Michael Torrie
On 02/23/2014 01:43 AM, twiz wrote: > I've been developing with python recreationally for a while on Ubuntu > but will soon be transitioning to full-time python development. I > have the option of using a Mac or Ubuntu environment and I'd like to > hear any thoughts on the pros and cons of each. S

Re: Mac vs. Linux for Python Development

2014-02-24 Thread William Ray Wing
On Feb 23, 2014, at 3:43 AM, twiz wrote: > Hello, > > I'm sure this is a common question but I can't seem to find a previous thread > that addresses it. If one one exists, please point me to it. > > I've been developing with python recreationally for a while on Ubuntu but > will soon be tra

Re: Can global variable be passed into Python function?

2014-02-24 Thread Steven D'Aprano
On Mon, 24 Feb 2014 21:07:42 +1300, Gregory Ewing wrote: > Steven D'Aprano wrote: >> Yes, Pascal has pointers as a first-class data type. Syntax is similar >> to C, ^x is a pointer to x, p^ dereferences the pointer p. > > Actually, the prefix ^ is only used for declaring pointer *types*. > Standa

Re: Problem with the console on the new python.org site

2014-02-24 Thread Jean-Michel Pichavant
- Original Message - > On Sun, 23 Feb 2014 10:20:15 -0800, Pierre Quentel wrote: > > > The new home page of python.org is very nice, congratulations ! > > The best I can say about it is that I'm extremely underwhelmed by the > design, which is far more "busy" and colourful than the old de

Re: Functions help

2014-02-24 Thread Jean-Michel Pichavant
- Original Message - > On Feb 23, 2014, at 1:44 AM, Steven D'Aprano < > steve+comp.lang.pyt...@pearwood.info > wrote: > > Sorry, I don't really understand your question. Could you show an > > example > > > of what you are doing? > > > Do you mean "add 5" or "*5"? "Add *5 doesn't really

Re: Functions help

2014-02-24 Thread Mark Lawrence
On 24/02/2014 04:01, ru...@yahoo.com wrote: On 02/23/2014 08:21 PM, Mark Lawrence wrote: On 24/02/2014 02:55, Benjamin Kaplan wrote: On Sun, Feb 23, 2014 at 5:39 PM, alex23 wrote: On 24/02/2014 11:09 AM, Mark Lawrence wrote: On 24/02/2014 00:55, alex23 wrote: for _ in range(5):

Re: The sum of numbers in a line from a file

2014-02-24 Thread sffjunkie
On Monday, 24 February 2014 11:48:23 UTC, sffj...@gmail.com wrote: > split_points = [2, 4, 5] Change this to `split_points = [3, 5]` for your requirements --Simon Kennedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Python powerpoint automation using pywin32

2014-02-24 Thread sffjunkie
On Monday, 24 February 2014 11:35:08 UTC, Jaydeep Patil wrote: > I need to create a new powerpoint presentation. I need to add images, paste > some graphs, add texts, tables into powerpoint. > > Is any link or document available which help me to do this work more > effectivey & faster. Always

Re: The sum of numbers in a line from a file

2014-02-24 Thread sffjunkie
On Thursday, 20 February 2014 16:22:00 UTC, kxjakkk wrote: > Let's say I have a sample file like this: > Name1 2 34 5 6 78 > > name1099-66-7871 A-FY10067815

Python powerpoint automation using pywin32

2014-02-24 Thread Jaydeep Patil
I need to create a new powerpoint presentation. I need to add images, paste some graphs, add texts, tables into powerpoint. Is any link or document available which help me to do this work more effectivey & faster. Regards Jay -- https://mail.python.org/mailman/listinfo/python-list

Re: Functions help

2014-02-24 Thread sffjunkie
On Sunday, 23 February 2014 05:43:17 UTC, Scott W Dunning wrote: > I had a question regarding functions. Is there a way to call a function > multiple times without recalling it over and over. Meaning is there a way I > can call a function and then add *5 or something like that? The followin

Re: Functions help

2014-02-24 Thread sffjunkie
On Sunday, 23 February 2014 05:43:17 UTC, Scott W Dunning wrote: > I had a question regarding functions. Is there a way to call a function > multiple times without recalling it over and over. Meaning is there a way I > can call a function and then add *5 or something like that? > The followi

insert html into ElementTree without parsing it

2014-02-24 Thread graeme . pietersz
I am building HTML pages using ElementTree. I need to insert chunks of untrusted HTML into the page. I do not need or want to parse this, just insert it at a particular point as is. The best solutions I can think of are rather ugly ones: manipulating the string created by tostring. Is there a

Re: Can global variable be passed into Python function?

2014-02-24 Thread wxjmfauth
Le lundi 24 février 2014 01:37:42 UTC+1, Steven D'Aprano a écrit : > > > > Performance can matter :-) > > > >>> timeit.timeit("'abc' * 1000 + 'z'") 0.991999136702321 >>> timeit.timeit("'abc' * 1000 + '\N{EURO SIGN}'") 2.5462559386176444 >>> Two points to notice - Even with utf-8, the wor

python

2014-02-24 Thread Karthik Reddy
I worked as a weblogic administrator and now i am changing to development and i am very much interested in python . please suggest me what are the things i need to learn more rather than python to get an I.T job. I came to know about Django but i am in a confusion please help me ..

Re: Can global variable be passed into Python function?

2014-02-24 Thread Gregory Ewing
Steven D'Aprano wrote: Yes, Pascal has pointers as a first-class data type. Syntax is similar to C, ^x is a pointer to x, p^ dereferences the pointer p. Actually, the prefix ^ is only used for declaring pointer *types*. Standard Pascal has no way of getting a pointer to an arbitrary variable; t