Re: Throw the cat among the pigeons

2015-05-05 Thread Dave Angel
On 05/05/2015 12:18 PM, Cecil Westerhof wrote: Well, I did not write many tail recursive functions. But what surprised me was that for large values the ‘tail recursive’ version was more efficient as the iterative version. And that was with myself implementing the tail recursion. I expect the

Re: Throw the cat among the pigeons

2015-05-05 Thread Dave Angel
On 05/05/2015 04:30 PM, Ian Kelly wrote: On Tue, May 5, 2015 at 12:45 PM, Dave Angel da...@davea.name wrote: When the simple is True, the function takes noticeably and consistently longer. For example, it might take 116 instead of 109 seconds. For the same counts, your code took 111. I

Re: Bitten by my C/Java experience

2015-05-04 Thread Dave Angel
On 05/04/2015 04:28 PM, Cecil Westerhof wrote: Op Monday 4 May 2015 21:39 CEST schreef Ian Kelly: On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/05/2015 16:20, Cecil Westerhof wrote: Potential dangerous bug introduced by programming in Python as if it

Re: Converting 5.223701009526849e-05 to 5e-05

2015-05-03 Thread Dave Angel
On 05/03/2015 05:22 AM, Cecil Westerhof wrote: Op Sunday 3 May 2015 10:40 CEST schreef Ben Finney: Cecil Westerhof ce...@decebal.nl writes: When I have a value like 5.223701009526849e-05 in most cases I am not interested in all the digest after the dot. What type of value is it? If the

Re: Python is not bad ;-)

2015-05-02 Thread Dave Angel
On 05/02/2015 05:58 AM, Marko Rauhamaa wrote: Chris Angelico ros...@gmail.com: Guido is against anything that disrupts tracebacks, and optimizing tail recursion while maintaining traceback integrity is rather harder. Tail recursion could be suppressed during debugging. Optimized code can

Re: Python is not bad ;-)

2015-05-02 Thread Dave Angel
On 05/02/2015 05:33 AM, Cecil Westerhof wrote: Please check your email settings. Your messages that you type seem to be indented properly, but those that are quoting earlier messages (even your own) are not. See below. I suspect there's some problem with how your email program processes

Re: Custom alphabetical sort

2015-05-02 Thread Dave Angel
On 05/02/2015 11:35 AM, Pander Musubi wrote: On Monday, 24 December 2012 16:32:56 UTC+1, Pander Musubi wrote: Hi all, I would like to sort according to this order: (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å',

Re: Let exception fire or return None

2015-04-30 Thread Dave Angel
On 04/30/2015 03:43 AM, Cecil Westerhof wrote: I have a function to fetch a message from a file: def get_indexed_message(message_filename, index): Get index message from a file, where 0 gets the first message return open(expanduser(message_filename),

Re: seek operation in python

2015-04-30 Thread Dave Angel
On 04/30/2015 04:06 AM, Cecil Westerhof wrote: Op Thursday 30 Apr 2015 09:33 CEST schreef Chris Angelico: On Thu, Apr 30, 2015 at 4:27 PM, Cecil Westerhof ce...@decebal.nl wrote: with open(input.cpp) as f: lines = f.readlines() print(lines[7]) Is the following not better:

Re: Is my implementation of happy number OK

2015-04-30 Thread Dave Angel
On 04/30/2015 11:59 AM, Cecil Westerhof wrote: I implemented happy_number function: _happy_set = { '1' } _unhappy_set= set() def happy_number(n): Check if a number is a happy number https://en.wikipedia.org/wiki/Happy_number

Re: l = range(int(1E9))

2015-04-30 Thread Dave Angel
On 04/30/2015 02:48 PM, alister wrote: On Thu, 30 Apr 2015 20:23:31 +0200, Gisle Vanem wrote: Cecil Westerhof wrote: If I execute: l = range(int(1E9) The python process gobbles up all the memory and is killed. The problem is that after this my swap is completely used, because other

Re: Lucky numbers in Python

2015-04-30 Thread Dave Angel
On 04/30/2015 02:55 PM, Cecil Westerhof wrote: Because I want the code to work with Python 3 also, the code is now: def lucky_numbers(n): Lucky numbers from 1 up-to n http://en.wikipedia.org/wiki/Lucky_number if n 3: return [1]

Re: Is my implementation of happy number OK

2015-04-30 Thread Dave Angel
On 04/30/2015 04:35 PM, Cecil Westerhof wrote: Op Thursday 30 Apr 2015 20:53 CEST schreef Dave Angel: Finally, I did some testing on Jon Ribben's version. His was substantially faster for smaller sets, and about the same for 10*7. So it's likely it'll be slower than yours and mine for 10**8

Re: Rounding a number

2015-04-30 Thread Dave Angel
On 04/30/2015 06:35 PM, Seymore4Head wrote: On Thu, 30 Apr 2015 22:00:17 +0200, Thijs Engels th...@buckazoids.com wrote: round(65253, -3) might be what you are looking for... On Thu, Apr 30, 2015, at 21:49, Seymore4Head wrote: I have this page book marked.

Re: Is my implementation of happy number OK

2015-04-30 Thread Dave Angel
On 04/30/2015 07:31 PM, Jon Ribbens wrote: On 2015-04-30, Dave Angel da...@davea.name wrote: Finally, I did some testing on Jon Ribben's version. His was substantially faster for smaller sets, and about the same for 10*7. So it's likely it'll be slower than yours and mine for 10**8. You

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

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 ce...@decebal.nl 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

Re: Best GUI for Python

2015-04-28 Thread Dave Cook
Python binding is somewhat an advantage. I've gone back and forth between them, and could probably live with either one. Gtk is also worth looking at if you only care about Linux. Dave Cook -- https://mail.python.org/mailman/listinfo/python-list

Re: Best GUI for Python

2015-04-28 Thread Dave Farrance
Christian Gollwitzer aurio...@gmx.de wrote: Yes, the default theme is terrible on Linux (Mac Windows uses native widgets). There are additional themes available, which are buried in some packages and a bit difficult to install, but give reasonable approximations to the QT look; I'm talking

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Dave Farrance
Mario Figueiredo mar...@gmail.com wrote: Other than replacing the random module with the probability density function for the exponential distribution, do you have a suggestion of how I could smooth the curve? Moving average. Try: def movingaverage(interval, window_size): window=

Re: can you help guys?

2015-04-24 Thread Dave Angel
On 04/24/2015 04:29 AM, brokolists wrote: 24 Nisan 2015 Cuma 02:20:12 UTC+3 tarihinde Steven D'Aprano yazdı: On Fri, 24 Apr 2015 01:51 am, brokolists wrote: my problem is i m working with very long float numbers and i use numberx =float(( input( 'enter the number\n '))) after i use this

Re: Panda data read_csv returns 'TextFileReader' object

2015-04-24 Thread Dave Angel
On 04/24/2015 04:04 PM, Kurt wrote: Isn't the call pd.read_csv(filepath,...) suppose to return a dataframe, not this other object? I keep getting the following error when I try to view the attribute head. AttributeError: 'TextFileReader' object has no attribute 'head' I reference pandas as

Re: A question on the creation of list of lists

2015-04-23 Thread Dave Angel
On 04/23/2015 08:36 AM, Gregory Ewing wrote: Jean-Michel Pichavant wrote: From: subhabrata banerji subhabrata.bane...@gmail.com list_of_files = glob.glob('C:\Python27\*.*') 1/ Your file pattern search will not get files that do not have any dot in their name Actually, on Windows, it

Re: May I drop list bracket from list?

2015-04-23 Thread Dave Angel
On 04/23/2015 06:11 AM, subhabrata.bane...@gmail.com wrote: Dear Group, I am trying to read a list of files as list_of_files = glob.glob('C:\Python27\*.*') Now I am trying to read each one of them, convert into list of words, and append to a list as. list1=[] for file in list_of_files:

Re: Python as shell

2015-04-22 Thread Dave Farrance
Cecil Westerhof ce...@decebal.nl wrote: I am working again with Python and I am impressed again. ;-) I thought there was a Python shell that could be used instead of Bash (or whichever shell you are using), but I can not find anything about it. Am I wrong, or are my search engine skills so bad?

Re: Diff between object graphs?

2015-04-22 Thread Dave Angel
On 04/22/2015 09:30 PM, Cem Karan wrote: On Apr 22, 2015, at 8:53 AM, Peter Otten __pete...@web.de wrote: Another slightly more involved idea: Make the events pickleable, and save the simulator only for every 100th (for example) event. To restore the 7531th state load pickle 7500 and apply

Re: Diff between object graphs?

2015-04-22 Thread Dave Angel
On 04/22/2015 09:46 PM, Chris Angelico wrote: On Thu, Apr 23, 2015 at 11:37 AM, Dave Angel da...@davea.name wrote: On 04/22/2015 09:30 PM, Cem Karan wrote: On Apr 22, 2015, at 8:53 AM, Peter Otten __pete...@web.de wrote: Another slightly more involved idea: Make the events pickleable

Re: Opening Multiple files at one time

2015-04-21 Thread Dave Angel
On 04/21/2015 03:56 AM, subhabrata.bane...@gmail.com wrote: Yes. They do not. They are opening one by one. I have some big chunk of data I am getting by crawling etc. now as I run the code it is fetching data. I am trying to fetch the data from various sites. The contents of the file are

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-21 Thread Dave Angel
On 04/20/2015 10:14 PM, Paulo da Silva wrote: I have program that generates about 100 relatively complex graphics and writes then to a pdf book. It takes a while! Is there any possibility of using multiprocessing to build the graphics and then use several calls to savefig(), i.e. some kind of

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-21 Thread Dave Angel
On 04/21/2015 07:54 PM, Dennis Lee Bieber wrote: On Tue, 21 Apr 2015 18:12:53 +0100, Paulo da Silva p_s_d_a_s_i_l_v_a...@netcabo.pt declaimed the following: Yes. fork will do that. I have just looked at it and it is the same as unix fork (module os). I am thinking of launching several forks

Re: Opening Multiple files at one time

2015-04-20 Thread Dave Angel
On 04/20/2015 07:59 AM, subhabrata.bane...@gmail.com wrote: Dear Group, I am trying to open multiple files at one time. I am trying to do it as, for item in [ one, two, three ]: f = open (item + world.txt, w) f.close() This is fine. But it does not open multiple files at

Re: Python and lotus notes

2015-04-20 Thread Dave Angel
On 04/20/2015 04:29 AM, gianluca.pu...@gmail.com wrote: Hi, Hi and welcome. I don't know Lotus Notes, but i can at least comment on some of your code, pointing out at least some problems. i am having a problem when i try to access lotus notes with python, think i do all ok but it seems

Re: Problem running Python 2.7 on Ubuntu 10.04

2015-04-20 Thread Dave Farrance
David Aldrich david.aldr...@emea.nec.com wrote: Hi I wonder if someone could help me with this problem please? On an Ubuntu 10.04 platform, I want to run the latest version of Meld, which is a Python program. Ubuntu 10.04 runs Python 2.6 as standard. Meld requires Python 2.7. So I have

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Dave Angel
On 04/19/2015 07:38 AM, BartC wrote: Perhaps you don't understand what I'm getting at. Suppose there were just two syntaxes: C-like and Python-like (we'll put aside for a minute the question of what format is used to store Python source code). Why shouldn't A configure his editor to

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Dave Angel
On 04/19/2015 09:02 AM, Steven D'Aprano wrote: On Sun, 19 Apr 2015 04:08 am, Albert van der Horst wrote: Fire up a lowlevel interpreter like Forth. (e.g. gforth) Yay! I'm not the only one who uses or likes Forth! Have you tried Factor? I'm wondering if it is worth looking at, as a more

Re: Python and fortran Interface suggestion

2015-04-19 Thread Dave Angel
On 04/19/2015 11:56 AM, pauld11718 wrote: I shall provide with further details Its about Mathematical modelling of a system. Fortran does one part and python does the other part (which I am suppose to provide). For a time interval tn -- t_n+1, fortran code generates some values, for which

Re: do you guys help newbies??

2015-04-19 Thread Dave Angel
On 04/19/2015 09:37 PM, josiah.l...@stu.nebo.edu wrote: On Wednesday, November 27, 2002 at 4:01:02 AM UTC-7, John Hunter wrote: malik == malik martin malik_mar...@hotmail.com writes: maliki'm having a simple problem i guess. but i still dont malik know the answer. anyone see

Re: HELP! How to return the returned value from a threaded function

2015-04-18 Thread Dave Angel
On 04/18/2015 01:07 PM, D. Xenakis wrote: Maybe this is pretty simple but seems I am stuck... def message_function(): return HelloWorld! def thread_maker(): call message_function() using a new thread and return it's HelloWorld! pass Could someone please

Re: Converting text file to different encoding.

2015-04-17 Thread Dave Angel
On 04/17/2015 09:19 AM, subhabrata.bane...@gmail.com wrote: I am having few files in default encoding. I wanted to change their encodings, preferably in UTF-8, or may be from one encoding to any other encoding. You neglected to specify what Python version this is for. Other information

Re: Converting text file to different encoding.

2015-04-17 Thread Dave Angel
On 04/17/2015 10:48 AM, Dave Angel wrote: On 04/17/2015 09:19 AM, subhabrata.bane...@gmail.com wrote: target = open(target, w) It's not usually a good idea to use the same variable for both the file name and the opened file object. What if you need later to print the name

[issue6818] remove/delete method for zipfile/tarfile objects

2015-04-17 Thread Dave Sawyer
Dave Sawyer added the comment: Maybe it takes a little longer than a week. I have a final signed agreement from Ewa (https://secure.echosign.com/public/viewAgreement?aid=X88L4EVP5IXC289eid=X88M6DGQ93J5K38;) signed on 04/17/2014 6:48 PM Wow, exactly one year ago

Re: Failed to import a pyd: File When python intepreter embed in C++ project

2015-04-17 Thread Dave Angel
On 04/17/2015 01:17 PM, saadaouijihed1...@gmail.com wrote: I have a swig module (.pyd).I followed the steps but it doesn't work please help me. First, unplug the computer and remove the battery. Then if it's still burning, douse it with a fire extinguisher. If your symptoms are different,

[issue6818] remove/delete method for zipfile/tarfile objects

2015-04-15 Thread Dave Sawyer
Dave Sawyer added the comment: The zipfile way to delete or rename would be to just change the index. It really doesn't want to be re-written as it is designed to span disks. Many old versions of files can be scattered within the zip. In addition self-extracting zip files will have executable

[issue6818] remove/delete method for zipfile/tarfile objects

2015-04-15 Thread Dave Sawyer
Dave Sawyer added the comment: I can add some more tests to bring up the coverage, but wanted to get reviewer opinion on the direction of this before doing more work. -- hgrepos: +305 Added file: http://bugs.python.org/file39063/zipfile_filter.patch

Re: ctypes: using .value or .value() doesn't work for c_long

2015-04-15 Thread Dave Angel
On 04/15/2015 03:48 PM, IronManMark20 wrote: I am using ctypes to call a few windll funcions. One of them returns a c_long object. I want to know what number the function returns. Problem is, when I try foo.value , it gives me this: AttributeError: LP_c_long object has no attribute value.

Re: Is there functions like the luaL_loadfile and luaL_loadbuffer in lua source to dump the lua scripts in Python's source?

2015-04-14 Thread Dave Angel
On 04/14/2015 08:07 AM, zhihao chen wrote: HI,I want to dump the python script when some application(android's app) use the python engine.they embedding python into its app. https://docs.python.org/2/extending/embedding.html I can dump the script from an app which use the lua engine through

Re: Excluding a few pawns from the game

2015-04-13 Thread Dave Angel
On 04/13/2015 07:30 AM, userque...@gmail.com wrote: I am writing a function in python, where the function excludes a list of pawns from the game. The condition for excluding the pawns is whether the pawn is listed in the database DBPawnBoardChart. Here is my code: def

Re: Pickle based workflow - looking for advice

2015-04-13 Thread Dave Angel
On 04/13/2015 10:58 AM, Fabien wrote: Folks, A comment. Pickle is a method of creating persistent data, most commonly used to preserve data between runs. A database is another method. Although either one can also be used with multiprocessing, you seem to be worrying more about the

Re: find all multiplicands and multipliers for a number

2015-04-12 Thread Dave Angel
On 04/13/2015 01:25 AM, Paul Rubin wrote: Dave Angel da...@davea.name writes: But doesn't math.pow return a float?... Or were you saying bignums bigger than a float can represent at all? Like: x = 2**1 -1 ... math.log2(x) 1.0 Yes, exactly that. Well that value x has some 3300

Re: find all multiplicands and multipliers for a number

2015-04-12 Thread Dave Angel
On 04/12/2015 09:56 PM, Paul Rubin wrote: Marko Rauhamaa ma...@pacujo.net writes: And in fact, the sqrt optimization now makes the original version 20% faster: ... bound = int(math.sqrt(n)) That could conceivably fail because of floating point roundoff or overflow, e.g. fac(3**1000). A

Re: find all multiplicands and multipliers for a number

2015-04-12 Thread Dave Angel
On 04/12/2015 11:30 PM, Paul Rubin wrote: Dave Angel da...@davea.name writes: If I were trying to get a bound for stopping the divide operation, on a value too large to do exact real representation, I'd try doing just a few iterations of Newton's method. Python ninja trick: math.log works

Re: installing error in python

2015-04-12 Thread Dave Angel
On 04/13/2015 01:38 AM, Mahima Goyal wrote: error of corrupted file or directory is coming if i am installing python for 64 bit. And what OS is that on, and how long has it been since you've done a file system check on the drive? For that matter, what version of Python are you installing,

Re: find all multiplicands and multipliers for a number

2015-04-11 Thread Dave Farrance
$ python2 Python 2.7.8 (default, Oct 20 2014, 15:05:19) [GCC 4.9.1] on linux2 Type help, copyright, credits or license for more information. a = 256 b = 256 a is b True a = 257 b = 257 a is b False It's not safe to use 'is' to compare integers. Use == --

Re: try..except with empty exceptions

2015-04-11 Thread Dave Angel
On 04/11/2015 03:11 AM, Steven D'Aprano wrote: On Sat, 11 Apr 2015 12:23 pm, Dave Angel wrote: On 04/10/2015 09:42 PM, Steven D'Aprano wrote: On Sat, 11 Apr 2015 05:31 am, sohcahto...@gmail.com wrote: It isn't document because it is expected. Why would the exception get caught if you're

Re: try..except with empty exceptions

2015-04-11 Thread Dave Angel
On 04/11/2015 06:14 AM, Dave Angel wrote: On 04/11/2015 03:11 AM, Steven D'Aprano wrote: On Sat, 11 Apr 2015 12:23 pm, Dave Angel wrote: On 04/10/2015 09:42 PM, Steven D'Aprano wrote: On Sat, 11 Apr 2015 05:31 am, sohcahto...@gmail.com wrote: It isn't document because it is expected. Why

Re: try..except with empty exceptions

2015-04-10 Thread Dave Angel
On 04/10/2015 10:38 PM, Rustom Mody wrote: On Saturday, April 11, 2015 at 7:53:31 AM UTC+5:30, Dave Angel wrote: On 04/10/2015 09:42 PM, Steven D'Aprano wrote: On Sat, 11 Apr 2015 05:31 am, sohcahtoa82 wrote: It isn't document because it is expected. Why would the exception get caught

Re: try..except with empty exceptions

2015-04-10 Thread Dave Angel
On 04/10/2015 04:48 AM, Pavel S wrote: Hi, I noticed interesting behaviour. Since I don't have python3 installation here, I tested that on Python 2.7. Well known feature is that try..except block can catch multiple exceptions listed in a tuple: exceptions = ( TypeError, ValueError ) try:

Re: find all multiplicands and multipliers for a number

2015-04-10 Thread Dave Angel
On 04/10/2015 07:37 PM, ravas wrote: def m_and_m(dividend): rlist = [] dm = divmod end = (dividend // 2) + 1 for divisor in range(1, end): q, r = dm(dividend, divisor) if r is 0: rlist.append((divisor, q)) return rlist print(m_and_m(999))

Re: find all multiplicands and multipliers for a number

2015-04-10 Thread Dave Angel
On 04/10/2015 09:06 PM, Dave Angel wrote: On 04/10/2015 07:37 PM, ravas wrote: def m_and_m(dividend): rlist = [] dm = divmod end = (dividend // 2) + 1 for divisor in range(1, end): q, r = dm(dividend, divisor) if r is 0: rlist.append((divisor

Re: try..except with empty exceptions

2015-04-10 Thread Dave Angel
On 04/10/2015 09:42 PM, Steven D'Aprano wrote: On Sat, 11 Apr 2015 05:31 am, sohcahto...@gmail.com wrote: It isn't document because it is expected. Why would the exception get caught if you're not writing code to catch it? If you write a function and pass it a tuple of exceptions to catch,

Re: Best search algorithm to find condition within a range

2015-04-09 Thread Dave Angel
On 04/09/2015 08:56 AM, Alain Ketterlin wrote: Marko Rauhamaa ma...@pacujo.net writes: Alain Ketterlin al...@dpt-info.u-strasbg.fr: No, it would not work for signed integers (i.e., with lo and hi of int64_t type), because overflow is undefined behavior for signed. All architectures I've

Re: python implementation of a new integer encoding algorithm.

2015-04-09 Thread Dave Angel
On 04/09/2015 05:33 AM, janhein.vanderb...@gmail.com wrote: Op donderdag 19 februari 2015 19:25:14 UTC+1 schreef Dave Angel: I wrote the following pair of functions: snip Here's a couple of ranges of output, showing that the 7bit scheme does better for values between 384 and 16379

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Dave Angel
On 04/07/2015 10:10 AM, jonas.thornv...@gmail.com wrote: Den tisdag 7 april 2015 kl. 15:30:36 UTC+2 skrev Dave Angel: snip If that code were in Python, I could be more motivated to critique it. The whole algorithm could be much simpler. But perhaps there is some limitation of javascript

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Dave Angel
On 04/07/2015 05:44 AM, jonas.thornv...@gmail.com wrote: I want todo faster baseconversion for very big bases like base 1 000 000, so instead of adding up digits i search it. For this and most of the following statements: I can almost guess what you're trying to say. However, I cannot.

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Dave Angel
On 04/07/2015 10:36 AM, jonas.thornv...@gmail.com wrote: All operations on integers addition, subtraction, multiplication and division assume base 10. There have been machines where that was true, but I haven't worked on such for about 30 years. On any machines I've programmed lately,

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Dave Angel
On 04/07/2015 11:05 AM, Grant Edwards wrote: On 2015-04-07, Chris Angelico ros...@gmail.com wrote: On Wed, Apr 8, 2015 at 12:36 AM, jonas.thornv...@gmail.com wrote: Integers are internally assumed to be base 10 otherwise you could not calculate without giving the base. All operations on

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Dave Angel
On 04/07/2015 11:40 AM, jonas.thornv...@gmail.com wrote: Den tisdag 7 april 2015 kl. 16:32:56 UTC+2 skrev Ian: On Tue, Apr 7, 2015 at 3:44 AM, jonas.thornv...@gmail.com wrote: I want todo faster baseconversion for very big bases like base 1 000 000, so instead of adding up digits i search

Re: Euler module under python 2.7 and 3.4 instalation...

2015-04-07 Thread Dave Angel
On 04/07/2015 11:39 AM, blue wrote: Dear friends . I want to install Euler module under python 2.7 and / or 3.4 version. I try pip and pip 3.4 but seam not working for me. I need some help with this . Thank you . Regards. You don't specify what you mean by Euler. There are at least 3 things

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Dave Angel
On 04/07/2015 06:35 PM, jonas.thornv...@gmail.com wrote: Den tisdag 7 april 2015 kl. 21:27:20 UTC+2 skrev Ben Bacarisse: Ian Kelly ian.g.ke...@gmail.com writes: On Tue, Apr 7, 2015 at 12:55 PM, Terry Reedy tjre...@udel.edu wrote: On 4/7/2015 1:44 PM, Ian Kelly wrote: def to_base(number,

Re: Is it possible to deliver different source distributions for different Python versions?

2015-04-06 Thread Dave Hein
On Monday, April 6, 2015 at 12:47:05 AM UTC-5, Stefan Behnel wrote: Dave Hein schrieb am 05.04.2015 um 22:38: I would like to distribute a python package with different code for Python 2.* than for Python 3.*. (Mostly this is because of different unicode string handling

Re: pypi submission?

2015-04-06 Thread Dave Hein
the --pre option tells pip you actually do want the pre-release version. So: pip install --pre directory-caching [snip] - Benjamin -- Dave Hein -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to deliver different source distributions for different Python versions?

2015-04-06 Thread Dave Hein
On Sunday, April 5, 2015 at 10:28:55 PM UTC-5, Mark Lawrence wrote: On 05/04/2015 21:38, Dave Hein wrote: I would like to distribute a python package with different code for Python 2.* than for Python 3.*. (Mostly this is because of different unicode string handling). There is nothing

Re: Is it possible to deliver different source distributions for different Python versions?

2015-04-06 Thread Dave Hein
On Sunday, April 5, 2015 at 8:01:22 PM UTC-5, Steven D'Aprano wrote: On Mon, 6 Apr 2015 06:38 am, Dave Hein wrote: I would like to distribute a python package with different code for Python 2.* than for Python 3.*. (Mostly this is because of different unicode string handling

Re: Permission denied when opening a file that was created concurrently by os.rename (Windows)

2015-04-05 Thread Dave Angel
On 04/05/2015 01:45 PM, Alexey Izbyshev wrote: Hello! I've hit a strange problem that I reduced to the following test case: * Run several python processes in parallel that spin in the following loop: while True: if os.path.isfile(fname): with open(fname, 'rb') as f: f.read()

Is it possible to deliver different source distributions for different Python versions?

2015-04-05 Thread Dave Hein
location. Is that at all possible? Is there some install time hook that lets me supply custom installation code? -- Dave Hein -- https://mail.python.org/mailman/listinfo/python-list

Re: Strategy/ Advice for How to Best Attack this Problem?

2015-04-03 Thread Dave Angel
On 04/02/2015 07:43 PM, Saran A wrote: snip I debugged and rewrote everything. Here is the full version. Feel free to tear this apart. The homework assignment is not due until tomorrow, so I am currently also experimenting with pyinotify as well. I do have questions regarding how to make

Re: New to Programming: Adding custom functions with ipynotify classes

2015-04-03 Thread Dave Angel
On 04/03/2015 07:37 AM, Steven D'Aprano wrote: On Fri, 3 Apr 2015 12:30 pm, Saran A wrote: #This helper function returns the length of the file def file_len(f): with open(f) as f: for i, l in enumerate(f): pass return i + 1 Not as given it doesn't. It

Re: Strategy/ Advice for How to Best Attack this Problem?

2015-04-03 Thread Dave Angel
On 04/03/2015 08:50 AM, Saran A wrote: On Friday, April 3, 2015 at 8:05:14 AM UTC-4, Dave Angel wrote: On 04/02/2015 07:43 PM, Saran A wrote: I addressed most of the issues. I do admit that, as a novice, I feel beholden to the computer - hence the over-engineering. Should be quite

Re: Strategy/ Advice for How to Best Attack this Problem?

2015-04-02 Thread Dave Angel
On 04/02/2015 09:06 AM, Saran A wrote: Thanks for your help on this homework assignment. I started from scratch last night. I have added some comments that will perhaps help clarify my intentions and my thought process. Thanks again. from __future__ import print_function I'll just

Re: Strategy/ Advice for How to Best Attack this Problem?

2015-04-01 Thread Dave Angel
On 04/01/2015 09:43 AM, Saran A wrote: On Tuesday, March 31, 2015 at 9:19:37 AM UTC-4, Dave Angel wrote: On 03/31/2015 07:00 AM, Saran A wrote: @DaveA: This is a homework assignment. Is it possible that you could provide me with some snippets or guidance on where to place your

Re: Strategy/ Advice for How to Best Attack this Problem?

2015-03-31 Thread Dave Angel
On 03/31/2015 07:00 AM, Saran A wrote: @DaveA: This is a homework assignment. Is it possible that you could provide me with some snippets or guidance on where to place your suggestions (for your TO DOs 2,3,4,5)? On Monday, March 30, 2015 at 2:36:02 PM UTC-4, Dave Angel wrote

Re: generator/coroutine terminology

2015-03-31 Thread Dave Angel
On 03/31/2015 09:18 AM, Albert van der Horst wrote: In article 55062bda$0$12998$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The biggest difference is syntactic. Here's an iterator which returns a never-ending sequence of squared numbers 1,

Re: Sudoku solver

2015-03-30 Thread Dave Angel
On 03/30/2015 03:29 AM, Ian Kelly wrote: On Mon, Mar 30, 2015 at 1:13 AM, Christian Gollwitzer aurio...@gmx.de wrote: Am 30.03.15 um 08:50 schrieb Ian Kelly: On Sun, Mar 29, 2015 at 12:03 PM, Marko Rauhamaa ma...@pacujo.net wrote: Be careful with the benchmark comparisons. Ian's example can

Re: Strategy/ Advice for How to Best Attack this Problem?

2015-03-30 Thread Dave Angel
for getting files out of a VM automatically: http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html https://github.com/Rosuav/shed/blob/master/senddir.py ChrisA @Dave, Chris, Paul and Dennis: Thank you for resources and the notes regarding what I should keep in mind. I

Re: Addendum to Strategy/ Advice for How to Best Attack this Problem?

2015-03-29 Thread Dave Angel
On 03/29/2015 07:37 AM, Saran Ahluwalia wrote: On Sunday, March 29, 2015 at 7:33:04 AM UTC-4, Saran Ahluwalia wrote: Below are the function's requirements. I am torn between using the OS module or some other quick and dirty module. In addition, my ideal assumption that this could be

Re: Supply condition in function call

2015-03-27 Thread Dave Angel
On 03/26/2015 09:41 PM, Rustom Mody wrote: On Thursday, March 26, 2015 at 11:30:57 AM UTC+5:30, Chris Angelico wrote: Python 3.5.0a0 (default:4709290253e3, Jan 20 2015, 21:48:07) [GCC 4.7.2] on linux class filter(object) | filter(function or None, iterable) -- filter object | |

Re: Sudoku solver

2015-03-27 Thread Dave Angel
On 03/27/2015 09:35 AM, Frank Millman wrote: Dave Angel da...@davea.name wrote in message news:551557b3.5090...@davea.name... But now I have to disagree about true Sudoku puzzle. As we said earlier, it might make sense to say that puzzles that cannot be solved that way are not reasonable

Re: Sudoku solver

2015-03-27 Thread Dave Angel
On 03/27/2015 05:25 AM, Chris Angelico wrote: On Fri, Mar 27, 2015 at 8:07 PM, Frank Millman fr...@chagford.com wrote: There seems to be disagreement over the use of the term 'trial and error'. How about this for a revised wording - It should be possible to reach that solution by a sequence of

Re: Sudoku solver

2015-03-27 Thread Dave Angel
On 03/27/2015 09:25 AM, Chris Angelico wrote: On Sat, Mar 28, 2015 at 12:14 AM, Dave Angel da...@davea.name wrote: But now I have to disagree about true Sudoku puzzle. As we said earlier, it might make sense to say that puzzles that cannot be solved that way are not reasonable ones to put

Re: Sudoku solver

2015-03-27 Thread Dave Angel
On 03/27/2015 09:56 AM, Marko Rauhamaa wrote: Frank Millman fr...@chagford.com: So what I am talking about is called a satisfactory puzzle, which is a subset of a proper puzzle. That is impossible to define, though, because some people are mental acrobats and can do a lot of deep analysis in

Re: Basic Python V3 Search Tool using RE module

2015-03-26 Thread Dave Angel
On 03/26/2015 01:11 PM, Gregg Dotoli wrote: On Wednesday, March 25, 2015 at 3:43:38 PM UTC-4, Gregg Dotoli wrote: This basic script will help to find evidence of CryptoWall on a slave drive. Although it is just a string, more complex regex patterns can be replaced with the string. It is

Re: Sudoku solver

2015-03-26 Thread Dave Angel
On 03/26/2015 10:41 AM, Chris Angelico wrote: that's already been proven. So, that's why I would avoid guessing. I've written a lot of solvers for various puzzles. Minesweeper, Sudoku, a binary Sudoku-like puzzle that I don't really have a good name for, several others. Every time, I've tried

Re: Sudoku solver

2015-03-26 Thread Dave Angel
On 03/26/2015 08:37 AM, Chris Angelico wrote: On Thu, Mar 26, 2015 at 11:26 PM, Marko Rauhamaa ma...@pacujo.net wrote: Frank Millman fr...@chagford.com: Here is another python-based sudoku solver - http://www.ics.uci.edu/~eppstein/PADS/Sudoku.py From its docstring - A proper Sudoku puzzle

Re: Newbie looking for elegant solution

2015-03-25 Thread Dave Farrance
otaksoftspamt...@gmail.com wrote: I have a list containing 9600 integer elements - each integer is either 0 or 1. Starting at the front of the list, I need to combine 8 list elements into 1 by treating them as if they were bits of one byte with 1 and 0 denoting bit on/off (the 8th element would

Re: Basic Python V3 Search Tool using RE module

2015-03-25 Thread Dave Angel
On 03/25/2015 03:43 PM, Gregg Dotoli wrote: This basic script will help to find evidence of CryptoWall on a slave drive. Although it is just a string, more complex regex patterns can be replaced with the string. It is incredible how fast Python is and how easy it has helped in quickly assessing

Re: A simple single line, triple-quoted comment is giving syntax error. Why?

2015-03-25 Thread Dave Angel
On 03/26/2015 01:09 AM, Ian Kelly wrote: https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation What the grammar that you quoted from shows is that STRING+ is an expression. The individual STRINGs of a STRING+ are not expressions, except to the extent that

Re: fibonacci series what Iam is missing ?

2015-03-24 Thread Dave Angel
On 03/23/2015 08:27 PM, Chris Angelico wrote: On Tue, Mar 24, 2015 at 11:09 AM, Dave Angel d...@davea.name wrote: Repeat to self: comment first, then write test, then write the code. Reply to self: Maybe next time. Commenting is like dieting. You can always start tomorrow. It reminds me

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 12:01 PM, Ganesh Pal wrote: Hello team , [root@localhost Python]# cat fibonacci-Sequence-3.py ## Example 2: Using recursion def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2) print fib(5) # python

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 12:16 PM, Chris Angelico wrote: On Tue, Mar 24, 2015 at 3:01 AM, Ganesh Pal ganesh1...@gmail.com wrote: Hello team , [root@localhost Python]# cat fibonacci-Sequence-3.py ## Example 2: Using recursion def fib(n): if n == 0: return 0 elif n == 1:

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 12:59 PM, Chris Angelico wrote: On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel da...@davea.name wrote: An entirely separate question is whether you can gain performance by caching intermediate values. For example, if you capture values in a list, you could potentially save a lot

<    1   2   3   4   5   6   7   8   9   10   >