Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread C. N. Desrosiers
Muchas gracias! On Wednesday, May 22, 2013 2:35:18 AM UTC-4, Fábio Santos wrote: > You have to convert `age` to an integer. Use int() to do it. Then you can > compare it to other numbers and obtain the expected results. > > On 22 May 2013 07:29, "C. N. Desrosiers" wrote: > > Hi, > > > > I'm

Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread Kevin Xi
On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote: > Hi, > Hi, > > I'm just starting out with Python and to practice I am trying to write a > script that can have a simple conversation with the user. > So you may want to search the doc before you ask: http://docs.python.org >

Re: A computer programmer, web developer and network admin resume

2013-05-21 Thread Chris Angelico
On Wed, May 22, 2013 at 12:32 PM, Tim Chase wrote: > On 2013-05-22 01:15, i...@databaseprograms.biz wrote: >> A computer programmer, web developer and network administrator > > ...walk into a bar... > > So what's the punchline? ;steps up to the mike So yeah, as I was saying, a programmer, a web

Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread Fábio Santos
You have to convert `age` to an integer. Use int() to do it. Then you can compare it to other numbers and obtain the expected results. On 22 May 2013 07:29, "C. N. Desrosiers" wrote: > Hi, > > I'm just starting out with Python and to practice I am trying to write a > script that can have a simple

Newbie question about evaluating raw_input() responses

2013-05-21 Thread C. N. Desrosiers
Hi, I'm just starting out with Python and to practice I am trying to write a script that can have a simple conversation with the user. When I run the below code, it always ends up printing response to "if age > 18:" -- even if I enter a value below 18. Can anyone point me to what I am doing wr

RE: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-21 Thread Carlos Nepomuceno
Ok. Thanks! bugs.python.org/issue18031 > Date: Tue, 21 May 2013 23:26:58 -0400 > From: n...@nedbatchelder.com > To: carlosnepomuc...@outlook.com > CC: python-list@python.org > Subject: Re: Myth Busters: % "this old style of formatting will eventually be >

Re: Case insensitive dict

2013-05-21 Thread Steven D'Aprano
On Wed, 22 May 2013 03:59:55 +, Joseph L. Casale wrote: > I was doing some work with the ldap module and required a ci dict that > was case insensitive but case preserving. It turned out the cidict class > they implemented was broken with respect to pop, it is inherited and not > re implemente

Case insensitive dict

2013-05-21 Thread Joseph L. Casale
I was doing some work with the ldap module and required a ci dict that was case insensitive but case preserving. It turned out the cidict class they implemented was broken with respect to pop, it is inherited and not re implemented to work. Before I set about re-inventing the wheel, anyone know o

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: PEP 378: Format Specifier for Thousands Separator > Date: Wed, 22 May 2013 03:08:54 + > To: python-list@python.org [...] >> So, the only alternative to have "'%,d' % x" rendering the thousands >

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Andrew Berg
On 2013.05.21 21:59, Steven D'Aprano wrote: > On Tue, 21 May 2013 14:53:54 -0500, Andrew Berg wrote: > >> On 2013.05.21 14:26, Mark Lawrence wrote: > >>> Please stop perpetuating this myth, see >>> http://mail.python.org/pipermail/python-dev/2012-February/116789.html >>> and http://bugs.python.or

Re: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-21 Thread Ned Batchelder
On 5/21/2013 10:26 PM, Carlos Nepomuceno wrote: I was looking for something else and just found what I think is the place where I was first exposed to the myth[1]: "Since str.format() is quite new, a lot of Python code still uses the % operator. However, because this old style of formatting wi

Re: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-21 Thread Ethan Furman
On 05/21/2013 07:26 PM, Carlos Nepomuceno wrote: I was looking for something else and just found what I think is the place where I was first exposed to the myth[1]: "Since str.format() is quite new, a lot of Python code still uses the % operator. However, because this old style of formatting w

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Steven D'Aprano
On Wed, 22 May 2013 05:56:53 +0300, Carlos Nepomuceno wrote: > >> From: steve+comp.lang.pyt...@pearwood.info Subject: Re: PEP 378: Format >> Specifier for Thousands Separator Date: Wed, 22 May 2013 02:42:56 + >> To: python-list@python.org >> >> On Tue,

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Cameron Simpson
On 21May2013 09:54, Dave Angel wrote: | On 05/21/2013 06:32 AM, Cameron Simpson wrote: | >On 21May2013 17:56, Chris Angelico wrote: | >| On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | >| > - randrange() is like other python ranges: it does not include the end value. | >| > So your

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Steven D'Aprano
On Tue, 21 May 2013 14:53:54 -0500, Andrew Berg wrote: > On 2013.05.21 14:26, Mark Lawrence wrote: >> Please stop perpetuating this myth, see >> http://mail.python.org/pipermail/python-dev/2012-February/116789.html >> and http://bugs.python.org/issue14123 >> > What myth? The myth that % string

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: PEP 378: Format Specifier for Thousands Separator > Date: Wed, 22 May 2013 02:42:56 + > To: python-list@python.org > > On Tue, 21 May 2013 23:22:24 +0300, Carlos Nepomuceno wrote: > >> Anyway, i

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Steven D'Aprano
On Tue, 21 May 2013 23:22:24 +0300, Carlos Nepomuceno wrote: > Anyway, is it possible to overload str.__mod__() without deriving a > class? I mean to have something like: No, not in Python. If you want to monkey-patch built-in classes on the fly, with all the troubles that causes, use Ruby. --

Re: A computer programmer, web developer and network admin resume

2013-05-21 Thread Tim Chase
On 2013-05-22 01:15, i...@databaseprograms.biz wrote: > A computer programmer, web developer and network administrator ...walk into a bar... So what's the punchline? -tkc -- http://mail.python.org/mailman/listinfo/python-list

Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-21 Thread Carlos Nepomuceno
I was looking for something else and just found what I think is the place where I was first exposed to the myth[1]: "Since str.format() is quite new, a lot of Python code still uses the %  operator. However, because this old style of formatting will eventually be removed from the language, str.f

Re: A computer programmer, web developer and network admin resume

2013-05-21 Thread Denis McMahon
On Wed, 22 May 2013 01:15:27 +, i...@databaseprograms.biz wrote: > If you would like this in text format instead, please let me know. What if we don't want it at all? -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: @staticmethods called more than once

2013-05-21 Thread 88888 Dihedral
Ethan Furman於 2013年5月22日星期三UTC+8上午12時30分22秒寫道: > On 05/21/2013 08:39 AM, Skip Montanaro wrote: > > > Don't confuse the use of "static" in Python with its use in C/C++. From a > > post on StackOverflow: > > > > > > A staticmethod is a method that knows nothing about the class or > > instan

A computer programmer, web developer and network admin resume

2013-05-21 Thread i...@databaseprograms.biz
A computer programmer, web developer and network administrator resume. For a resume in HTML or .Doc format click on: www.DatabasePrograms.Biz If you would like this in text format instead, please let me know. Daniel Rapaport 1-949-307-2485 i...@databaseprogram

Re: Translation API in Python

2013-05-21 Thread Hala Gamal
ok MR, I have searched before asking here,but i didn't find thing -- http://mail.python.org/mailman/listinfo/python-list

Modules list-tool

2013-05-21 Thread Gisle Vanem
Are anyone aware of a tool that can show me at run-time which modules (pyd/dll) are loaded into a Python program at a specific time (or over time)? To clarify, e.g. when running a sample from PyQt4 (examples\tutorials\addressbook\part1.pyw) and using Process Explorer [1], I can launch WinDbg fr

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> Date: Tue, 21 May 2013 14:53:54 -0500 > From: bahamutzero8...@gmail.com > To: python-list@python.org [...] >> > What myth? People should indeed be using .format(), but no one said % > formatting was going away soon. Also, the suggested change to the docs

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> To: python-list@python.org > From: breamore...@yahoo.co.uk > Subject: Re: PEP 378: Format Specifier for Thousands Separator > Date: Tue, 21 May 2013 20:26:41 +0100 > > On 21/05/2013 20:13, Skip Montanaro wrote: >>> Thank you, but let me rephrase it. I'm al

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Ethan Furman
On 05/21/2013 12:06 PM, Chris “Kwpolska” Warrick wrote: On Tue, May 21, 2013 at 8:49 PM, Carlos Nepomuceno wrote: Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead. There is no real reason to do this. `str.format()` is

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Andrew Berg
On 2013.05.21 14:26, Mark Lawrence wrote: > On 21/05/2013 20:13, Skip Montanaro wrote: >>> Thank you, but let me rephrase it. I'm already using str.format() but I'd >>> like to use '%' (BINARY_MODULO) operator instead. >> >> That's unlikely to change. If not deprecated already string >> interpola

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> Analysing the code of "stringobject.c" I've found formatint() and > formatlong(). I mean _PyString_FormatLong() -- http://mail.python.org/mailman/listinfo/python-list

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: kwpol...@gmail.com > Date: Tue, 21 May 2013 21:06:11 +0200 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > To: carlosnepomuc...@outlook.com > CC: python-list@python.org > > On Tue, May 21, 2013 at 8:49 PM, Carlos Nepomuceno > wrot

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Mark Lawrence
On 21/05/2013 20:13, Skip Montanaro wrote: Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead. That's unlikely to change. If not deprecated already string interpolation using the modulo operator has lost favor to the stri

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Skip Montanaro
> Thank you, but let me rephrase it. I'm already using str.format() but I'd > like to use '%' (BINARY_MODULO) operator instead. That's unlikely to change. If not deprecated already string interpolation using the modulo operator has lost favor to the string object's format method. You might be a

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Chris “Kwpolska” Warrick
On Tue, May 21, 2013 at 8:49 PM, Carlos Nepomuceno wrote: > Thank you, but let me rephrase it. I'm already using str.format() but I'd > like to use '%' (BINARY_MODULO) operator instead. There is no real reason to do this. `str.format()` is the new shiny thing you should be using all the time.

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: alyssonbr...@gmail.com > Date: Tue, 21 May 2013 09:03:13 -0300 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > To: python-list@python.org > > This work in 3.1+: > > $ python3 > Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10) >

More general way of generating PyODBC queries as a dict?

2013-05-21 Thread stackoverflowuser95
Here are my averagely general class methods for creating a dictionary from the result of database queries: def make_schema_dict(self): schema = [i[2] for i in self.cursor.tables() if i[2].startswith('tbl_') or i[2].startswith('vw_')] self.schema = {table: {'scheme': [row.co

Re: @staticmethods called more than once

2013-05-21 Thread Christian
Am Dienstag, 21. Mai 2013 18:48:07 UTC+2 schrieb John Gordon: > In John Gordon writes: > > > > > You should only call addHandler() once. > > > > ...for each intended logging output destination, of course. If you want > > logging output to appear in a file and on-screen, then you would cal

Re: @staticmethods called more than once

2013-05-21 Thread Ethan Furman
On 05/21/2013 08:39 AM, Skip Montanaro wrote: Don't confuse the use of "static" in Python with its use in C/C++. From a post on StackOverflow: A staticmethod is a method that knows nothing about the class or instance it was called on. It just gets the arguments that were passed, no im

Re: @staticmethods called more than once

2013-05-21 Thread John Gordon
In John Gordon writes: > You should only call addHandler() once. ...for each intended logging output destination, of course. If you want logging output to appear in a file and on-screen, then you would call addHandler() once with a file handler and once with a screen handler. But I think you

Re: @staticmethods called more than once

2013-05-21 Thread John Gordon
In <02f0123d-2f9e-4287-b983-cfa1db9db...@googlegroups.com> Christian writes: > Hi, > i'm somewhat confused working with @staticmethods. My logger and > configuration methods are called n times, but I have only one call. > n is number of classes which import the loger and configuration class

Re: How to raise a socket "104 connection reset by peer error"

2013-05-21 Thread Andrew Berg
On 2013.05.21 10:26, loial wrote: > For testing purposes I want my code to raise a socket "connection reset by > peer" error, so that I can test how I handle it, but I am not sure how to > raise the error. Arbitrary exceptions can be raised with the raise keyword. In Python 3.3, that exact error

Re: @staticmethods called more than once

2013-05-21 Thread Skip Montanaro
Don't confuse the use of "static" in Python with its use in C/C++. From a post on StackOverflow: A staticmethod is a method that knows nothing about the class or instance > it was called on. It just gets the arguments that were passed, no implicit > first argument. It is basically useless in Pyth

Re: Static Maps from Lat Long data in XLS file

2013-05-21 Thread Tim Daneliuk
On 05/21/2013 08:12 AM, kobe...@gmail.com wrote: Hello, I'm new to Python, but I think it can solve my problem and I am looking for a someone to point me to tutorial or give me some tips here. I have an xls file that has about 1,000 latitude and longitude points. I want to do one of two thing

@staticmethods called more than once

2013-05-21 Thread Christian
Hi, i'm somewhat confused working with @staticmethods. My logger and configuration methods are called n times, but I have only one call. n is number of classes which import the loger and configuration class in the subfolder mymodule. What might be my mistake mistake? Many thanks Christian

How to raise a socket "104 connection reset by peer error"

2013-05-21 Thread loial
For testing purposes I want my code to raise a socket "connection reset by peer" error, so that I can test how I handle it, but I am not sure how to raise the error. Any advice appreciated -- http://mail.python.org/mailman/listinfo/python-list

Re: Harmonic distortion of a input signal

2013-05-21 Thread Oscar Benjamin
On 20 May 2013 18:23, jmfauth wrote: > Non sense. > > The discrete fft algorithm is valid only if the number of data > points you transform does correspond to a power of 2 (2**n). As with many of your comments about Python's unicode implementation you are confusing performance with validity. The

Re: Static Maps from Lat Long data in XLS file

2013-05-21 Thread Ken Bolton
On Tue, May 21, 2013 at 9:12 AM, wrote: > Hello, > > I'm new to Python, but I think it can solve my problem and I am looking > for a someone to point me to tutorial or give me some tips here. > Hi! I am a first-time poster to python-list, but I think I can help you. > I have an xls file that h

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Dave Angel
On 05/21/2013 06:32 AM, Cameron Simpson wrote: On 21May2013 17:56, Chris Angelico wrote: | On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | > - randrange() is like other python ranges: it does not include the end value. | > So your call picks a number from 0..58, not 0..59. | > S

suggestions for "best practices lite" for small site deployment with testing

2013-05-21 Thread Harry Percival
Hi everyone, We've been having a bit of a discussion of this topic over on the Python-UK list (http://mail.python.org/pipermail/python-uk/2013-May/thread.html#2949), and I was a bit shy about mailing out to the big, bad, worldwide Python list, but I'm forcing myself! So I'm writing a book, for O'

Static Maps from Lat Long data in XLS file

2013-05-21 Thread kobewka
Hello, I'm new to Python, but I think it can solve my problem and I am looking for a someone to point me to tutorial or give me some tips here. I have an xls file that has about 1,000 latitude and longitude points. I want to do one of two things: 1) Save a static maps and street view image from

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Alysson Bruno
This work in 3.1+: $ python3 Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> one_number = 1234567 >>> print('number={:,}'.format(one_number)) number=1,234,567 >>> paz e amor (love and peace), Alysso

Re: sympy.nsimplify

2013-05-21 Thread Paul Rudin
Skip Montanaro writes: > Very cool indeed. In the comments was a link to an XKCD cartoon. Its > tool tip mentioned "twin primes". Looked that up. Google pointed (of > course) at Wikipedia. Read that. Backed up to the Google Search, and > noticed there is a news item from 15 hours ago that a

Re: sympy.nsimplify

2013-05-21 Thread Skip Montanaro
Very cool indeed. In the comments was a link to an XKCD cartoon. Its tool tip mentioned "twin primes". Looked that up. Google pointed (of course) at Wikipedia. Read that. Backed up to the Google Search, and noticed there is a news item from 15 hours ago that an unknown mathematician at the Un

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Cameron Simpson
On 21May2013 17:56, Chris Angelico wrote: | On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | > - randrange() is like other python ranges: it does not include the end value. | > So your call picks a number from 0..58, not 0..59. | > Say randrange(0,60). Think "start, length". | | N

64-bit Python for Solaris

2013-05-21 Thread Matchek
Hello python-list, I'm looking into creating a 32/64-bit Python (2.x and/or 3.x) package for Solaris. The specificity of that package is that I need to include both 32-bit and 64-bit binaries in it. The exact way in which the 32/64 support is done is described at [1]. There currently is a Python

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 6:21 PM, Jussi Piitulainen wrote: > Chris Angelico writes: > >> > On 20May2013 15:05, Avnesh Shakya wrote: >> > So your call picks a number from 0..58, not 0..59. >> > Say randrange(0,60). Think "start, length". >> >> Nitpick: It's not start, length; it's start, stop-be

Re: sympy.nsimplify

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 6:26 PM, Steven D'Aprano wrote: > For maths nerds like me, this is too cool for words: > > http://www.johndcook.com/blog/2013/04/30/recognizing-numbers/ It is indeed, very cool. I think I need to conjure an excuse to use this someplace. ChrisA -- http://mail.python.org/m

Re: please help

2013-05-21 Thread Mark Lawrence
On 21/05/2013 09:38, iman.memarp...@gmail.com wrote: WAP in python to accept a list of words on STDIN and searches for a line containing all five vowels(a,e,i,o,u) Sorry we don't do your homework for you. But your starter for 10 is to use raw_input on Python 2 or input on Python 3 to fetch

Re: please help

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 6:38 PM, wrote: > WAP in python to accept a list of words on STDIN and searches for a line > containing all five vowels(a,e,i,o,u) Homework. Have a shot at it yourself, post your code, show that you can put in some effort. Otherwise we won't see much reason to put in ef

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" 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 > for each

please help

2013-05-21 Thread iman . memarpour
WAP in python to accept a list of words on STDIN and searches for a line containing all five vowels(a,e,i,o,u) -- http://mail.python.org/mailman/listinfo/python-list

sympy.nsimplify

2013-05-21 Thread Steven D'Aprano
For maths nerds like me, this is too cool for words: http://www.johndcook.com/blog/2013/04/30/recognizing-numbers/ -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about ast.literal_eval

2013-05-21 Thread Fábio Santos
On 21 May 2013 09:10, "Frank Millman" 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 to suggest

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Jussi Piitulainen
Chris Angelico writes: > > On 20May2013 15:05, Avnesh Shakya wrote: > > So your call picks a number from 0..58, not 0..59. > > Say randrange(0,60). Think "start, length". > > Nitpick: It's not start, length; it's start, stop-before. If the > start is 10 and the second argument is 20, you'll g

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* Here'

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: > Ok, good. Some minor remarks: > > Personally, I always use: > > #!/bin/sh > > instead of requiring bash. All UNIX systems have sh, bash is only > common. And even when present, it may not be in /bin. /bin/sh is > always there, and unless

Re: Question about ast.literal_eval

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 4:46 PM, Frank Millman 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 or another so much

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.