Re: seek operation in python

2015-04-29 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 02:33 CEST schreef Chris Angelico: > On Thu, Apr 30, 2015 at 4:08 AM, siva sankari R > wrote: >> file=open("input","r") >> line=file.seek(7) >> print line >> >> The above code is supposed to print a line but it prints "none". I >> don't know where the mistake is. Help.! >

Re: Not possible to hide local variables

2015-04-29 Thread Chris Angelico
On Thu, Apr 30, 2015 at 3:10 PM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> If you have a Java background, you might find this useful: >> >> http://dirtsimple.org/2004/12/python-is-not-java.html >> >> http://dirtsimple.org/2004/12/java-is-not-python-either.html > > Unfortunately, I didn't find

Re: Not possible to hide local variables

2015-04-29 Thread Marko Rauhamaa
Steven D'Aprano : > If you have a Java background, you might find this useful: > > http://dirtsimple.org/2004/12/python-is-not-java.html > > http://dirtsimple.org/2004/12/java-is-not-python-either.html Unfortunately, I didn't find those articles all that insightful. The one big difference betwee

Re: str more precise in 3 as 2.7

2015-04-29 Thread Steven D'Aprano
On Wednesday 29 April 2015 21:24, Cecil Westerhof wrote: > I am trying to make my modules also work under Python 3. I found that > str is more precise in Python 3. The expression: > str(134 / 6.0) > gives in 2.7.8: > '22.33' > and in 3.4.1: > '22.332' The precise d

Re: Not possible to hide local variables

2015-04-29 Thread Steven D'Aprano
On Wednesday 29 April 2015 16:32, Cecil Westerhof wrote: >> The convention is, if the caller messes with your private attributes >> or variables, and their code breaks, they have nobody to blame but >> themselves, and we are allowed to laugh at them. We're consenting >> adults here. > > Coming fr

Re: Python download for 64-bit OS

2015-04-29 Thread Chris Angelico
On Thu, Apr 30, 2015 at 1:44 PM, Igor Korot wrote: > Hi, ALL, > I have a small issue. > > Going to https://www.python.org/downloads/windows/, I see the python > 2.7.9 download for x86 only. There is no 64-bit installer. > > Where can I get one? > > I'm on Win8.1 64-bit OS and prefer to work with 6

Re: Python download for 64-bit OS

2015-04-29 Thread Zachary Ware
On Wed, Apr 29, 2015 at 10:44 PM, Igor Korot wrote: > Hi, ALL, > I have a small issue. > > Going to https://www.python.org/downloads/windows/, I see the python > 2.7.9 download for x86 only. There is no 64-bit installer. > > Where can I get one? > > I'm on Win8.1 64-bit OS and prefer to work with

Python download for 64-bit OS

2015-04-29 Thread Igor Korot
Hi, ALL, I have a small issue. Going to https://www.python.org/downloads/windows/, I see the python 2.7.9 download for x86 only. There is no 64-bit installer. Where can I get one? I'm on Win8.1 64-bit OS and prefer to work with 64-bit version... Thank you. -- https://mail.python.org/mailman/li

Re: Not possible to hide local variables

2015-04-29 Thread Michael Torrie
On 04/29/2015 12:16 AM, Cecil Westerhof wrote: >> Prefix those names with a single leading underscore, which is the >> convention for private variables. > > Done. > >> This way, if some user (maybe you! ;) has a good reason to change >> those values in can be done, but it is quite clear that said

Re: Lucky numbers in Python

2015-04-29 Thread Ian Kelly
On Wed, Apr 29, 2015 at 6:11 PM, Steven D'Aprano wrote: > On Thu, 30 Apr 2015 05:57 am, Ian Kelly wrote: > >> On Wed, Apr 29, 2015 at 12:24 PM, Cecil Westerhof >> wrote: >>> I was wondering if there is a way to do this: >>> for del_index in range((sieve_len // skip_count) * skip_count

Re: Lucky numbers in Python

2015-04-29 Thread Ian Kelly
On Wed, Apr 29, 2015 at 6:01 PM, Cecil Westerhof wrote: > Op Thursday 30 Apr 2015 00:38 CEST schreef Ian Kelly: >> In that case you can definitely omit the middle term of the slice, >> which will be both more concise and clearer in intent, though >> probably not significantly faster. > > It is cer

Re: Not possible to hide local variables

2015-04-29 Thread Dave Angel
On 04/29/2015 10:16 AM, Grant Edwards wrote: On 2015-04-28, Cecil Westerhof wrote: If I remember correctly you can not hide variables of a class or make them read-only? I want to rewrite my moving average to python. The init is: def __init__(self, length): if type(length) != int:

Google Web Search API

2015-04-29 Thread brad . ahlers
Does anyone know of any current Python projects that utilize Google's search engine to return quick answers to questions? For example, if you Google "When did Abraham Lincoln die", Google returns "April 15, 1865" before listing any results. I know of many projects that utilize Google search to r

Re: ImportError with pickle (Python 2.7.9), possibly platform dependent

2015-04-29 Thread Chris Angelico
On Thu, Apr 30, 2015 at 2:01 AM, Ben Sizer wrote: > 1) There clearly is a module named OMDBMap, and it's importable - it's there > in the 2nd line of the traceback. > > Does anybody have any suggestions on how I can go about debugging this? Or > refactoring it to avoid whatever is happening here

Re: seek operation in python

2015-04-29 Thread Chris Angelico
On Thu, Apr 30, 2015 at 4:08 AM, siva sankari R wrote: > file=open("input","r") > line=file.seek(7) > print line > > The above code is supposed to print a line but it prints "none". I don't know > where the mistake is. Help.! Going right back to the beginning... Are you aware that 'seek' works w

Re: Lucky numbers in Python

2015-04-29 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 00:38 CEST schreef Ian Kelly: > On Wed, Apr 29, 2015 at 3:45 PM, Cecil Westerhof wrote: >> Op Wednesday 29 Apr 2015 21:57 CEST schreef Ian Kelly: >>> And although it's not clear to me what this is supposed to be >>> doing, you probably no longer need the middle term if the

Re: seek operation in python

2015-04-29 Thread Steven D'Aprano
On Thu, 30 Apr 2015 06:53 am, Mark Lawrence wrote: > The only good top poster is a dead top poster, except for... Since you just top posted, at least you're being honest. Mark, I'm fairly sure you were trying to be funny, but I think you just crossed a line from "funny and mean" to "just mean bu

Re: Lucky numbers in Python

2015-04-29 Thread Steven D'Aprano
On Thu, 30 Apr 2015 05:57 am, Ian Kelly wrote: > On Wed, Apr 29, 2015 at 12:24 PM, Cecil Westerhof > wrote: >> I was wondering if there is a way to do this: >> for del_index in range((sieve_len // skip_count) * skip_count >> - 1, >> skip_c

Re: Python re to extract useful information from each line

2015-04-29 Thread sohcahtoa82
On Wednesday, April 29, 2015 at 1:42:18 PM UTC-7, Kashif Rana wrote: > Hello Experts > > I have below lines with some variations. > > 1- set policy id 1000 from "Untrust" to "Trust" "Any" "1.1.1.1" "HTTP" nat > dst ip 10.10.10.10 port 8000 permit log > > 2- set policy id 5000 from "Trust" to "U

Re: Python re to extract useful information from each line

2015-04-29 Thread Tim Chase
On 2015-04-29 14:22, Emile van Sebille wrote: > On 4/29/2015 1:49 PM, Kashif Rana wrote: > > pol_elements = > > re.compile('id\s(?P.+?)(?:\sname\s(?P.+?))?\sfrom\s(?P.+?)\sto\s(?P.+?)\s{2}(?P[^\s]+?)\s(?P[^\s]+?)\s(?P[^\s]+?)(?:(?P\snat)\s(?P[^\s]+?)(?P\sdip-id\s[^\s]+?)?)?\s(?P[^\s]+?)(?:\sschedul

Re: Lucky numbers in Python

2015-04-29 Thread Chris Kaynor
On Wed, Apr 29, 2015 at 2:45 PM, Cecil Westerhof wrote: > >> I was wondering if there is a way to do this: > >> for del_index in range((sieve_len // skip_count) * skip_count - 1, > >> skip_count - 2, -skip_count): > >> del sieve[del_index] > >> in a more efficient way. > > > > You can delete usin

Re: Lucky numbers in Python

2015-04-29 Thread Ian Kelly
On Wed, Apr 29, 2015 at 3:45 PM, Cecil Westerhof wrote: > Op Wednesday 29 Apr 2015 21:57 CEST schreef Ian Kelly: >> And although it's not clear to me what this is supposed to be doing, >> you probably no longer need the middle term if the intention is to >> continue deleting all the way to the end

Re: implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 22:51 CEST schreef Mark Lawrence: > On 29/04/2015 18:08, Cecil Westerhof wrote: >> Op Wednesday 29 Apr 2015 18:04 CEST schreef Mark Lawrence: >> From the amount of messages you could think I am a spammer. ;-) >>> >>> Did you mean spanner? ;-) >> >> My English is

Re: Lucky numbers in Python

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 21:57 CEST schreef Ian Kelly: > On Wed, Apr 29, 2015 at 12:24 PM, Cecil Westerhof wrote: >> I was wondering if there is a way to do this: >> for del_index in range((sieve_len // skip_count) * skip_count - 1, >> skip_count - 2, -skip_count): >> del sieve[del_index] >> in a

Re: Useful module to be written by a newbie

2015-04-29 Thread Peter Otten
Cecil Westerhof wrote: > Op Wednesday 29 Apr 2015 21:03 CEST schreef Peter Otten: >> I was judging from the look of your MovingAverage. >> >> I don't like the interface, it really should take an iterable so >> that you can write >> > list(moving_average([1,2,3], 2)) >> [1.5, 2.5] > > I shoul

Re: Python re to extract useful information from each line

2015-04-29 Thread Mark Lawrence
On 29/04/2015 22:22, Emile van Sebille wrote: On 4/29/2015 1:49 PM, Kashif Rana wrote: pol_elements = re.compile('id\s(?P.+?)(?:\sname\s(?P.+?))?\sfrom\s(?P.+?)\sto\s(?P.+?)\s{2}(?P[^\s]+?)\s(?P[^\s]+?)\s(?P[^\s]+?)(?:(?P\snat)\s(?P[^\s]+?)(?P\sdip-id\s[^\s]+?)?)?\s(?P[^\s]+?)(?:\sschedule\s(?P[

Re: Python re to extract useful information from each line

2015-04-29 Thread MRAB
On 2015-04-29 22:22, Emile van Sebille wrote: On 4/29/2015 1:49 PM, Kashif Rana wrote: pol_elements = re.compile('id\s(?P.+?)(?:\sname\s(?P.+?))?\sfrom\s(?P.+?)\sto\s(?P.+?)\s{2}(?P[^\s]+?)\s(?P[^\s]+?)\s(?P[^\s]+?)(?:(?P\snat)\s(?P[^\s]+?)(?P\sdip-id\s[^\s]+?)?)?\s(?P[^\s]+?)(?:\sschedule\s(?P

Re: Python re to extract useful information from each line

2015-04-29 Thread Emile van Sebille
On 4/29/2015 1:49 PM, Kashif Rana wrote: pol_elements = re.compile('id\s(?P.+?)(?:\sname\s(?P.+?))?\sfrom\s(?P.+?)\sto\s(?P.+?)\s{2}(?P[^\s]+?)\s(?P[^\s]+?)\s(?P[^\s]+?)(?:(?P\snat)\s(?P[^\s]+?)(?P\sdip-id\s[^\s]+?)?)?\s(?P[^\s]+?)(?:\sschedule\s(?P[^\s]+?))?(?P\slog)?$' ) ... and that's why

Re: Useful module to be written by a newbie

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 21:03 CEST schreef Peter Otten: >>> Realistically a Python coder with a little experience will have a >>> glance at your code and run away. >> >> Oops, that is not nice to hear. :'-( > > Sorry, I did not mean to discourage you or insult you, I just wanted > to make it cle

Re: seek operation in python

2015-04-29 Thread Mark Lawrence
The only good top poster is a dead top poster, except for... On 29/04/2015 19:42, Billy Earney wrote: if your filename is input.cpp, you first line of code should be: file=open("input*.cpp*","r") On Wed, Apr 29, 2015 at 1:26 PM, siva sankari R wrote: There is a file named "input.cpp"(c++ fi

Re: implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Mark Lawrence
On 29/04/2015 18:08, Cecil Westerhof wrote: Op Wednesday 29 Apr 2015 18:04 CEST schreef Mark Lawrence: From the amount of messages you could think I am a spammer. ;-) Did you mean spanner? ;-) My English is not good enough to understand what you mean by this. Seek, and ye shall find.

Re: Python re to extract useful information from each line

2015-04-29 Thread Kashif Rana
On Thursday, April 30, 2015 at 12:42:18 AM UTC+4, Kashif Rana wrote: > Hello Experts > > I have below lines with some variations. > > 1- set policy id 1000 from "Untrust" to "Trust" "Any" "1.1.1.1" "HTTP" nat > dst ip 10.10.10.10 port 8000 permit log > > 2- set policy id 5000 from "Trust" to "U

Python re to extract useful information from each line

2015-04-29 Thread Kashif Rana
Hello Experts I have below lines with some variations. 1- set policy id 1000 from "Untrust" to "Trust" "Any" "1.1.1.1" "HTTP" nat dst ip 10.10.10.10 port 8000 permit log 2- set policy id 5000 from "Trust" to "Untrust" "Any" "microsoft.com" "HTTP" nat src permit schedule "14August2014" log 3-

Re: Lucky numbers in Python

2015-04-29 Thread Ian Kelly
On Wed, Apr 29, 2015 at 12:24 PM, Cecil Westerhof wrote: > I was wondering if there is a way to do this: > for del_index in range((sieve_len // skip_count) * skip_count - 1, > skip_count - 2, -skip_count): > del sieve[del_index] > in a

Re: Panda data read_csv returns 'TextFileReader' object

2015-04-29 Thread Kurt
Python has a return object dependency on its input parameter call. I overlooked the fact specifying a "chunksize" parameter in the read_csv function returns a TextFileReader object, which is used for iteration purposes. I might need to work with that, as well as a ref manual such as Python for D

Re: Useful module to be written by a newbie

2015-04-29 Thread Ian Kelly
On Wed, Apr 29, 2015 at 1:03 PM, Peter Otten <__pete...@web.de> wrote: > I was judging from the look of your MovingAverage. > > I don't like the interface, it really should take an iterable so that you > can write > list(moving_average([1,2,3], 2)) > [1.5, 2.5] The problem with this is that m

Re: Useful module to be written by a newbie

2015-04-29 Thread Peter Otten
Cecil Westerhof wrote: > Op Wednesday 29 Apr 2015 18:27 CEST schreef Peter Otten: > >> Cecil Westerhof wrote: >> >>> I have experience with Python, but it has been some time ago. The >>> best way to relearn a language (for me) is just make a lot of code >>> with it. But it would be nice if it was

Re: seek operation in python

2015-04-29 Thread John Gordon
In <8b2bd328-08a6-4211-85c4-8d117d1aa...@googlegroups.com> siva sankari R writes: > file=open("input","r") > line=file.seek(7) > print line > The above code is supposed to print a line but it prints "none". > I don't know where the mistake is. Help.! The seek() function doesn't return any data

Re: seek operation in python

2015-04-29 Thread MRAB
On 2015-04-29 19:08, siva sankari R wrote: file=open("input","r") line=file.seek(7) print line The above code is supposed to print a line but it prints "none". I don't know where the mistake is. Help.! 'seek' will seek to position 7 in the file. It doesn't read. That's what 'read' is for! :-)

Lucky numbers in Python

2015-04-29 Thread Cecil Westerhof
I wrote a function lucky_numbers: def lucky_numbers(n): if n < 3: return [1] sieve = range(1, n + 1, 2) sieve_index = 1 while True: skip_count = sieve[sieve_index] sieve_len = len(sieve) if sieve_len < skip_count

Re: seek operation in python

2015-04-29 Thread Billy Earney
if your filename is input.cpp, you first line of code should be: file=open("input*.cpp*","r") On Wed, Apr 29, 2015 at 1:26 PM, siva sankari R wrote: > There is a file named "input.cpp"(c++ file) that contains some 80 lines of > code. > -- > https://mail.python.org/mailman/listinfo/python-list >

Re: seek operation in python

2015-04-29 Thread siva sankari R
There is a file named "input.cpp"(c++ file) that contains some 80 lines of code. -- https://mail.python.org/mailman/listinfo/python-list

Re: seek operation in python

2015-04-29 Thread Joel Goldstick
On Wed, Apr 29, 2015 at 2:08 PM, siva sankari R wrote: > file=open("input","r") > line=file.seek(7) > print line > > The above code is supposed to print a line but it prints "none". I don't know > where the mistake is. Help.! > -- > https://mail.python.org/mailman/listinfo/python-list What is in

Re: Using + with strings considered bad

2015-04-29 Thread Andrew Berg
On 2015.04.29 04:08, Mark Lawrence wrote: > On 29/04/2015 09:29, Cecil Westerhof wrote: >> Because I try to keep my lines (well) below 80 characters, I use the >> following: >> print('Calculating fibonacci and fibonacci_memoize once for ' + >>str(large_fibonacci) + ' to determine s

seek operation in python

2015-04-29 Thread siva sankari R
file=open("input","r") line=file.seek(7) print line The above code is supposed to print a line but it prints "none". I don't know where the mistake is. Help.! -- https://mail.python.org/mailman/listinfo/python-list

Re: Useful module to be written by a newbie

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 18:27 CEST schreef Peter Otten: > Cecil Westerhof wrote: > >> I have experience with Python, but it has been some time ago. The >> best way to relearn a language (for me) is just make a lot of code >> with it. But it would be nice if it was useful at the same time. I >> st

Re: implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 18:04 CEST schreef Mark Lawrence: >> From the amount of messages you could think I am a spammer. ;-) >> > > Did you mean spanner? ;-) My English is not good enough to understand what you mean by this. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.link

Re: Useful module to be written by a newbie

2015-04-29 Thread Peter Otten
Cecil Westerhof wrote: > I have experience with Python, but it has been some time ago. The best > way to relearn a language (for me) is just make a lot of code with it. > But it would be nice if it was useful at the same time. I started a > Python library on GitHub: > https://github.com/CecilW

Re: implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Mark Lawrence
On 29/04/2015 15:40, Cecil Westerhof wrote: Op Wednesday 29 Apr 2015 15:14 CEST schreef Dave Angel: On 04/29/2015 08:42 AM, Cecil Westerhof wrote: I have the folowing print statements: print( 'Calculating fibonacci_old, fibonacci_memoize and' 'fibonacci_memoize once for {0} '.format(large_fibo

ImportError with pickle (Python 2.7.9), possibly platform dependent

2015-04-29 Thread Ben Sizer
I'm saving some data via pickle, and loading it in is proving tricky. Traceback (most recent call last): [...some lines removed...] File "/home/kylotan/OMDBSetup.py", line 44, in get_omdb_map __omdb_map = OMDBMap.OMDBMap.load_from_binary(full_path) File "/home/kylotan/OMDBMap.py", line 87, in

Useful module to be written by a newbie

2015-04-29 Thread Cecil Westerhof
I have experience with Python, but it has been some time ago. The best way to relearn a language (for me) is just make a lot of code with it. But it would be nice if it was useful at the same time. I started a Python library on GitHub: https://github.com/CecilWesterhof/PythonLibrary Anyone an

Re: implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 15:14 CEST schreef Dave Angel: > On 04/29/2015 08:42 AM, Cecil Westerhof wrote: >> I have the folowing print statements: >> print( >> 'Calculating fibonacci_old, fibonacci_memoize and ' >> 'fibonacci_memoize once for {0} '.format(large_fibonacci)) >> >> >> print( >> 'Calcu

Re: Not possible to hide local variables

2015-04-29 Thread Grant Edwards
On 2015-04-28, Cecil Westerhof wrote: > If I remember correctly you can not hide variables of a class or make > them read-only? > > I want to rewrite my moving average to python. The init is: > def __init__(self, length): > if type(length) != int: > raise ParameterError, 'P

Re: Using + with strings considered bad

2015-04-29 Thread Steven D'Aprano
On Wed, 29 Apr 2015 06:29 pm, Cecil Westerhof wrote: > Because I try to keep my lines (well) below 80 characters, I use the > following: > print('Calculating fibonacci and fibonacci_memoize once for ' + > str(large_fibonacci) + ' to determine speed increase') That's perfectly fine,

Re: implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Dave Angel
On 04/29/2015 08:42 AM, Cecil Westerhof wrote: I have the folowing print statements: print( 'Calculating fibonacci_old, fibonacci_memoize and ' 'fibonacci_memoize once for {0} '.format(large_fibonacci)) print( 'Calculating fibonacci_old, fibonacci_memoize an

Re: Using + with strings considered bad

2015-04-29 Thread Chris Angelico
On Wed, Apr 29, 2015 at 10:23 PM, Cecil Westerhof wrote: > In 2.7 that gives: >('Calculating fibonacci and fibonacci_memoize once for', 40, 'to determine > speed increase') > > So I am going to use the one above it. Start your script with: from __future__ import print_function Problem solv

implicitly concats of adjacent strings does not work with format

2015-04-29 Thread Cecil Westerhof
I have the folowing print statements: print( 'Calculating fibonacci_old, fibonacci_memoize and ' 'fibonacci_memoize once for {0} '.format(large_fibonacci)) print( 'Calculating fibonacci_old, fibonacci_memoize and ' 'fibonacci_memoize once for {0} '.format(l

Re: Using + with strings considered bad

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 11:24 CEST schreef Peter Otten: >> print('Calculating fibonacci and fibonacci_memoize once for ' + >> str(large_fibonacci) + ' to determine speed increase') > > You could write that as > > print('Calculating fibonacci and fibonacci_memoize once for ' > '{} to determine spe

Re: str more precise in 3 as 2.7

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 13:55 CEST schreef Chris Angelico: > On Wed, Apr 29, 2015 at 9:24 PM, Cecil Westerhof wrote: >> I am trying to make my modules also work under Python 3. I found >> that str is more precise in Python 3. The expression: str(134 / >> 6.0) gives in 2.7.8: '22.33' and

Re: Wrote a memoize function: I do not mind feedback

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 10:58 CEST schreef Mark Lawrence: >> It is not only performance wise, I find the code without the try >> also better looking. But that is very personally I suppose. >> > > You might find this interesting > http://www.jeffknupp.com/blog/2013/02/06/write-cleaner-python-use-e

Re: Question Installing latest Python

2015-04-29 Thread Chris Angelico
On Wed, Apr 29, 2015 at 9:42 PM, Steven D'Aprano wrote: > On Wed, 29 Apr 2015 04:57 pm, Φώντας Λαδοπρακόπουλος wrote: > >> Thank you very much Steven! >> >> Indeed it worked!! >> >> One last thing. Can you please explain to me inplain English what exactly >> was that weird problem? > > Probably no

Re: str more precise in 3 as 2.7

2015-04-29 Thread Chris Angelico
On Wed, Apr 29, 2015 at 9:24 PM, Cecil Westerhof wrote: > I am trying to make my modules also work under Python 3. I found that > str is more precise in Python 3. The expression: > str(134 / 6.0) > gives in 2.7.8: > '22.33' > and in 3.4.1: > '22.332' > > Was not ver

Re: str more precise in 3 as 2.7

2015-04-29 Thread Mark Lawrence
On 29/04/2015 12:24, Cecil Westerhof wrote: I am trying to make my modules also work under Python 3. I found that str is more precise in Python 3. The expression: str(134 / 6.0) gives in 2.7.8: '22.33' and in 3.4.1: '22.332' Was not very hard to solve: if

Re: Question Installing latest Python

2015-04-29 Thread Steven D'Aprano
On Wed, 29 Apr 2015 04:57 pm, Φώντας Λαδοπρακόπουλος wrote: > Thank you very much Steven! > > Indeed it worked!! > > One last thing. Can you please explain to me inplain English what exactly > was that weird problem? Probably not. I'm not a C expert and don't really understand in full detail ho

Re: Using + with strings considered bad

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 11:24 CEST schreef Peter Otten: > Cecil Westerhof wrote: > >> Because I try to keep my lines (well) below 80 characters, I use >> the following: print('Calculating fibonacci and fibonacci_memoize >> once for ' + str(large_fibonacci) + ' to determine speed increase') >> >>

str more precise in 3 as 2.7

2015-04-29 Thread Cecil Westerhof
I am trying to make my modules also work under Python 3. I found that str is more precise in Python 3. The expression: str(134 / 6.0) gives in 2.7.8: '22.33' and in 3.4.1: '22.332' Was not very hard to solve: if python_version == 3: output06[5] = '22.333

Re: mac os core dump from detached process

2015-04-29 Thread Robin Becker
On 27/04/2015 11:29, Colin McPhail wrote: ... Is it possible to get core dumps on the Mac for debugging purposes? Would the detached process inherit flags etc etc from the starting process? I know little about OS X/Mach. My first thought would be to run Applications -> Utilities ->

Accessing file from Remote location

2015-04-29 Thread subhabrata . banerji
Dear Group, I have a good amount of data in a remote location. It is in MySql Database. I am trying to access it as, >>> import pymysql >>> import pymysql.cursors ... ... with connection.cursor() as cursor: # Read a single record sql = "SELECT candidateid,cnd.First

Re: Using + with strings considered bad

2015-04-29 Thread Peter Otten
Cecil Westerhof wrote: > Because I try to keep my lines (well) below 80 characters, I use the > following: > print('Calculating fibonacci and fibonacci_memoize once for ' + > str(large_fibonacci) + ' to determine speed increase') > > But I was told that using + with strings was bad

Re: Function decorator having arguments is complicated

2015-04-29 Thread Gregory Ewing
On Monday 27 April 2015 12:37, Makoto Kuwata wrote: def multiply(n): def deco(func): def newfunc(*args, **kwargs): return n * func(*args, **kwargs) return newfunc return deco I'd like to be able to write that as def multiply(n)(func)(*args, **kwargs): return n

Re: Using + with strings considered bad

2015-04-29 Thread Mark Lawrence
On 29/04/2015 09:29, Cecil Westerhof wrote: Because I try to keep my lines (well) below 80 characters, I use the following: print('Calculating fibonacci and fibonacci_memoize once for ' + str(large_fibonacci) + ' to determine speed increase') But I was told that using + with stri

Re: Best GUI for Python

2015-04-29 Thread Mark Lawrence
On 29/04/2015 05:05, Rustom Mody wrote: On Monday, April 27, 2015 at 12:52:48 PM UTC+5:30, Chris Angelico wrote: On Mon, Apr 27, 2015 at 4:55 PM, Christian Gollwitzer wrote: Am 27.04.15 um 01:06 schrieb Chris Angelico: On Mon, Apr 27, 2015 at 6:26 AM, Ben Finney wrote: It doesn't have to.

Using + with strings considered bad

2015-04-29 Thread Cecil Westerhof
Because I try to keep my lines (well) below 80 characters, I use the following: print('Calculating fibonacci and fibonacci_memoize once for ' + str(large_fibonacci) + ' to determine speed increase') But I was told that using + with strings was bad practice. Is this true? If so, what

Re: Wrote a memoize function: I do not mind feedback

2015-04-29 Thread Mark Lawrence
On 29/04/2015 09:04, Cecil Westerhof wrote: Op Wednesday 29 Apr 2015 09:02 CEST schreef Ian Kelly: On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof wrote: Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam: def some_func(arg, _memoize={}): try: return _memoize[arg] except KeyError:

Survey Request for Research related to Software Engineering and Social Media

2015-04-29 Thread agssulis
Hi All, We are a group of researchers interested in knowing how Software Developers can make best use of Social Media in their work. We would be very grateful if you could help us in understanding on what kind of Twitter accounts you would like to follow to help you with Software Development ac

Re: Wrote a memoize function: I do not mind feedback

2015-04-29 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 09:02 CEST schreef Ian Kelly: > On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof wrote: >> Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam: >>> def some_func(arg, _memoize={}): >>> try: >>> return _memoize[arg] >>> except KeyError: >>> result = some_expensive_

Re: Not possible to hide local variables

2015-04-29 Thread Chris Angelico
On Wed, Apr 29, 2015 at 4:25 PM, Cecil Westerhof wrote: > Op Tuesday 28 Apr 2015 10:06 CEST schreef Chris Angelico: >> (note that I'm avoiding the multiple-argument syntax which doesn't >> work in Python 3; > > I already did this with print. Are there other statements I have to > take care for the

Re: Wrote a memoize function: I do not mind feedback

2015-04-29 Thread Ian Kelly
On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof wrote: > Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam: >> def some_func(arg, _memoize={}): >> try: >> return _memoize[arg] >> except KeyError: >> result = some_expensive_operation(arg) >> _memoize[arg] = result >> return result > > Th

Re: Not possible to hide local variables

2015-04-29 Thread Cecil Westerhof
Op Tuesday 28 Apr 2015 10:37 CEST schreef Steven D'Aprano: > On Tuesday 28 April 2015 17:33, Cecil Westerhof wrote: > >> If I remember correctly you can not hide variables of a class or >> make them read-only? > > In Python circles, the preferred terminology for class and instance > members is "at