Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Johannes Findeisen
On Sat, 16 Nov 2013 07:32:36 -0800 (PST) Ferrous Cranus wrote: Τη Σάββατο, 16 Νοεμβρίου 2013 5:20:51 μ.μ. UTC+2, ο χρήστης Mark Lawrence έγραψε: On 16/11/2013 13:45, Ferrous Cranus wrote: root@secure [~]# cd /usr/bin/python3 -bash: cd: /usr/bin/python3: Not a directory It seems that i

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Ned Batchelder
On Saturday, November 16, 2013 10:45:38 AM UTC-5, Johannes Findeisen wrote: On Sat, 16 Nov 2013 07:32:36 -0800 (PST) Ferrous Cranus wrote: Τη Σάββατο, 16 Νοεμβρίου 2013 5:20:51 μ.μ. UTC+2, ο χρήστης Mark Lawrence έγραψε: On 16/11/2013 13:45, Ferrous Cranus wrote: root@secure [~]#

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Johannes Findeisen
On Sat, 16 Nov 2013 07:56:47 -0800 (PST) Ned Batchelder wrote: Johannes, in cases like this, it is very important to have a clear message. I liked that you said, We cannot teach you Unix basics here. It weakens that message if you then teach some Unix basics. Better to keep things very

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread YBM
Le 16.11.2013 16:32, Ferrous Cranus a écrit : root@secure [~]# locate python3.4 /root/.local/lib/python3.4 /usr/local/include/python3.4m /usr/local/lib/libpython3.4m.a /usr/local/lib/python3.4 /usr/local/share/man/man1/python3.4.1 many files of python's 3.4a have been deleted this way, but the

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread YBM
Le 16.11.2013 16:43, Ferrous Cranus a écrit : Just as you use which python to figure out what python was executing, which pip will help you figure out what pip is running. root@secure [~]# which python3 /usr/bin/python3 root@secure [~]# cd /usr/bin/python3 -bash: cd: /usr/bin/python3: Not

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Ned Batchelder
On Saturday, November 16, 2013 11:48:19 AM UTC-5, YBM wrote: Le 16.11.2013 16:32, Ferrous Cranus a écrit : root@secure [~]# locate python3.4 /root/.local/lib/python3.4 /usr/local/include/python3.4m /usr/local/lib/libpython3.4m.a /usr/local/lib/python3.4

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Mark Lawrence
On 16/11/2013 16:51, Ned Batchelder wrote: On Saturday, November 16, 2013 11:48:19 AM UTC-5, YBM wrote: Perhaps because this is not a folder. Learn to read. Nikos is being annoying, but there is no need to contribute to the thread just to insult him. It doesn't make the thread stop, it

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Robert Kern
On 2013-11-16 17:02, Mark Lawrence wrote: On 16/11/2013 16:51, Ned Batchelder wrote: On Saturday, November 16, 2013 11:48:19 AM UTC-5, YBM wrote: Perhaps because this is not a folder. Learn to read. Nikos is being annoying, but there is no need to contribute to the thread just to insult

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread mm0fmf
On 16/11/2013 15:33, Ferrous Cranus wrote: I have no intention to destroy this fine group, all i need is some imple help. But you are destroying it. You don't read the help given, you don't know the basic Linux commands, you can't use Google, you insist on using profanities to gain

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Denis McMahon
On Sat, 16 Nov 2013 17:49:17 +0100, YBM wrote: Le 16.11.2013 16:43, Ferrous Cranus a écrit : root@secure [~]# which python3 /usr/bin/python3 root@secure [~]# cd /usr/bin/python3 -bash: cd: /usr/bin/python3: Not a directory root@secure [~]# which pip /usr/bin/pip root@secure [~]# cd

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Dave Angel
On Sat, 16 Nov 2013 07:15:01 -0800 (PST), Ferrous Cranus nikos.gr...@gmail.com wrote: 'locate pythοn3.4 | rm -rf' will this help or do any accidental damage? The files deleted by the rm -rf have nothing to do with the results of locate. Since you don't understand that , your system is

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Steven D'Aprano
On Sat, 16 Nov 2013 15:59:13 +0200, Νίκος wrote: HELP ME How rude. You're not the centre of the universe and we're not your mother. *plonk* -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: question

2013-10-24 Thread Dave Angel
On 23/10/2013 16:24, Cesar Campana wrote: Hi! Im installing the python library for the version 2.7 but Im getting the error unable to find vcvarsall.bat I was looking on line but it says is related to Visual Studio...? Can you guys please help me to fix this... The other responses were

Re: question

2013-10-23 Thread Chris Angelico
On Thu, Oct 24, 2013 at 7:24 AM, Cesar Campana crb...@motorola.com wrote: Hi! Im installing the python library for the version 2.7 but Im getting the error unable to find vcvarsall.bat I was looking on line but it says is related to Visual Studio...? Can you guys please help me to fix

Re: question

2013-10-23 Thread Mark Lawrence
On 23/10/2013 21:24, Cesar Campana wrote: Hi! Im installing the python library for the version 2.7 but Im getting the error unable to find vcvarsall.bat I was looking on line but it says is related to Visual Studio...? Can you guys please help me to fix this... Cesar That error occurs

Re: Question about XMLRPC

2013-08-30 Thread Ferrous Cranus
Στις 29/8/2013 6:30 μμ, ο/η Ferrous Cranus έγραψε: Στις 29/8/2013 3:35 μμ, ο/η Ferrous Cranus έγραψε: Στις 29/8/2013 2:54 μμ, ο/η Gregory Ewing έγραψε: i.she...@gmail.com wrote: I should write a python script(s) that listens to an existing XMLRPC service on my company's dev server. then i

Re: Question about XMLRPC

2013-08-29 Thread Gregory Ewing
i.she...@gmail.com wrote: I should write a python script(s) that listens to an existing XMLRPC service on my company's dev server. then i should parse that and return to the existing XML-RPC, or write the parsed data to the Posgresql database. but i'm not permitted to edit the existing

Re: Question about XMLRPC

2013-08-29 Thread Ferrous Cranus
Στις 29/8/2013 2:54 μμ, ο/η Gregory Ewing έγραψε: i.she...@gmail.com wrote: I should write a python script(s) that listens to an existing XMLRPC service on my company's dev server. then i should parse that and return to the existing XML-RPC, or write the parsed data to the Posgresql

Re: Question about XMLRPC

2013-08-29 Thread Ferrous Cranus
Στις 29/8/2013 3:35 μμ, ο/η Ferrous Cranus έγραψε: Στις 29/8/2013 2:54 μμ, ο/η Gregory Ewing έγραψε: i.she...@gmail.com wrote: I should write a python script(s) that listens to an existing XMLRPC service on my company's dev server. then i should parse that and return to the existing

Re: Question about crypto

2013-08-19 Thread Anthony Papillion
On 08/18/2013 05:29 PM, Skip Montanaro wrote: When I run the code above, I am told that the IV must be 16 bytes long. I'm assuming that the IV (I know that means Initialization Vector) is either the key OR something else I can set. But I don't know how or what to do. Does this Stack

Re: Question about crypto

2013-08-19 Thread Anthony Papillion
On 08/18/2013 05:52 PM, Roy Smith wrote: In article mailman.6.1376863028.19984.python-l...@python.org, Anthony Papillion papill...@gmail.com wrote: I've just started working with the Crypto library and I've already run into a wall even though I'm following a tutorial. Basically, I'm trying

Re: Question about crypto

2013-08-18 Thread Skip Montanaro
When I run the code above, I am told that the IV must be 16 bytes long. I'm assuming that the IV (I know that means Initialization Vector) is either the key OR something else I can set. But I don't know how or what to do. Does this Stack Overflow thread help? It looks to me like you aren't

Re: Question about crypto

2013-08-18 Thread Roy Smith
In article mailman.6.1376863028.19984.python-l...@python.org, Anthony Papillion papill...@gmail.com wrote: I've just started working with the Crypto library and I've already run into a wall even though I'm following a tutorial. Basically, I'm trying to encrypt a string using AES in CBC mode.

Re: question about posting data using MultipartPostHandler

2013-08-15 Thread Chris Angelico
On Thu, Aug 15, 2013 at 7:12 PM, cerr ron.egg...@gmail.com wrote: multipart = ({data:data}, {fname:fname}, {f:f}) but I get an error saying 'tuple' object has no attribute 'items'... how do I do this correctly? You're no longer providing a dictionary, but a tuple of dictionaries.

Re: Question about function failing with large number

2013-08-13 Thread Chris Angelico
On Tue, Aug 13, 2013 at 1:12 PM, Anthony Papillion papill...@gmail.com wrote: So I'm using the function below to test a large (617 digit) number for primality. For some reason, when I execute the code, I get an error telling me: OverflowError: long int too large to convert to float The

Re: Question about function failing with large number

2013-08-13 Thread Dave Angel
Anthony Papillion wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 So I'm using the function below to test a large (617 digit) number for primality. For some reason, when I execute the code, I get an error telling me: OverflowError: long int too large to convert to float In

Re: Question about function failing with large number

2013-08-13 Thread MRAB
On 13/08/2013 13:42, Chris Angelico wrote: On Tue, Aug 13, 2013 at 1:12 PM, Anthony Papillion papill...@gmail.com wrote: So I'm using the function below to test a large (617 digit) number for primality. For some reason, when I execute the code, I get an error telling me: OverflowError: long

Re: Question about function failing with large number

2013-08-13 Thread Chris Angelico
On Tue, Aug 13, 2013 at 4:33 PM, MRAB pyt...@mrabarnett.plus.com wrote: Here's a way to calculate the integer square root: Yes, but the actual value of the square root isn't needed. All that's needed is to stop the loop once the sqrt is reached. ChrisA --

Re: Question regarding building Python Windows installer

2013-07-15 Thread MRAB
On 15/07/2013 14:11, Mcadams, Philip W wrote: I’m attempting to create a Python 64-bit Windows Installer. Following the instructions here: http://docs.python.org/2/distutils/builtdist.html I’m to navigate to my Python folder and user command: python setup.py build --plat-name=win-amd64

Re: Question regarding building Python Windows installer

2013-07-15 Thread Zachary Ware
On Mon, Jul 15, 2013 at 8:11 AM, Mcadams, Philip W philip.w.mcad...@intel.com wrote: I’m attempting to create a Python 64-bit Windows Installer. Following the instructions here: http://docs.python.org/2/distutils/builtdist.html I’m to navigate to my Python folder and user command: python

RE: Question regarding building Python Windows installer

2013-07-15 Thread Mcadams, Philip W
- From: zachary.w...@gmail.com [mailto:zachary.w...@gmail.com] On Behalf Of Zachary Ware Sent: Monday, July 15, 2013 8:47 AM To: Mcadams, Philip W Cc: python-list@python.org Subject: Re: Question regarding building Python Windows installer On Mon, Jul 15, 2013 at 8:11 AM, Mcadams, Philip W

Re: Question regarding building Python Windows installer

2013-07-15 Thread Zachary Ware
On Mon, Jul 15, 2013 at 1:02 PM, Mcadams, Philip W philip.w.mcad...@intel.com wrote: Thanks for the reply Zachery. We have decided to just use another solution. Out of curiosity though I wanted to clarification on your statement: just stick the hg modules somewhere on PYTHONPATH. Are you

RE: Question regarding building Python Windows installer

2013-07-15 Thread Mcadams, Philip W
:07 PM To: Mcadams, Philip W Cc: python-list@python.org Subject: Re: Question regarding building Python Windows installer On Mon, Jul 15, 2013 at 1:02 PM, Mcadams, Philip W philip.w.mcad...@intel.com wrote: Thanks for the reply Zachery. We have decided to just use another solution. Out

Re: Question regarding building Python Windows installer

2013-07-15 Thread Zachary Ware
(Side note: Please avoid top-posting in future. Bottom-posting keeps context more clearly) On Mon, Jul 15, 2013 at 2:27 PM, Mcadams, Philip W philip.w.mcad...@intel.com wrote: Yes. My goal was to create the installer to put the modified python on my Mercurial server. So I could have

Re: Question about mailing list rules

2013-07-12 Thread Chris Angelico
On Fri, Jul 12, 2013 at 9:59 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Am I allowed to ask questions like Here is my code. How can I optimize it? on this mailing list? Sure you can! And you'll get a large number of responses, not all of which are directly to do with your

Re: Question about mailing list rules

2013-07-12 Thread Andreas Perstinger
On 12.07.2013 01:59, Devyn Collier Johnson wrote: Am I allowed to ask questions like Here is my code. How can I optimize it? on this mailing list? If it's written in Python, why not? But that doesn't mean you are guaranteed to get an answer :-). And please read http://sscce.org/ before

Re: Question about mailing list rules

2013-07-12 Thread Chris Angelico
On Fri, Jul 12, 2013 at 8:44 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: I am going to love this mailing list even more. Really, only Python code? I wanted to ask Python users about Perl! (^u^) Devyn Collier Johnson Heh. You'd be surprised what comes up. If it's at least broadly

Re: Question about mailing list rules

2013-07-12 Thread Chris “Kwpolska” Warrick
On Fri, Jul 12, 2013 at 12:47 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Jul 12, 2013 at 8:44 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: I am going to love this mailing list even more. Really, only Python code? I wanted to ask Python users about Perl! (^u^) Devyn

Re: Question about mailing list rules

2013-07-12 Thread Chris “Kwpolska” Warrick
On Fri, Jul 12, 2013 at 2:25 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: On 07/12/2013 07:11 AM, Chris “Kwpolska” Warrick wrote: On Fri, Jul 12, 2013 at 12:47 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Jul 12, 2013 at 8:44 PM, Devyn Collier Johnson

Re: Question about mailing list rules

2013-07-12 Thread Roy Smith
In article mailman.4621.1373613990.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Fri, Jul 12, 2013 at 9:59 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Am I allowed to ask questions like Here is my code. How can I optimize it? on this mailing list?

Re: Question about mailing list rules

2013-07-12 Thread Dave Angel
On 07/12/2013 08:34 AM, Chris “Kwpolska” Warrick wrote: On Fri, Jul 12, 2013 at 2:25 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: SNIP One more thing Devyn should do is watch the “To:” field and make sure it says python-list@python.org, because the above message was sent to

Re: Question about mailing list rules

2013-07-12 Thread Devyn Collier Johnson
On 07/12/2013 09:04 AM, Roy Smith wrote: In article mailman.4621.1373613990.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Fri, Jul 12, 2013 at 9:59 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Am I allowed to ask questions like Here is my code. How can

Re: Question about mailing list rules

2013-07-12 Thread Devyn Collier Johnson
I am going to love this mailing list even more. Really, only Python code? I wanted to ask Python users about Perl! (^u^) Devyn Collier Johnson On 07/12/2013 03:26 AM, Chris Angelico wrote: On Fri, Jul 12, 2013 at 9:59 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Am I allowed to

Re: Question about mailing list rules

2013-07-12 Thread Devyn Collier Johnson
On 07/12/2013 07:11 AM, Chris “Kwpolska” Warrick wrote: On Fri, Jul 12, 2013 at 12:47 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Jul 12, 2013 at 8:44 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: I am going to love this mailing list even more. Really, only Python code? I

Re: question please

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 09:48:09 +0200, bill papanastasiou wrote: hello , good morning how i can pùt one python file in website ? The same way you would put any other file in a website. Can you be more specific? What website do you want to put it on? Is it your website or somebody else's?

Re: question please

2013-07-05 Thread Dave Angel
On 07/05/2013 03:48 AM, bill papanastasiou wrote: hello , good morning how i can pùt one python file in website ? Whose website? If it's your own, log into the server, and use cp. Or if you're remote with ssh access, use scp. And if you really have a bunch of files to remotely transfer,

Re: Question about pickle

2013-06-26 Thread Phu Sam
f.seek(0) really does the trick. Danke sehr, Phu On Tue, Jun 25, 2013 at 6:47 AM, Peter Otten __pete...@web.de wrote: Phu Sam wrote: I have a method that opens a file, lock it, pickle.load the file into a dictionary. I then modify the status of a record, then pickle.dump the

Re: Question about pickle

2013-06-25 Thread Peter Otten
Phu Sam wrote: I have a method that opens a file, lock it, pickle.load the file into a dictionary. I then modify the status of a record, then pickle.dump the dictionary back to the file. The problem is that the pickle.dump never works. The file never gets updated. def

Re: Question about ast.literal_eval

2013-05-21 Thread Frank Millman
On 20/05/2013 18:12, Steven D'Aprano wrote: On Mon, 20 May 2013 15:26:02 +0200, Frank Millman wrote: Can anyone see anything wrong with the following approach. I have not definitely decided to do it this way, but I have been experimenting and it seems to work. [...] It seems safe to me

Re: Question about ast.literal_eval

2013-05-21 Thread Frank Millman
On 20/05/2013 18:13, Chris Angelico wrote: On Mon, May 20, 2013 at 11:26 PM, Frank Millman fr...@chagford.com wrote: 0 - for the first entry in the list, the word 'check' (a placeholder - it is discarded at evaluation time), for any subsequent entries the word 'and' or 'or'. 1 - left bracket -

Re: Question about ast.literal_eval

2013-05-21 Thread Steven D'Aprano
On Tue, 21 May 2013 08:30:03 +0200, Frank Millman wrote: On 20/05/2013 18:12, Steven D'Aprano wrote: Personally, I would strongly suggest writing your own mini- evaluator that walks the list and evaluates it by hand. It isn't as convenient as just calling eval, but *definitely* safer. I

Re: Question about ast.literal_eval

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 4:46 PM, Frank Millman fr...@chagford.com wrote: You may be right, Chris, but I don't think my approach is all that bad. Frankly, I'm not altogether convinced that our approach is right either :) But like the Oracle in the Matrix, I'm not here to push you to one decision

Re: Question about ast.literal_eval

2013-05-21 Thread Frank Millman
On 21/05/2013 09:21, Steven D'Aprano wrote: On Tue, 21 May 2013 08:30:03 +0200, Frank Millman wrote: I am not sure I can wrap my mind around mixed 'and's, 'or's, and brackets. Parsers are a solved problem in computer science, he says as if he had a clue what he was talking about *wink*

Re: Question about ast.literal_eval

2013-05-21 Thread Fábio Santos
On 21 May 2013 09:10, Frank Millman fr...@chagford.com wrote: It doesn't address the issue of brackets. I imagine that the answer is something like - maintain a stack of results for each left bracket, push a level for each right bracket, pop the result or something ... Time for me

Re: Question about ast.literal_eval

2013-05-21 Thread Mark Lawrence
On 21/05/2013 09:23, Fábio Santos wrote: On 21 May 2013 09:10, Frank Millman fr...@chagford.com mailto:fr...@chagford.com wrote: It doesn't address the issue of brackets. I imagine that the answer is something like - maintain a stack of results for each left bracket, push a level

RE: Question about ast.literal_eval

2013-05-20 Thread Carlos Nepomuceno
It seems to me you can't use ast.literal_eval()[1] to evaluate that kind of expression because it's just for literals[2]. Why don't you use eval()? [1] http://docs.python.org/2/library/ast.html#ast-helpers [2] http://docs.python.org/2/reference/lexical_analysis.html#literals

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 5:05 PM, Frank Millman fr...@chagford.com wrote: Hi all I am trying to emulate a SQL check constraint in Python. Quoting from the PostgreSQL docs, A check constraint is the most generic constraint type. It allows you to specify that the value in a certain column must

Re: Question about ast.literal_eval

2013-05-20 Thread Frank Millman
[Corrected top-posting] To: python-list@python.org From: fr...@chagford.com Subject: Question about ast.literal_eval Date: Mon, 20 May 2013 09:05:48 +0200 Hi all I am trying to emulate a SQL check constraint in Python. Quoting from the PostgreSQL docs, A check constraint is the most generic

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 5:50 PM, Frank Millman fr...@chagford.com wrote: On 20/05/2013 09:34, Carlos Nepomuceno wrote: Why don't you use eval()? Because users can create their own columns, with their own constraints. Therefore the string is user-modifiable, so it cannot be trusted. Plenty

RE: Question about ast.literal_eval

2013-05-20 Thread Carlos Nepomuceno
To: python-list@python.org From: fr...@chagford.com Subject: Re: Question about ast.literal_eval Date: Mon, 20 May 2013 09:50:02 +0200 [Corrected top-posting] To: python-list@python.org From: fr...@chagford.com Subject: Question about

Re: Question about ast.literal_eval

2013-05-20 Thread Frank Millman
On 20/05/2013 09:55, Chris Angelico wrote: On Mon, May 20, 2013 at 5:50 PM, Frank Millman fr...@chagford.com wrote: On 20/05/2013 09:34, Carlos Nepomuceno wrote: Why don't you use eval()? Because users can create their own columns, with their own constraints. Therefore the string is

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 5:55 PM, Carlos Nepomuceno carlosnepomuc...@outlook.com wrote: I understand your motivation but I don't know what protection ast.literal_eval() is offering that eval() doesn't. eval will *execute code*, while literal_eval will not. That's the protection. With

Re: Question about ast.literal_eval

2013-05-20 Thread Frank Millman
On 20/05/2013 09:55, Carlos Nepomuceno wrote: Why don't you use eval()? Because users can create their own columns, with their own constraints. Therefore the string is user-modifiable, so it cannot be trusted. I understand your motivation but I

Re: Question about ast.literal_eval

2013-05-20 Thread Steven D'Aprano
On Mon, 20 May 2013 10:55:35 +0300, Carlos Nepomuceno wrote: I understand your motivation but I don't know what protection ast.literal_eval() is offering that eval() doesn't. eval will evaluate any legal Python expression: py eval(__import__('os').system('echo Mwahaha! Now you are pwned!')

Re: Question about ast.literal_eval

2013-05-20 Thread Fábio Santos
On 20 May 2013 09:19, Frank Millman fr...@chagford.com wrote: Quoting from the manual - Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists,

Re: Question about ast.literal_eval

2013-05-20 Thread Frank Millman
On 20/05/2013 10:07, Frank Millman wrote: On 20/05/2013 09:55, Chris Angelico wrote: Is it a requirement that they be able to key in a constraint as a single string? We have a similar situation in one of the systems at work, so we divided the input into three(ish) parts: pick a field, pick an

Re: Question about ast.literal_eval

2013-05-20 Thread Steven D'Aprano
On Mon, 20 May 2013 15:26:02 +0200, Frank Millman wrote: Can anyone see anything wrong with the following approach. I have not definitely decided to do it this way, but I have been experimenting and it seems to work. I store the boolean test as a json'd list of 6-part tuples. Each element

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 11:26 PM, Frank Millman fr...@chagford.com wrote: 0 - for the first entry in the list, the word 'check' (a placeholder - it is discarded at evaluation time), for any subsequent entries the word 'and' or 'or'. 1 - left bracket - either '(' or ''. 5 - right bracket -

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Tue, May 21, 2013 at 2:12 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Personally, I would strongly suggest writing your own mini- evaluator that walks the list and evaluates it by hand. It isn't as convenient as just calling eval, but *definitely* safer. Probably faster,

Re: Question about ast.literal_eval

2013-05-20 Thread matt . newville
On Monday, May 20, 2013 2:05:48 AM UTC-5, Frank Millman wrote: Hi all I am trying to emulate a SQL check constraint in Python. Quoting from the PostgreSQL docs, A check constraint is the most generic constraint type. It allows you to specify that the value in a certain column must

Re: Question about ast.literal_eval

2013-05-20 Thread Frank Millman
On 21/05/2013 04:39, matt.newvi...@gmail.com wrote: You might find the asteval module (https://pypi.python.org/pypi/asteval) useful. It provides a relatively safe eval, for example: import asteval a = asteval.Interpreter() a.eval('x = abc') a.eval('x in (abc, xyz)')

Re: Question re: objects and square grids

2013-05-16 Thread Larry Hudson
On 05/15/2013 05:53 PM, Andrew Bradley wrote: snip I apologize if these questions are too rudimentary--I am trying to wrap my head around how this language works in a more general sense so I can start applying it to things. -Andrew Check out the book Making Games with Python Pygame at

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 12:56 PM, Andrew Bradley wrote: Hello everyone. I am having a good time programming with Python 3.3 and Pygame. Pygame seems like the perfect platform for the kind of simple games that I want to make. Pygame indeed looks pretty good to me as well. But I haven't done anything

Re: Question re: objects and square grids

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 10:56 AM, Andrew Bradley abradley...@gmail.com wrote: Hello everyone. I am having a good time programming with Python 3.3 and Pygame. Pygame seems like the perfect platform for the kind of simple games that I want to make. What I have currently programmed is basically

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 02:14 PM, Andrew Bradley wrote: Please reply on the list, not privately, unless it's something like a simple thank-you. Typically, you'd do a reply-all, then delete the people other than the list itself. Or if you're using Thunderbird, you could just reply-list. Thank you

Re: Question re: objects and square grids

2013-05-15 Thread Andrew Bradley
Now I want to show you what I have written: row = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) column = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) SQUARESIZE = 43 grid = [] for row in range(10): row_squares = [] for column in range(20): rect = Rect(12 +

Re: Question re: objects and square grids

2013-05-15 Thread Andrew Bradley
ok, now I have tested this more thoroughly, and it seems i can only do the grid[x][y] function up to grid[9][9], when i really should be able to be doing up to grid[10][20]. What exactly is the function of this row_squares list? On Wed, May 15, 2013 at 4:35 PM, Andrew Bradley

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
Please put new comments AFTER the part you're quoting. In other words, don't top-post. Also please trim off the stuff that's no longer relevant, so people don't have to read through it all wondering where your implied comments are. On 05/15/2013 06:48 PM, Andrew Bradley wrote: ok, now I

Re: Question re: objects and square grids

2013-05-15 Thread Andrew Bradley
SQUARESIZE = 43 grid = [] for row in range(10): row_squares = [] for column in range(20): rect = Rect(12 + column * SQUARESIZE, 10 + row * SQUARESIZE, SQUARESIZE, SQUARESIZE) row_squares.append(rect) grid.append(row_squares) It appears to be working

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 08:53 PM, Andrew Bradley wrote: SNIP So now, how can I utilize this new grid list? Thank you for the help so far, I feel like the entire grid is now being worked out. -Andrew That's a Pygame question, and I told you at the beginning, I can't really help with that. I'd

Re: question about try/except blocks

2013-05-02 Thread Devin Jeanpierre
On Thu, May 2, 2013 at 9:54 PM, J dreadpiratej...@gmail.com wrote: Would it be better to wrap the call and catch the OSError there, or wrap the whole with open() block in the function itself? My thought is to wrap the with open() call in the function so that I'm not wrapping the function call

Re: question about try/except blocks

2013-05-02 Thread Steven D'Aprano
On Thu, 02 May 2013 21:54:29 -0400, J wrote: I have this function in a class: def write_file(self, data, dest): with open(dest, 'wb', 0) as outfile: try: print(IN WRITE_FILE) outfile.write(self.data) except IOError as exc:

Re: question about csv.DictReader

2013-04-04 Thread Norman Clerman
Thanks for your replies. Greatly appreciated. Norm -- http://mail.python.org/mailman/listinfo/python-list

Re: question about csv.DictReader

2013-04-03 Thread MRAB
On 04/04/2013 02:26, Norman Clerman wrote: Hello, I have the following python script (some of lines are wrapped): #! /usr/bin/env python import csv def dict_test_1(): csv test program # Open the file Holdings_EXA.csv HOLDING_FILE = 'Holdings_EXA.csv' try:

Re: question about csv.DictReader

2013-04-03 Thread Tim Chase
On 2013-04-03 18:26, Norman Clerman wrote: Can anyone explain the presence of the characters \xref\xbb\xbf before the first field contents Holdings ? (you mean \xef, not \xref) This is a byte-order-mark (BOM), which you can read about at [1]. In this case, it denotes the file as UTF-8

Re: Question on for loop

2013-03-05 Thread Bryan Devaney
On Monday, March 4, 2013 4:37:11 PM UTC, Ian wrote: On Mon, Mar 4, 2013 at 7:34 AM, Bryan Devaney bryan.deva...@gmail.com wrote: if character not in lettersGuessed: return True return False assuming a function is being used to pass each letter of the

Re: Question on for loop

2013-03-04 Thread leo kirotawa
In fact this code is already doing what you want, but if the second character, by example, is not in secrectWord it'll jump out of the for and return. If you want that interact through the all characters and maybe count how many them are in the secrectWord, just take of the return there or do

Re: Question on for loop

2013-03-04 Thread Joel Goldstick
On Mon, Mar 4, 2013 at 7:18 AM, newtopython roshen.set...@gmail.com wrote: Hi all, I'm super new to python, just fyi. Welcome. Next time write a better subject line, and be sure the code you post is actually the code you are running. Provide the results you want and what you get. Provide

Re: Question on for loop

2013-03-04 Thread Dave Angel
On 03/04/2013 07:18 AM, newtopython wrote: Hi all, I'm super new to python, just fyi. Welcome to the Python list. In the piece of code below, secretWord is a string and lettersGuessed is a list. I'm trying to find out if ALL the characters of secretWord are included in lettersGuessed,

Re: Question on for loop

2013-03-04 Thread Bryan Devaney
if character not in lettersGuessed: return True return False assuming a function is being used to pass each letter of the letters guessed inside a loop itself that only continues checking if true is returned, then that could work. It is however more work than is needed.

Re: Question on for loop

2013-03-04 Thread Rick Johnson
On Monday, March 4, 2013 6:18:20 AM UTC-6, newtopython wrote: [Note: Post has be logically re-arranged for your comprehensive pleasures] for character in secretWord: if character not in lettersGuessed: return True return False What this code is doing is only checking the

Re: Question on for loop

2013-03-04 Thread Ian Kelly
On Mon, Mar 4, 2013 at 7:34 AM, Bryan Devaney bryan.deva...@gmail.com wrote: if character not in lettersGuessed: return True return False assuming a function is being used to pass each letter of the letters guessed inside a loop itself that only continues checking if true

Re: Question on for loop

2013-03-04 Thread Ricardo Aráoz
El 04/03/13 09:18, newtopython escribió: Hi all, I'm super new to python, just fyi. In the piece of code below, secretWord is a string and lettersGuessed is a list. I'm trying to find out if ALL the characters of secretWord are included in lettersGuessed, even if there are additional values

Re: Question about Tashaphyne package in python

2013-03-03 Thread MRAB
On 2013-03-03 03:06, yomnasala...@gmail.com wrote: I have a Python code that take an Arabic word and get the root and also remove diacritics, but i I have a problem with the output. For example : when the input is العربيه the output is:عرب which is right answer but when the input is كاتب the

Re: Question about defaultdict

2013-02-23 Thread Chris Angelico
On Sat, Feb 23, 2013 at 9:13 PM, Frank Millman fr...@chagford.com wrote: I thought I could replace this with - from collections import defaultdict my_cache = defaultdict(fetch_object) my_obj = my_cache['a'] It does not work, because fetch_object() is called without any arguments. A

Re: Question about defaultdict

2013-02-23 Thread Peter Otten
Frank Millman wrote: I use a dictionary as a cache, and I thought that I could replace it with collections.defaultdict, but it does not work the way I expected (python 3.3.0). my_cache = {} def get_object(obj_id): if obj_id not in my_cache: my_object = fetch_object(obj_id)

Re: Question about defaultdict

2013-02-23 Thread Frank Millman
On 23/02/2013 12:13, Frank Millman wrote: Hi all I use a dictionary as a cache, and I thought that I could replace it with collections.defaultdict, but it does not work the way I expected (python 3.3.0). [...] from collections import defaultdict my_cache = defaultdict(fetch_object) my_obj =

Re: Question about defaultdict

2013-02-23 Thread Peter Otten
Frank Millman wrote: On 23/02/2013 12:13, Frank Millman wrote: Hi all I use a dictionary as a cache, and I thought that I could replace it with collections.defaultdict, but it does not work the way I expected (python 3.3.0). [...] from collections import defaultdict my_cache =

Re: Question about defaultdict

2013-02-23 Thread Frank Millman
On 23/02/2013 13:02, Peter Otten wrote: Frank Millman wrote: On 23/02/2013 12:13, Frank Millman wrote: Hi all I use a dictionary as a cache, and I thought that I could replace it with collections.defaultdict, but it does not work the way I expected (python 3.3.0). [...] from

Re: Question related to multiprocessing.Process

2013-01-19 Thread Terry Reedy
On 1/19/2013 12:05 AM, Chris Angelico wrote: On Sat, Jan 19, 2013 at 3:50 PM, Cen Wang iwarob...@gmail.com wrote: Hi, when I use multiprocessing.Process in this way: from multiprocessing import Process class MyProcess(Process): def __init__(self): Process.__init__(self)

<    5   6   7   8   9   10   11   12   13   14   >