Newbie Question

2007-02-08 Thread Reid
will try some other language. Reid -- http://mail.python.org/mailman/listinfo/python-list

Thanks for the help

2007-02-08 Thread Reid
Hello All Thanks for taking the time to answer my question. I do not need 3d stuff. Just a couple of buttons and menu's. The reason I am looking at python is it is free to download. I cannot afford VB or other commercial languages. Reid -- http://mail.python.org/mailman/listinfo/python-list

warnings filters for varying message

2013-06-27 Thread John Reid
Looking at the docs for warnings.simplefilter (http://docs.python.org/2/library/warnings.html) I think the following script should only produce one warning at each line as any message is matched by the simple filter import warnings warnings.simplefilter('default') for i in xrange(2): warnings.

Access descendant class's module namespace from superclass

2005-07-11 Thread Reid Priedhorsky
'Ham' (I suppose I could call __import__(self.__module__), but that seems kind of awkward.) Is this possible using Python 2.3? Any better ways to accomplish this? Thanks very much for any help, Reid -- http://mail.python.org/mailman/listinfo/python-list

Easiest framework to develop simple interactive web site in python?

2011-09-12 Thread John Reid
Hi, I need to write a web interface for some computational biology software I've written: http://sysbio.mrc-bsu.cam.ac.uk/johns/STEME/rst/_build/html/index.html I don't have much experience writing web sites or applications. Can anyone recommend a python framework that will allow me to easily

Re: Easiest framework to develop simple interactive web site in python?

2011-09-13 Thread John Reid
On 12/09/11 19:37, Stefaan Himpe wrote: The simplest one to learn is web2py http://www.web2py.com No configuration needed, just unpack and get started. It also has very good documentation and tons of little examples to get things done. The other options you mentioned are good too :) OK I've h

Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. There seem to be some differences between how tuples and namedtuples are created. For example with a tuple I can do: a=tuple([1,2,3]) with namedtuples I get a TypeError: from collections import namedtuple

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 12:05, Oscar Benjamin wrote: > On 18 February 2013 12:03, Oscar Benjamin wrote: >> On 18 February 2013 11:47, John Reid wrote: >>> I'm seeing this problem because of the following code in IPython: >>> >>> def canSequence(obj): >>>

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 12:03, Oscar Benjamin wrote: > On 18 February 2013 11:47, John Reid wrote: >> Hi, >> >> I was hoping namedtuples could be used as replacements for tuples in all >> instances. > namedtuples are not really intended to serves as tuples anywhere.

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 12:11, Dave Angel wrote: > On 02/18/2013 06:47 AM, John Reid wrote: >> Hi, >> >> I was hoping namedtuples could be used as replacements for tuples in >> all instances. There seem to be some differences between how tuples >> and namedtuples are created.

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 14:12, Oscar Benjamin wrote: > On 18 February 2013 13:51, John Reid wrote: >> On 18/02/13 12:03, Oscar Benjamin wrote: >>> On 18 February 2013 11:47, John Reid wrote: >>>> Hi, >>>> >>>> I was hoping namedtuples could be

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 14:15, Oscar Benjamin wrote: > On 18 February 2013 14:09, John Reid wrote: >> On 18/02/13 12:11, Dave Angel wrote: >>> On 02/18/2013 06:47 AM, John Reid wrote: >>>> Hi, >>>> >>>> I was hoping namedtuples could be used as replac

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 14:53, Oscar Benjamin wrote: > On 18 February 2013 14:23, John Reid wrote: > [snip] >> That said it would be nice to know the rationale for >> namedtuple.__new__ to have a different signature to tuple.__new__. I'm >> guessing namedtuple._make has a simil

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread John Reid
On 19/02/13 00:18, Steven D'Aprano wrote: > Terry Reedy wrote: > >> On 2/18/2013 6:47 AM, John Reid wrote: >> >>> I was hoping namedtuples could be used as replacements for tuples >> > in all instances. >> >> This is a mistake in the

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread John Reid
On 19/02/13 01:47, alex23 wrote: > On Feb 18, 9:47 pm, John Reid wrote: >> See http://article.gmane.org/gmane.comp.python.ipython.user/10270 for more >> info. > > One quick workaround would be to use a tuple where required and then > coerce it back to Result when

Secure Postgres access

2006-09-06 Thread Reid Priedhorsky
re running on Linux. Any ideas? Thanks very much for any help. Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure Postgres access

2006-09-07 Thread Reid Priedhorsky
On Wed, 06 Sep 2006 09:29:59 -0700, Paul Rubin wrote: > Reid Priedhorsky <[EMAIL PROTECTED]> writes: >> I know how to forward ports using SSH, but I don't like doing this because >> then anyone who knows the port number can connect to Postgres over the >> same t

Re: Secure Postgres access

2006-09-09 Thread Reid Priedhorsky
On Thu, 07 Sep 2006 18:36:32 -0700, Paul Rubin wrote: > Reid Priedhorsky <[EMAIL PROTECTED]> writes: >> > Wouldn't they need a database password? >> >> Well, right now, no. I have Postgres configured to trust the OS on who is >> who. > > You

A* search implementation in Python

2007-02-01 Thread Reid Priedhorsky
Hi folks, I'm looking for an open-source Python implementation of A* search for use in a mapping application. As the star is an operator in Google, I haven't figured out how to formulate a useful search. :/ Any help would be very much appreciated. Reid -- http://mail.python.o

Forking SocketServer daemon -- updating state

2007-02-19 Thread Reid Priedhorsky
d like the state to be available for that next request. A solution might be to send a signal followed by a dummy request, which seems a bit awkward. Any other ideas or suggestions? Thanks in advance, Reid p.s. This group's help on A* search was very much appreciated -- just the t

Python and windows bandwidth statistics?

2006-05-10 Thread Dave Reid
I've been searching for a something in Python for me to be able to get the total outbound or inbound bandwidth (in Windows (or cross-OS compatible). Can anyone help me out? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

python crash

2009-04-10 Thread John Reid
Python crashes in glibc with the following stack trace. I'm using an interface to R (rpy2), ipython, matplotlib, numpy, and scipy with a wx backend. I'm not sure if the stack trace shows which is the culprit. I've probably misconfigured one of their installs but knowing which one to recompile i

Re: Presentation software for Python code

2009-04-23 Thread John Reid
Michael Hoffman wrote: Does anyone here have software they would suggest for making a presentation that includes Python code? Other than that it would probably be mainly bullet points. I'm willing to consider TeX- and HTML-based approaches. I like pygments for formatting python code. It can g

Re: Presentation software for Python code

2009-04-23 Thread John Reid
Scott David Daniels wrote: Michael Hoffman wrote: You might take a look at Crunchy, and just do up your talk there. Crunchy is a Python program that combines an otherwise static html document with an interactive Python session within a browser http://code.google.com/p/crunchy/ IPython off

Re: Presentation software for Python code

2009-04-28 Thread John Reid
Neal Becker wrote: IPython offers something similar for giving demos. I've found that very useful in the past. Really? Any pointers? http://ipython.scipy.org/doc/manual/html/api/generated/IPython.demo.html -- http://mail.python.org/mailman/listinfo/python-list

Re: LaTeXing python programs

2009-05-20 Thread John Reid
Edward Grefenstette wrote: I'm typing up my master's thesis and will be including some of the code used for my project in an appendix. The question is thus: is there a LaTeX package out there that works well for presenting python code? verbatim is a bit ugly and doesn't wrap code, and while the

Re: LaTeXing python programs

2009-05-20 Thread John Reid
Alan G Isaac wrote: The listings package is great and highly configurable. Note that you can also input entire files of Python code or pieces of them based on markers. Really quite great. I tried listings. I believe pygments makes better formatted output (at least out of the box). -- http:

Re: LaTeXing python programs

2009-05-21 Thread John Reid
Edward Grefenstette wrote: I'm trying to figure out how to use pygments. Are there any good usage examples out there? The documentation worked for me: http://pygments.org/docs/cmdline/ There is also a LaTeX package to call pygments at latex compilation time I forget what that is called thou

Safely updating master state in SocketServer with ForkingMixIn

2008-05-19 Thread Reid Priedhorsky
age)? Otherwise this technique seems compact and elegant. Are there other options? Your help would be much appreciated. Thanks, Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: scaling problems

2008-05-19 Thread Reid Priedhorsky
orks that scale with hardware and how do > they handle scaling? This sounds like a good match for Apache with mod_python. Reid -- http://mail.python.org/mailman/listinfo/python-list

Validate XML against DTD and/or XML Schema?

2006-04-16 Thread Reid Priedhorsky
a lot of stuff that was out of date. I thought it would be useful to ask here. Let me know if you have any questions, and thanks very much for any help. Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-12 Thread John Reid
Mensanator wrote: On Oct 12, 3:36�am, greg wrote: Mensanator wrote: while not done: � � ... � � if n==1: done = True � � ... Seems to me that 'while not done:' is no better than 'while True:', because in both cases you have to look inside the loop to find out what the exit condition is. Usin

Re: The rap against "while True:" loops

2009-10-13 Thread John Reid
Mensanator wrote: Nothing wrong with a having a break IMHO. My opinion is that there is everything wrong with having a break. I don't think I have ever used one, I write code that doesn't depend on that crutch. I guess its crutch-iness is in the eye of the beholder. You seem to have a dogmat

Re: The rap against "while True:" loops

2009-10-13 Thread John Reid
Mensanator wrote: No, it's just that the OP was asking whether avoiding "while True" is considered Best Practice. How can you answer such a question without sounding dogmatic? I was just pointing out your style of programming seems inflexible. "Just another line that has to be interpreted l

Instance method decorator garbage collection problem

2010-06-23 Thread John Reid
Hi, I've written a decorator that prints exceptions and I'm having some trouble with garbage collection. My decorator is: import sys def print_exception_decorator(fn): def decorator(self, *args, **kwds): try: return fn(*args, **kwds) except: print '

Re: Instance method decorator garbage collection problem

2010-06-23 Thread John Reid
Thomas Jollans wrote: The InstanceCounted.count is 1 at the end. If I omit the call to "self.method = print_exception_decorator(self.method)" then the instance count goes down to 0 as desired. I thought that the decorator might be holding a reference to the instance through the bound method, so

Check in interpreter if running a debug version of python

2010-07-27 Thread John Reid
Can I check in the interpreter if I am running a debug version of python? I don't mean if __debug__ is set, I want to know if python was compiled in debug mode. Thanks, John. -- http://mail.python.org/mailman/listinfo/python-list

*** glibc detected *** gdb: malloc(): smallbin double linked list

2010-11-05 Thread John Reid
Hi, I've compiled Python 2.7 (r27:82500, Nov 2 2010, 09:00:37) [GCC 4.4.3] on linux2 with the following configure options ./configure --prefix=/home/john/local/python-dbg --with-pydebug I've installed numpy and some other packages but when I try to run my extension code under gdb I get the er

Re: web hosting, first hand experiences?

2011-07-03 Thread Alan Harris-Reid
and they know a huge amount about Python web applications. Nothing seems to be too much trouble for them. They also provide a 60-day money-back guarantee, so you can try-before-you-buy. Best wishes, Alan Harris-Reid --

Re: py to exe converter

2011-03-21 Thread Alan Harris-Reid
On 19:59, PATRICIA MEDINA wrote: I know there is a converter for python 2.x to executable file, but is there one for python 3.x yet? I use cx_Freeze without any problems (//cx-freeze.sourceforge.net/) HTH Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: py to exe converter

2011-03-21 Thread Alan Harris-Reid
<http://www.py2exe.org/> ~/santa On Mon, Mar 21, 2011 at 11:06 AM, Alan Harris-Reid mailto:a...@baselinedata.co.uk>> wrote: On 19:59, PATRICIA MEDINA wrote: I know there is a converter for python 2.x to executable file, but is there one for python 3.x yet? I use cx_Freeze wit

Sys.path entries

2009-12-30 Thread Alan Harris-Reid
P) Also, regarding PyConfig.h - is this read every time I start Python.exe? Many thanks, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: Sys.path entries

2009-12-31 Thread Alan Harris-Reid
Marco Salden wrote: On Dec 30, 8:13 pm, Alan Harris-Reid wrote: Hi there, In my sys.path (interpreter only, no application loaded), I have the following strange entries... 'C:\\WINDOWS\\system32\\python31.zip'. This file does not exist anywhere (although python31.dll doe

Re: Sys.path entries

2009-12-31 Thread Alan Harris-Reid
Gabriel Genellina wrote: En Thu, 31 Dec 2009 04:31:06 -0300, Marco Salden escribió: On Dec 30, 8:13 pm, Alan Harris-Reid wrote: Hi there, In my sys.path (interpreter only, no application loaded), I have the following strange entries... 'C:\\WINDOWS\\system32\\python31.zip'.

Dynamic HTML controls

2010-01-11 Thread Alan Harris-Reid
x27;t mind writing my own classes (it will be good practice for me), but I don't want to re-invent the wheel if it can be avoided. TIA, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic HTML controls

2010-01-12 Thread Alan Harris-Reid
alex23 wrote: On Jan 12, 1:26 pm, Alan Harris-Reid wrote: Does anyone know where I can find any decent dynamically-constructed HTML control classes (dropdown list, table, input field, checkbox, etc.) written in Python. There's pyWeb[1], which seems pretty close to what you'

Re: Dynamic HTML controls

2010-01-14 Thread Alan Harris-Reid
Pierre Quentel wrote: On 12 jan, 04:26, Alan Harris-Reid wrote: Hi, Does anyone know where I can find any decent dynamically-constructed HTML control classes (dropdown list, table, input field, checkbox, etc.) written in Python. For example, for a HTML table I would like something like

Re: Dynamic HTML controls

2010-01-21 Thread Alan Harris-Reid
Aahz wrote: In article , Alan Harris-Reid wrote: Does anyone know where I can find any decent dynamically-constructed HTML control classes (dropdown list, table, input field, checkbox, etc.) written in Python. For example, for a HTML table I would like something like... You might

Re: python 3's adoption

2010-01-26 Thread Alan Harris-Reid
no serious problems (yet). I would be interested to hear how other people are using Python 3, and with what compatible packages. Regards, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Threading issue with SQLite

2010-01-29 Thread Alan Harris-Reid
should I forget that idea completely?) 3. When a method returns to the calling method, is the connection automatically closed (assuming the object is local, of course) or does it have to be done explicitly using connection.close()? TIA, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Web development with Python 3.1

2009-10-25 Thread Alan Harris-Reid
I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting "don't - start with 2.6"), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python

Re: Web development with Python 3.1

2009-10-26 Thread Alan Harris-Reid
Exarkun - thanks for the reply > don't - start with 2.6 Thought you might say that ;-) Regards, Alan On 25 Oct, 11:52 pm, a...@baselinedata.co.uk wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of

Re: Web development with Python 3.1

2009-10-26 Thread Alan Harris-Reid
Anyway, for simple web programming, frameworks are not worth the hassle. Just use the cgi module. I can vouch for what Paul says. I started in Python 3 years ago, and I did so with a web application (still working on it!). I'm using the cgi approach, and it certainly teaches you th

Re: Web development with Python 3.1

2009-10-26 Thread Alan Harris-Reid
r a while now). However, it looks as though I might have to review that decision, but what I've learned so far is pretty simple stuff, so it won't be wasted. Regards, Alan Alan Harris-Reid writes: I am very much new to Python, and one of my first projects is a simple data-based web

Re: Web development with Python 3.1

2009-10-27 Thread Alan Harris-Reid
Aaron Watters wrote: On Oct 25, 7:52 pm, Alan Harris-Reid wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting "don't - start with 2.6"), but as far as I can see, none

Re: Re: Web development with Python 3.1

2009-10-28 Thread Alan Harris-Reid
John Nagle wrote: Alan Harris-Reid wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 Until MySQLdb gets ported to something later than Python 2.5, support for a "data-based web site" probably has to be

Re: Web development with Python 3.1

2009-10-28 Thread Alan Harris-Reid
Martin v. Löwis wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting "don't - start with 2.6"), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web

Re: Web development with Python 3.1

2009-11-07 Thread Alan Harris-Reid
mario ruggier wrote: With respect to to original question regarding web frameworks + database and Python 3, all the following have been available for Python 3 since the day Python 3.0 was released: QP, a Web Framework http://pypi.python.org/pypi/qp/ Durus, a Python Object Database (the "defaul

String prefix question

2009-11-08 Thread Alan Harris-Reid
In the Python.org 3.1 documentation (section 20.4.6), there is a simple “Hello World” WSGI application which includes the following method... def hello_world_app(environ, start_response): status = b'200 OK' # HTTP Status headers = [(b'Content-type', b'text/plain; charset=utf-8')] # HTTP Headers

Re: Re: String prefix question

2009-11-09 Thread Alan Harris-Reid
Gerard Flanagan wrote: Alan Harris-Reid wrote: In the Python.org 3.1 documentation (section 20.4.6), there is a simple “Hello World” WSGI application which includes the following method... def hello_world_app(environ, start_response): status ='200 OK' # HTTP Status headers =(b&#x

Re: Re: String prefix question

2009-11-09 Thread Alan Harris-Reid
Benjamin Kaplan wrote: On Sun, Nov 8, 2009 at 9:38 PM, Alan Harris-Reid wrote: In the Python.org 3.1 documentation (section 20.4.6), there is a simple "Hello World" WSGI application which includes the following method... def hello_world_app(environ, start_response): statu

Re: Threading issue with SQLite

2010-02-02 Thread Alan Harris-Reid
Many thanks to all who replied to my questions re. SQLite connections, cursors and threading. Looks like I have got some reading to do regarding connection pooling and a decent SQLite ORM package. Does anyone know of any which are Python 3 compatible? Many thanks, Alanj -- http://mail.pyth

Passing parameters in URL

2010-02-03 Thread Alan Harris-Reid
on? I am currently using CherryPy 3.2, but I guess the theory could apply to any HTTP framework or web app.. Any help would be appreciated. Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing parameters in URL

2010-02-04 Thread Alan Harris-Reid
Many thanks to all those who replied to my question and clearing-up the differences between GET and POST. I think I know what to do now - if not, I'll be back :-) Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Editor for Python

2010-02-05 Thread Alan Harris-Reid
Hi Laszlo, I use Wing IDE (not free, $35 for personal edition) and PyScripter (free). I find both good, for different reasons. Regards, Alan Laszlo Nagy wrote: Hi All, I know that this question was put up on this

Re: Re: DreamPie - The Python shell you've always dreamed about!

2010-02-23 Thread Alan Harris-Reid
gorauskas wrote: I installed it on a Windows 7 machine with CPython 2.6.4 and I get the following error: Traceback (most recent call last): File "dreampie.py", line 3, in File "dreampielib\gui\__init__.pyc", line 73, in File "dreampielib\gui\load_pygtk.pyc", line 49, in load_pygtk Import

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-23 Thread Alan Harris-Reid
Chris Colbert wrote: Do you have gtk and PyGTK installed? Sounds like a missing dependency to me. On Tue, Feb 23, 2010 at 6:56 AM, Alan Harris-Reid mailto:aharrisr...@googlemail.com>> wrote: gorauskas wrote: I installed it on a Windows 7 machine with CPython 2.6.4

Super() function

2010-03-24 Thread Alan Harris-Reid
Hi, Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() some more code... Is there any way of writing the code so that the super() call is generic and automatically recognises the n

Re: Re: Super() function

2010-03-27 Thread Alan Harris-Reid
³p wrote: Hi: On 25 March 2010 11:17, Alan Harris-Reid <mailto:aharrisr...@googlemail.com>> wrote: Hi, Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super()

Re: Re: Super() function

2010-03-27 Thread Alan Harris-Reid
Gabriel Genellina wrote: En Thu, 25 Mar 2010 00:17:52 -0300, Alan Harris-Reid escribió: Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() some more code... Is there any way

SQLite date fields

2010-11-24 Thread Alan Harris-Reid
Hi, I am having design problems with date storage/retrieval using Python and SQLite. I understand that a SQLite date column stores dates as text in ISO format (ie. '2010-05-25'). So when I display a British date (eg. on a web-page) I convert the date using datetime.datetime.strptime(mydat

Re: SQLite date fields

2010-11-26 Thread Alan Harris-Reid
To all those who have replied on this thread - many thanks. It looks as though I've got to look further into date objects, SQLite's native date functions, detect_types, etc.. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list

Framework design question

2010-12-05 Thread Alan Harris-Reid
Hi, When committing data that has originally come from a webpage, sometimes data has to be converted to a data type or format which is suitable for the back-end database. For instance, a date in 'dd/mm/' format needs to be converted to a Python date-object or '-mm-dd' in order to be

Career path - where next?

2011-01-12 Thread Alan Harris-Reid
ieving my goal, I would be grateful for any advice. Regards, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: Career path - where next?

2011-01-15 Thread Alan Harris-Reid
To all those who answered my original post so far (Jon Clements, Terry Jan Reedy, Philip Semanchuk) - many thanks. Your suggestions have given me a number of avenues to follow. I'll let you know how I get on. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Career path - where next?

2011-01-17 Thread Alan Harris-Reid
Hi Fred, thanks for the reply. I have already contacted old clients (those that are still in business), but unfortunately they have either gone the 'off the shelf' route (ie. don't use bespoke software any more), or moved-over to .NET, which is a route which I don't want to follow. Still, at

Code redundancy

2010-04-20 Thread Alan Harris-Reid
language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? Any help would be appreciated. Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list

Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Jean-Michel Pichavant wrote: Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat

Re: Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Peter Otten wrote: Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1

Re: Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Iain King wrote: On Apr 20, 2:43 pm, Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = class1.attr2 = class1.attr3 = class1.attr4 = etc. Is there any way to achieve the same result without having to repeat

Re: Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Stefan Behnel wrote: Alan Harris-Reid, 20.04.2010 15:43: During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the

Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Xavier Ho wrote: On Wed, Apr 21, 2010 at 7:59 AM, Alan Harris-Reid mailto:aharrisr...@googlemail.com>> wrote: The code is not usually in class.__init__ (otherwise I would have used the self. prefix) Alan, if your variables are not usually in __init__, what's preventin

Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Chris Rebert wrote: On Tue, Apr 20, 2010 at 2:59 PM, Alan Harris-Reid wrote: Stefan Behnel wrote: Alan Harris-Reid, 20.04.2010 15:43: During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3

Re: Code redundancy

2010-04-20 Thread Alan Harris-Reid
Ethan Furman wrote: Alan Harris-Reid wrote: The code is not usually in class.__init__ (otherwise I would have used the self. prefix), but I like your self.__dict__.update(...) solution and I'll try and remember it. The code I was thinking of goes something like as follows (don'

Re: Re: Code redundancy

2010-04-21 Thread Alan Harris-Reid
Andreas Löscher wrote: You can do something like this: class A(): pass inst=) exec(""" ... a= ... b=2 ... c=3 ... d=4 ... """) in inst.__dict__ inst.a 1 This executes the Statement in the exec function and uses inst.__dict__ as namespace. But be aware, that this

Re: Code redundancy

2010-04-21 Thread Alan Harris-Reid
Ryan Kelly wrote: On Tue, 2010-04-20 at 14:43 +0100, Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result

Email attachment problem

2010-04-29 Thread Alan Harris-Reid
sg.as_string() because no part of the attachment can have a None value. (Traceback shows "'NoneType' object has no attribute 'get_content_maintype'" in line 118 of _dispatch in generator.py, many levels down from msg.as_string()) Has anyone any idea what

Re: Email attachment problem

2010-04-29 Thread Alan Harris-Reid
Chris Rebert wrote: On Thu, Apr 29, 2010 at 1:06 PM, Alan Harris-Reid wrote: Hi there, I want to send an email with an attachment using the following code (running under Python 3.1, greatly simplified to show example) from email.mime.multipart import MIMEMultipart from email.mime.text

Binary file email attachment problem

2010-05-09 Thread Alan Harris-Reid
Hi there, Using Python 3.1.2 I am having a problem sending binary attachment files (jpeg, pdf, etc.) - MIMEText attachments work fine. The code in question is as follows... for file in self.attachments: part = MIMEBase('application', "octet-stream") part.set_payload(open(file,"rb").read()

Removing anti-Jewish postings from Python list

2010-06-16 Thread Alan Harris-Reid
Any idea how we get rid of this 'noise'? Will it eventually go away if we ignore it, or is there anything the moderators can do to clean-up this (normally) wonderful resource for Python programmers? Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-10-31 Thread Alan Harris-Reid
Hi jf, I use Beyond Compare (by Scooter Software) for comparing text files and find it an indespensible tool. You can configure it so that it ignores tabs/whitespace, or treats spaces and tabs as different characters. Not sure if it will work with compiled .pyc files, though (but then you