Re: Yet another attempt at a safe eval() call

2013-01-03 Thread Chris Rebert
On Thu, Jan 3, 2013 at 3:25 PM, Grant Edwards wrote: > > I've written a small assembler in Python 2.[67], and it needs to > evaluate integer-valued arithmetic expressions in the context of a > symbol table that defines integer values for a set of names. The > "right" thing is probably an expressi

Re: Yet another attempt at a safe eval() call

2013-01-03 Thread Steven D'Aprano
On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrote: > I've written a small assembler in Python 2.[67], and it needs to > evaluate integer-valued arithmetic expressions in the context of a > symbol table that defines integer values for a set of names. The > "right" thing is probably an expres

Re: Question on for loop

2013-01-03 Thread Steven D'Aprano
On Thu, 03 Jan 2013 12:04:03 -0800, subhabangalore wrote: > Dear Group, > If I take a list like the following: > > fruits = ['banana', 'apple', 'mango'] > for fruit in fruits: >print 'Current fruit :', fruit > > Now, > if I want variables like var1,var2,var3 be assigned to them, we may > t

Re: Missing something obvious with python-requests

2013-01-03 Thread Chris Angelico
On Fri, Jan 4, 2013 at 5:53 AM, Ray Cote wrote: > proxies = { > 'https': '192.168.24.25:8443', > 'http': '192.168.24.25:8443', } > > a = requests.get('http://google.com/', proxies=proxies) > > > When I look at the proxy log, I see a GET being performed -- when it should > be a CONNECT. >

Re: Yet another attempt at a safe eval() call

2013-01-03 Thread Grant Edwards
On 2013-01-04, Tim Chase wrote: > On 01/03/13 17:25, Grant Edwards wrote: >> def lessDangerousEval(expr): >> global symbolTable >> if 'import' in expr: >> raise ParseError("operand expressions are not allowed to contain >> the string 'import'") >> globals = {'__builtins__'

Re: Missing something obvious with python-requests

2013-01-03 Thread Ray Cote
Thank you. --Ray - Original Message - From: "Barry Scott" To: "Ray Cote" Cc: python-list@python.org Sent: Thursday, January 3, 2013 5:48:52 PM Subject: Re: Missing something obvious with python-requests The shipped python library code does not work. See http://bugs.python.org/issue729

Re: Yet another attempt at a safe eval() call

2013-01-03 Thread Tim Chase
On 01/03/13 17:25, Grant Edwards wrote: def lessDangerousEval(expr): global symbolTable if 'import' in expr: raise ParseError("operand expressions are not allowed to contain the string 'import'") globals = {'__builtins__': None} locals = symbolTable return eval

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 07:43 PM, Kene Meniru wrote: Mitya Sirenef wrote: That's what I thought, just wanted to confirm. However, if your objective to make it as easy for the user as possible, is it not easier to bind dining to a name and then do this?: dining.move(x, y, z) Absolutely. I just found t

Re: Question on for loop

2013-01-03 Thread alex23
On Jan 4, 6:04 am, subhabangal...@gmail.com wrote: > but can we do something to assign the variables dynamically I was thinking > of > var_series=['var1','var2','var3'] > for var in var_series: >   for fruit in fruits: >        print var,fruits Before trying to do this, write the next bit of code

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
Mitya Sirenef wrote: > That's what I thought, just wanted to confirm. > > However, if your objective to make it as easy for the user as possible, > is it not easier to bind dining to a name and then do this?: > > dining.move(x, y, z) > Absolutely. I just found that out after replying to your c

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 07:08 PM, Kene Meniru wrote: LinearSide.put("Dining", (x,y,z)) # moves 'Dining' to x,y,z location The put function of the LinearSide boundary class finds "Dining" (which is an entity class called LinearSideData) in the dictionary and then allows this LinearSideData class to calcul

Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple?

2013-01-03 Thread Barry Scott
On 2 Jan 2013, at 08:01, Victor Hooi wrote: > Hi, > > I'm using pysvn to checkout a specific revision based on date - pysvn will > only accept a date in terms of seconds since the epoch. > > I'm attempting to use time.mktime() to convert a date (e.g. "2012-02-01) to > seconds since epoch. >

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
Mitya Sirenef wrote: > Ok but if the user creates two sites, how does he then manipulate them, > if you are not binding instances in A? (e.g. you are not doing site1 = > Site("New Site")). > > If the user only ever needs one site, that's fine. > > -m In case of situations where the user need

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
Mitya Sirenef wrote: > > Ok but if the user creates two sites, how does he then manipulate them, > if you are not binding instances in A? (e.g. you are not doing site1 = > Site("New Site")). > > If the user only ever needs one site, that's fine. > > -m > There can only be one site for each

Yet another attempt at a safe eval() call

2013-01-03 Thread Grant Edwards
I've written a small assembler in Python 2.[67], and it needs to evaluate integer-valued arithmetic expressions in the context of a symbol table that defines integer values for a set of names. The "right" thing is probably an expression parser/evaluator using ast, but it looked like that would ta

Re: Question on for loop

2013-01-03 Thread Don Ross
I'm interested to know why you're trying this as well. Is this something that would be helped by creating a class and then dynamically creating instances of that class? Something like... class Fruit: def __init__(self, name): self.name = name for fruit in ['banana', 'apple', 'mang

Re: Missing something obvious with python-requests

2013-01-03 Thread Barry Scott
The shipped python library code does not work. See http://bugs.python.org/issue7291 for patches. Barry On 3 Jan 2013, at 18:53, Ray Cote wrote: > Hello List: > > I seem to be missing something obvious in terms of using proxies with the > requests module. > I'm using requests 1.4 and Python

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 02:30 PM, Kene Meniru wrote: Mitya Sirenef wrote: > >> >> I'm not familiar with POV-Ray. I want to note that with python standard >> style, class names look like this: ClassName, instances look like this: >> instance_name; it sounds like you want LMark to be an instance? Or you >>

[ANN] pypiserver 1.0.1 - minimal private pypi server

2013-01-03 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 1.0.1 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just 'pip install pypiserver'). It doesn't have any external depende

Re: PyGreSQL 4.1 released

2013-01-03 Thread Walter Hurry
On Thu, 03 Jan 2013 13:07:40 -0500, D'Arcy J.M. Cain wrote: > On Thu, 3 Jan 2013 15:06:29 + (UTC) > Walter Hurry wrote: >> Sounds good. Thanks for your efforts. > > I wasn't alone but I accept your thanks on behalf of the team. > >> Does it offer advantages oiver Psycopg2? > 0 > Well, it ha

Re: Question on for loop

2013-01-03 Thread Matt Jones
Yeah, this seems like a bad idea. What exactly are you trying to do here? Maybe using a dictionary is what you want? d = { 'first' : 'banana', 'second' : 'apple', 'third' : 'mango' } for key, value in d.items(): print key, value However I'm still not sure why you'd want to d

Re: Question on for loop

2013-01-03 Thread Peter Otten
subhabangal...@gmail.com wrote: > Dear Group, > If I take a list like the following: > > fruits = ['banana', 'apple', 'mango'] > for fruit in fruits: >print 'Current fruit :', fruit > > Now, > if I want variables like var1,var2,var3 be assigned to them, we may take, > var1=banana, > var2=ap

Re: Question on for loop

2013-01-03 Thread MRAB
On 2013-01-03 20:04, subhabangal...@gmail.com wrote: Dear Group, If I take a list like the following: fruits = ['banana', 'apple', 'mango'] for fruit in fruits: print 'Current fruit :', fruit Now, if I want variables like var1,var2,var3 be assigned to them, we may take, var1=banana, var2=a

Question on for loop

2013-01-03 Thread subhabangalore
Dear Group, If I take a list like the following: fruits = ['banana', 'apple', 'mango'] for fruit in fruits: print 'Current fruit :', fruit Now, if I want variables like var1,var2,var3 be assigned to them, we may take, var1=banana, var2=apple, var3=mango but can we do something to as

Re: PyGreSQL 4.1 released

2013-01-03 Thread Modulok
> --- > Release of PyGreSQL version 4.1 > --- > > It has been a long time coming but PyGreSQL v4.1 has been released. > > It is available at: http://pygresql.org/files/PyGreSQL-4.1.tgz. > > If you are running NetBSD, look in the packages direc

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
Mitya Sirenef wrote: > > I'm not familiar with POV-Ray. I want to note that with python standard > style, class names look like this: ClassName, instances look like this: > instance_name; it sounds like you want LMark to be an instance? Or you > want instances in A to use class naming style? >

Missing something obvious with python-requests

2013-01-03 Thread Ray Cote
Hello List: I seem to be missing something obvious in terms of using proxies with the requests module. I'm using requests 1.4 and Python 2.7. Have tried this on Centos 6 and Windows XP. Here's the sample code, right out of the manual: import requests proxies = { 'https': '192.168.24.25:8

Re: Creating interactive command-line Python app?

2013-01-03 Thread Tim Chase
On 01/03/13 08:41, Dave Angel wrote: The two replies in 2005 mentioned both raw_input and the cmd module (in case that's what he was implying). They were posted within 90 minutes of the original. Ah. 2005 would explain why my newsreader has purged them as ancient history :) Thanks for the c

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 07:53 AM, Kene Meniru wrote: Mitya Sirenef wrote: > > >> So, how many instances do you want to make.. what kind of different >> functionality / properties they will have? >> >> - mitya >> > > I am porting a modeling system I created using POV-Ray scene description > language availa

Re: PyGreSQL 4.1 released

2013-01-03 Thread D'Arcy J.M. Cain
On Thu, 3 Jan 2013 15:06:29 + (UTC) Walter Hurry wrote: > Sounds good. Thanks for your efforts. I wasn't alone but I accept your thanks on behalf of the team. > Does it offer advantages oiver Psycopg2? Well, it has two interfaces, the DB-API 2.0 and the "Classic" one. The classic one is ba

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
D'Arcy J.M. Cain wrote: > That works too. It's just that you had users writing Python code but > assumed that a three line subclass was beyond them. Not requiring them > to write any Python code is a better option than the first one (global > variables) that you proposed. That's all I am trying

Re: Can't seem to start on this

2013-01-03 Thread D'Arcy J.M. Cain
On Thu, 03 Jan 2013 09:59:04 -0500 Kene Meniru wrote: > Yes, I guess that is the main thing. I do not want users to have to > write python code unless they are interested in customizing how the That works too. It's just that you had users writing Python code but assumed that a three line subclas

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Terry Reedy
On 1/3/2013 9:19 AM, Mike C. Fletcher wrote: On 13-01-02 09:48 PM, Terry Reedy wrote: ... 2) self.lightDone: Invalid name "lightDone" (should match [a-z_][a-z0-9_]{2,30}$) So I can now understand that pylint doesn't like my naming convention with a capital letter in the middle of the variable

running multiple django/bottle instances

2013-01-03 Thread Andrea Crotti
I'm working on a quite complex web app that uses django and bottle (bottle for the API which is also restful). Before I came they started to use a staging server to be able to try out things properly before they get published, but now we would like to have the possibility to see multiple branches

Re: PyGreSQL 4.1 released

2013-01-03 Thread Walter Hurry
On Thu, 03 Jan 2013 09:04:16 -0500, D'Arcy J.M. Cain wrote: > --- > Release of PyGreSQL version 4.1 --- > > It has been a long time coming but PyGreSQL v4.1 has been released. > > It is available at: http://pygresql.org/files/PyGreSQL-4.1.t

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
D'Arcy J.M. Cain wrote: >> As I mentioned, the file "A" can be considered a scene file. I do not > > I don't know what a "scene" file is. > A scene file is applicable to programs like POV-Ray at www.povray.org. It is a file that is used to describe 3D objects such as box, sphere, polygon, etc

Re: building python from source

2013-01-03 Thread Matt Jones
Run the unittests. the "test___all___.py" test runner can be found under your python installation directory's lib/python-X.X/test/. *Matt Jones* On Thu, Jan 3, 2013 at 8:43 AM, Rita wrote: > For those building python from source what are some tests you do to make > sure the compilation and i

building python from source

2013-01-03 Thread Rita
For those building python from source what are some tests you do to make sure the compilation and installation is up to standard. For instance here are some thing I do: Tk functionality sqlite module Python is compiled with shared object (important for wsgi) Proper preloading of python libraries (s

Re: Creating interactive command-line Python app?

2013-01-03 Thread Dave Angel
On 01/03/2013 09:24 AM, Tim Chase wrote: > (original post from planetthoughtful didn't seem to arrive here, so > replying to Bob's reply) > >> Newbie to Python, and I'm wondering if it's possible to create a >> Python console app that prompts for further input on the command >> line when run (in Wi

Re: Can't seem to start on this

2013-01-03 Thread D'Arcy J.M. Cain
On Thu, 03 Jan 2013 09:06:55 -0500 Kene Meniru wrote: > > OK, "global variables" is the clue that you need to rethink this. > > Try to stay away from global variables as much as possible except > > for maybe some simple setup variables within the same file. > > Consider something like this instead

Re: Creating interactive command-line Python app?

2013-01-03 Thread Tim Chase
(original post from planetthoughtful didn't seem to arrive here, so replying to Bob's reply) Newbie to Python, and I'm wondering if it's possible to create a Python console app that prompts for further input on the command line when run (in Windows XP, if that's important)? While Bob's sugges

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Mike C. Fletcher
On 13-01-02 09:48 PM, Terry Reedy wrote: ... 2) self.lightDone: Invalid name "lightDone" (should match [a-z_][a-z0-9_]{2,30}$) So I can now understand that pylint doesn't like my naming convention with a capital letter in the middle of the variable name, like: "lightDone" = a boolean value. I s

Re: pygame - importing GL - very bad...

2013-01-03 Thread Mike C. Fletcher
On 13-01-02 08:53 PM, someone wrote: On 01/02/2013 10:57 PM, Michael Torrie wrote: On 01/01/2013 04:49 PM, someone wrote: On 01/01/2013 12:13 PM, Chris Angelico wrote: > You could simply > > import OpenGL.GL as GL You're right - but I forgot to write that even though this maybe should/is

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
D'Arcy J.M. Cain wrote: > > OK, "global variables" is the clue that you need to rethink this. Try > to stay away from global variables as much as possible except for maybe > some simple setup variables within the same file. Consider something > like this instead. > The global variable is not

PyGreSQL 4.1 released

2013-01-03 Thread D'Arcy J.M. Cain
--- Release of PyGreSQL version 4.1 --- It has been a long time coming but PyGreSQL v4.1 has been released. It is available at: http://pygresql.org/files/PyGreSQL-4.1.tgz. If you are running NetBSD, look in the packages directory under data

Re: Can't seem to start on this

2013-01-03 Thread D'Arcy J.M. Cain
On Wed, 02 Jan 2013 23:32:33 -0500 Kene Meniru wrote: > This sounds so simple but being new to python I am finding it hard to > get started. I want to create a module which I will call "B". There > will be other modules called "C", "D", etc, which will most likely be > imported in "B". Then I want

Re: Can't seem to start on this

2013-01-03 Thread Kene Meniru
Mitya Sirenef wrote: > So, how many instances do you want to make.. what kind of different > functionality / properties they will have? > > - mitya > I am porting a modeling system I created using POV-Ray scene description language available at sourceforge at http://sourceforge.net/project

Re: Creating interactive command-line Python app?

2013-01-03 Thread bob.blanchett
This is exactly what you want: https://cliff.readthedocs.org/en/latest/ Bob/Julius Flywheel On Wednesday, December 21, 2005 11:34:38 PM UTC+11, planetthoughtful wrote: > Hello All, > > Newbie to Python, and I'm wondering if it's possible to create a Python > console app that prompts for further

Re: Python printout

2013-01-03 Thread Avrajit Chatterjee
On Tuesday, 27 November 2012 15:00:29 UTC+5:30, Avrajit Chatterjee wrote: > I have multiple list and want to invoke a single prinout which will give a > print preview of all list in Grid format in a different pages. I have tried > wx.lib.printout.PrintTable but it takes only one table at a time.

Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Peter Otten
someone wrote: > On 01/03/2013 10:00 AM, Peter Otten wrote: >> Terry Reedy wrote: >> [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with [an underscore ? >>> >>> No, it allows underscores. As I read that re, 'rx', etc, do match. They >> >> No, it's one leading lett

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Chris Angelico
On Thu, Jan 3, 2013 at 10:19 PM, someone wrote: > Doesn't this "[ ... ]" mean something optional? > > What does {2,30}$ mean? > > I think $ means that the {2,30} is something in the end of the sentence... You can find regular expression primers all over the internet, but to answer these specific

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread someone
On 01/03/2013 10:00 AM, Peter Otten wrote: Terry Reedy wrote: [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an underscore ? No, it allows underscores. As I read that re, 'rx', etc, do match. They No, it's one leading letter or underscore [a-z_] plus at least two lett

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread someone
On 01/03/2013 03:55 AM, Ian Kelly wrote: On Wed, Jan 2, 2013 at 7:24 PM, someone wrote: 3) self.rx / rself.ry / self.rz: Invalid name "rx" (should match [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an underscore ? It wants the name to be at least 3 characters long.

Re: Important questions about __future__

2013-01-03 Thread Steven D'Aprano
On Thu, 03 Jan 2013 03:27:42 -0600, Andrew Berg wrote: > Does 'from __future__ import barry_as_FLUFL' do anything? Yes, it re-enables <> and disables != as not equal: py> sys.version '3.3.0rc3 (default, Sep 27 2012, 18:44:58) \n[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]' py> 1 <> 2 File "", lin

Re: Important questions about __future__

2013-01-03 Thread Ian Kelly
On Thu, Jan 3, 2013 at 2:27 AM, Andrew Berg wrote: > Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP > 401, using print as a statement still raises a SyntaxError. I think it only replaces the != operator with <>. > Where is 'from __future__ import braces' implemented in CPy

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-03 Thread Gisle Vanem
"Wayne Werner" wrote: Yep. That's how I feel. I had used ViEmu in Visual Studio for coding in .NET at work - but I found that the buffers & macros were more powerful. So now I do most of my programming in Vim, and only head to VS if I need autocomplete or some of it's auto-generation tools. L

Re: Important questions about __future__

2013-01-03 Thread Ramchandra Apte
On Thursday, 3 January 2013 15:13:44 UTC+5:30, Ramchandra Apte wrote: > On Thursday, 3 January 2013 14:57:42 UTC+5:30, Andrew Berg wrote: > > > Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP > > > > > > 401, using print as a statement still raises a SyntaxError. > > >

Re: Important questions about __future__

2013-01-03 Thread Ramchandra Apte
On Thursday, 3 January 2013 14:57:42 UTC+5:30, Andrew Berg wrote: > Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP > > 401, using print as a statement still raises a SyntaxError. > > Where is 'from __future__ import braces' implemented in CPython (it's > > not in __future

Important questions about __future__

2013-01-03 Thread Andrew Berg
Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP 401, using print as a statement still raises a SyntaxError. Where is 'from __future__ import braces' implemented in CPython (it's not in __future__.py)? -- CPython 3.3.0 | Windows NT 6.2.9200.16461 -- http://mail.python.org/mai

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Peter Otten
Terry Reedy wrote: >> [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an >> underscore ? > > No, it allows underscores. As I read that re, 'rx', etc, do match. They No, it's one leading letter or underscore [a-z_] plus at least two letters, underscores or digits [a-z0-9_]{