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 respons

Re: Processing large CSV files - how to maximise throughput?

2013-10-24 Thread Dave Angel
On 24/10/2013 21:38, Victor Hooi wrote: > Hi, > > We have a directory of large CSV files that we'd like to process in Python. > > We process each input CSV, then generate a corresponding output CSV file. > > input CSV -> munging text, lookups etc. -> output CSV > > My question is, what's the most

Re: Processing large CSV files - how to maximise throughput?

2013-10-24 Thread Dave Angel
On 24/10/2013 23:35, Steven D'Aprano wrote: > On Fri, 25 Oct 2013 02:10:07 +0000, Dave Angel wrote: > >>> If I have multiple large CSV files to deal with, and I'm on a >>> multi-core machine, is there anything else I can do to boost >>> throughput?

Re: Processing large CSV files - how to maximise throughput?

2013-10-25 Thread Dave Angel
On 25/10/2013 02:13, Chris Angelico wrote: > On Fri, Oct 25, 2013 at 2:57 PM, Dave Angel wrote: >> But I would concur -- probably they'll both give about the same speedup. >> I just detest the pain that multithreading can bring, and tend to avoid >> it if at all po

Re: Printing a drop down menu for a specific field.

2013-10-27 Thread Dave Angel
On 27/10/2013 03:31, Nick the Gr33k wrote: > Στις 27/10/2013 6:00 πμ, ο/η ru...@yahoo.com έγραψε: > > I read it thoroughly and tested it and it works as it should. > > I just wanted to mention that the definition of the function coalesce() > must come prior of: > >> newdata = coal

Re: Running Python programmes

2013-10-28 Thread Dave Angel
On 27/10/2013 11:31, Colin J. Williams wrote: > On 27/10/2013 10:32 AM, David wrote: >> I am an absolute beginner and am working through the book Python Programming >> for the Absolute Beginner by Michael Dawson. Everything is fine except if I >> run a scripted programme, or one I have download

Re: Help with guessing game :D

2013-10-29 Thread Dave Angel
On 29/10/2013 14:05, Robert Gonda wrote: & >> Back to question, name is also not working, I currently have python 3.3.2 and the only to get that work is the write raw_input, I have no idea why, did i do soemthing wrong? Why did you add those two >> symbols in front of your new text? Each such

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Dave Angel
On 29/10/2013 14:35, jonas.thornv...@gmail.com wrote: (Deleting hundreds of quad-spaced garbage. Please be more considerate of others if you choose to use buggy googlegroups, maybe starting by studying: ) Please indent by 4 columns, not 1. Since indentation is how scope is specified in Python,

Re: Help with guessing game :D

2013-10-29 Thread Dave Angel
On 29/10/2013 15:15, Robert Gonda wrote: (once again deleting all the double-spaced Googlegroups nonsense) > && >>Hi dave, yes you was right. I had python 2.7 but I upgraded to python 3 now, thanks for help :) by the way, is this showing normally? No, you're still adding a ">" character before t

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Dave Angel
On 29/10/2013 16:11, jonas.thornv...@gmail.com wrote: > Den tisdagen den 29:e oktober 2013 kl. 21:08:39 UTC+1 skrev > jonas.t...@gmail.com: >> Den tisdagen den 29:e oktober 2013 kl. 20:24:57 UTC+1 skrev Dave Angel: > > They could had used print and prinln from basic? I do

Re: personal library

2013-10-29 Thread Dave Angel
On 29/10/2013 17:29, patrick vrijlandt wrote: > Hello list, > > Python has been a hobby for me since version 1.5.2. Over the years I > accumulated quite a lot of reusable code. It is nicely organised in > modules, directories and subdirectories. With every project, the library > grows and is devel

RE: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Dave Angel
On 29/10/2013 21:42, Joseph L. Casale wrote: You forgot the attribution line: "Victor says" >> with open(self.full_path, 'r') as input, open(self.output_csv, 'ab') as >> output: >> fieldnames = (...) >> csv_writer = DictWriter(output, filednames) >> # Call csv_writer.w

Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread Dave Angel
On 30/10/2013 12:31, jonas.thornv...@gmail.com wrote: > > No that is not my problem, apparently so it is that the newsreader > constructors do not like the competition of Google groups otherwise they > would had written the five lines of codes necessary to remove the empty > linebreaks. > I li

Re: Algorithm that makes maximum compression of completly diffused data.

2013-10-30 Thread Dave Angel
On 30/10/2013 14:21, jonas.thornv...@gmail.com wrote: > I am searching for the program or algorithm that makes the best possible of > completly (diffused data/random noise) and wonder what the state of art > compression is. > > I understand this is not the correct forum but since i think i have

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Dave Angel
On Mon, 4 Nov 2013 05:53:28 -0800 (PST), jonas.thornv...@gmail.com wrote: Den lördagen den 2:e november 2013 kl. 22:31:09 UTC+1 skrev Tim Roberts: > Here's another way to look at it. If f(x) is smaller than x for every x, > that means there MUST me multiple values of x that produce the

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Dave Angel
On Mon, 4 Nov 2013 14:34:23 -0800 (PST), jonas.thornv...@gmail.com wrote: e is an approximation... and your idea is not general for any n. e is certainly not an approximation, and I never mentioned n. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 11:34:53 +0200, Nick the Gr33k wrote: I see, but because of the traceback not being to express it more easily i was under the impression that data wasn't what i expected it to be. Exactly. So why didn't you act on that impression? Your error message told you that data wa

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: > Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of data while the latter returned a list of rows of dat

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 14:25:41 +0200, Nick the Gr33k wrote: i tried inserting a type function to notify me of the datatype of 'data' but that didnt help too. What did that print show ? In what way didn't it help? It said the type was Charles It didn'tprint anything It gave some other error It

Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh wrote: Suppose i have a variable such as : myVar = 'x' May be it initialized with myVar = u'x' or myVar = 'x' So i need determine content of myVar that it's utf-8 or not, how can i do it? Use the type() function and compare to un

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 5 Nov 2013 09:45:15 -0600, Tim Chase wrote: You're assigning it to the bound function rather than calling the function. Use the "call" operator: data = infile.readlines() Thanks for spoiling the lesson. Nicks needs to learn how to debug 4 line programs without someone giving him

Re: Help me with this code

2013-11-05 Thread Dave Angel
On Tue, 5 Nov 2013 17:51:00 -0800 (PST), chovd...@gmail.com wrote: result += ((-1) ** (k+1))/2*k-1 One of two things are happening here. Maybe both. You're using Python 2.x (and should havesaid so) where integer division is truncated. You're missing around some part of the intende

Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On 5 Nov 2013 15:30:19 GMT, Neil Cerutti wrote: On 2013-11-05, Dave Angel wrote: > On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh >> May be it initialized with myVar = u'x' or myVar = 'x' My solution assumed he wanted to distinguish between th

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-07 Thread Dave Angel
On Thu, 7 Nov 2013 18:43:17 -0800, Mark Janssen wrote: I think the idea would be to find the prime factorization for a given number, which has been proven to be available (and unique) for any and every number. Most numbers can compress given this technique. Prime numbers, of course, woul

Re: Implementing a multivibrator function with python

2013-11-11 Thread Dave Angel
On Mon, 11 Nov 2013 01:41:58 -0800 (PST), JL wrote: - If the event happens again before the 5secs expire, the high duration will be extended by another 5 secs. This works like a retriggerable multivibrator for those who are into electronics. More precisely a retriggerable monostable multivibr

Re: Newbie question about text encoding

2015-02-26 Thread Dave Angel
On 02/26/2015 08:05 PM, Steven D'Aprano wrote: Rustom Mody wrote: eg consider the case of 32 vs 64 bit executables. The 64 bit executable is generally larger than the 32 bit one Now consider the case of a machine that has say 2GB RAM and a 64-bit processor. You could -- I think -- make a re

Re: Newbie question about text encoding

2015-02-26 Thread Dave Angel
On 02/27/2015 12:58 AM, Steven D'Aprano wrote: Dave Angel wrote: (Although I believe Seymour Cray was quoted as saying that virtual memory is a crock, because "you can't fake what you ain't got.") If I recall correctly, disk access is about 1 times slower than

Re: Picking apart a text line

2015-02-26 Thread Dave Angel
On 02/26/2015 10:53 PM, memilanuk wrote: So... okay. I've got a bunch of PDFs of tournament reports that I want to sift thru for information. Ended up using 'pdftotext -layout file.pdf file.txt' to extract the text from the PDF. Still have a few little glitches to iron out there, but I'm getti

Re: Newbie question about text encoding

2015-02-27 Thread Dave Angel
On 02/27/2015 06:54 AM, Steven D'Aprano wrote: Dave Angel wrote: On 02/27/2015 12:58 AM, Steven D'Aprano wrote: Dave Angel wrote: (Although I believe Seymour Cray was quoted as saying that virtual memory is a crock, because "you can't fake what you ain't got.")

Re: Newbie question about text encoding

2015-02-27 Thread Dave Angel
On 02/27/2015 09:22 AM, Chris Angelico wrote: On Sat, Feb 28, 2015 at 1:02 AM, Dave Angel wrote: The term "virtual memory" is used for many aspects of the modern memory architecture. But I presume you're using it in the sense of "running in a swapfile" as opposed t

Re: Newbie question about text encoding

2015-02-27 Thread Dave Angel
On 02/27/2015 11:00 AM, alister wrote: On Sat, 28 Feb 2015 01:22:15 +1100, Chris Angelico wrote: If you're trying to use the pagefile/swapfile as if it's more memory ("I have 256MB of memory, but 10GB of swap space, so that's 10GB of memory!"), then yes, these performance considerations are hu

Re: Python Worst Practices

2015-02-27 Thread Dave Angel
On 02/27/2015 04:21 PM, Travis Griggs wrote: On Feb 25, 2015, at 12:45 PM, Mark Lawrence wrote: http://www.slideshare.net/pydanny/python-worst-practices Any that should be added to this list? Any that be removed as not that bad? I read ‘em. I thought they were pretty good, some more than

Re: Python Worst Practices

2015-02-27 Thread Dave Angel
On 02/27/2015 04:40 PM, Chris Angelico wrote: On Sat, Feb 28, 2015 at 8:37 AM, Dave Angel wrote: Right. In C and C++, instead of being the first slide, it'd be the first 3 or 4. Between header file conflicts (especially good because the stdlib itself has many multiply-defined sy

Re: Python Worst Practices

2015-03-01 Thread Dave Angel
On 03/01/2015 08:59 PM, MRAB wrote: On 2015-03-02 01:37, Dennis Lee Bieber wrote You'd be able to run it on a TI99/4 (in which the BASIC interpreter, itself, was run on an interpreter... nothing like taking the first "16-bit" home computer and shackling it with an interpreted language that

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 02:59 AM, alb wrote: Hi everyone, I'm writing a document in restructured text and I'd like to convert it to latex for printing. To accomplish this I've used semi-successfully pandoc and the wrapper pypandoc. I don't see other responses yet, so I'll respond even though i don't kn

Re: Python27.dll could not be found

2015-03-02 Thread Dave Angel
On 03/02/2015 01:00 AM, Sarvagya Pant wrote: I have been writing a c++ program that is supposed to call the python function. The code is a snippet from python.org itself. #include #include #include int main() { Py_SetProgramName("Learning"); Py_Initialize(); PyRun_SimpleString(

Re: Python Worst Practices

2015-03-02 Thread Dave Angel
On 03/02/2015 07:38 AM, MRAB wrote: On 2015-03-02 04:49, Dave Angel wrote: On 03/01/2015 08:59 PM, MRAB wrote: On 2015-03-02 01:37, Dennis Lee Bieber wrote The 16 bit address bus permitted addressing of 64k words. On most processors, that was 64k bytes, though I know one Harris had no

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 08:51 AM, alb wrote: Hi Steven, Steven D'Aprano wrote: [] Since \r is an escape character, that will give you carriage return followed by "ef{fig:abc". The solution to that is to either escape the backslash: i = '\\ref{fig:abc}' or use a raw string: i = r'\\ref{fig:abc}' A

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 09:43 AM, Steven D'Aprano wrote: Dave Angel wrote: On 03/02/2015 08:51 AM, alb wrote: Hi Steven, Steven D'Aprano wrote: or use a raw string: i = r'\\ref{fig:abc}' Actually that'd be: i = r'\ref{fig:abc}' D'oh! I mean, yo

Re: Sort list of dictionaries

2015-03-02 Thread Dave Angel
On 03/02/2015 01:38 PM, Charles Heizer wrote: Sorry, sortedlist = sorted(mylist , key=lambda elem: "%s %s" % (elem['name'], LooseVersion(elem['version'])), reverse=True) This is what I was trying but LooseVersion() was not sorting version numbers like I thought it would. You will notice that

Re: Python27.dll could not be found

2015-03-02 Thread Dave Angel
I INTENDED to send it to the list, but made the same mistake myself. Forwarded Message Subject: Re: Python27.dll could not be found Date: Mon, 02 Mar 2015 08:51:07 -0500 From: Dave Angel To: Sarvagya Pant Sarvaqya accidentally sent me private email, so I'm forwarding

Re: Python27.dll could not be found

2015-03-02 Thread Dave Angel
On 03/02/2015 02:22 PM, Gisle Vanem wrote: Dave Angel wrote: When I ran Windows, I had written a simple utility that searched the PATH for a specified file. I called it which.bat to match the Linux equivalent. I've written a similar tool; envtool --path --python python27.dll Match

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 05:40 PM, alb wrote: Hi Dave, Dave Angel wrote: [] or use a raw string: i = r'\\ref{fig:abc}' Actually that'd be: i = r'\ref{fig:abc}' Could you explain why I then see the following difference: In [56]: inp = r'\\ref{fig:abc}'

Re: date

2015-03-03 Thread Dave Angel
On 03/02/2015 11:25 AM, Chris Angelico wrote: On Tue, Mar 3, 2015 at 3:09 AM, alister wrote: Sounds ominous. Is that better or worse than the final solution? As in "this program will inadvertantly self distruct in five seconds"? It's usually implied as being externally enforced, so I'd say

Re: rst and pypandoc

2015-03-03 Thread Dave Angel
On 03/02/2015 02:09 PM, Ben Finney wrote: Dave Angel writes: And D'oh right back at ya. Ironic isn't it that I make a second mistake in the same message I correct yours? https://en.wikipedia.org/wiki/Muphry%27s_law> I guess that word is too small to qualify as a malapr

Re: Speeding up permutations generation

2015-03-06 Thread Dave Angel
On 03/06/2015 05:32 AM, Gene Heskett wrote: On Friday 06 March 2015 03:24:48 Abhiram R wrote: A list of 100 elements has approximately 9.33 x 10**157 permutations. If you could somehow generate one permutation every yoctosecond, exhausting them would still take more than a hundred orders of ma

Re: Speeding up permutations generation

2015-03-06 Thread Dave Angel
On 03/06/2015 01:44 AM, Abhiram R wrote: Hi all, Is there a way to generate permutations of large arrays of sizes say,in the hundreds, faster than in the time itertools.permutations() can return? When dealing with large loops like that (or even permutations of 50, which is also gy-normous [1]

Re: Speeding up permutations generation

2015-03-06 Thread Dave Angel
On 03/06/2015 11:14 AM, Gene Heskett wrote: On Friday 06 March 2015 06:22:34 Dave Angel wrote: Sorry, but 50! is not even close to 50**50. The latter is 85 digits as you say, but 50! is "only" 64. 30414093201713378043612608166064768844377641568960512L What util

Re: Idle - ImportError: No module named numpy

2015-03-09 Thread Dave Angel
On 03/07/2015 02:15 PM, Markos wrote: Hi, I'm beginning to study the numpy. When I open a terminal (Debian Squeeze) and run the python interpreter the command "import numpy as np" run without errors. But when I run the same command on idle3 the following error appears. import numpy as np T

Re: Python3: Reading a text/binary mixed file

2015-03-09 Thread Dave Angel
On 03/09/2015 08:45 PM, Paulo da Silva wrote: Hi! What is the best way to read a file that begins with some few text lines and whose rest is a binary stream? As an exmaple ... files .pnm. Thanks for any comments/help on this. In which version of Python? there's a huge difference between 2.

Re: Python3: Reading a text/binary mixed file

2015-03-09 Thread Dave Angel
On 03/09/2015 08:56 PM, Chris Angelico wrote: On Tue, Mar 10, 2015 at 11:45 AM, Paulo da Silva wrote: Hi! What is the best way to read a file that begins with some few text lines and whose rest is a binary stream? As an exmaple ... files .pnm. Thanks for any comments/help on this. Read the

Re: when may sys.executable be empty

2015-03-11 Thread Dave Angel
On 03/11/2015 10:41 AM, Wolfgang Maier wrote: From the documentation of sys.executable: A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense. If Python is unable to retrieve the real path to its executable, sys.executable

Re: The idle gui

2015-03-14 Thread Dave Angel
On 03/13/2015 09:24 PM, Steven D'Aprano wrote: sohcahto...@gmail.com wrote: We need more information than just "It doesn't work". You wouldn't go to a car mechanic and say "It makes a funny noise", would you? No. Actually, most likely yes.It's remarkably hard to describe noises, and often

Re: Module/lib for controlling a terminal program using redrawing?

2015-03-14 Thread Dave Angel
On 03/14/2015 06:50 AM, Jason Heeris wrote: I am trying to automate the use of some old, in-house terminal-based programs that use screen redrawing for their interface. This includes single line redrawing (eg. using '\r' and overwriting), complete screen clearing, and fine-grained cursor movement

Re: generator/coroutine terminology

2015-03-14 Thread Dave Angel
On 03/14/2015 12:51 PM, Chris Angelico wrote: On Sun, Mar 15, 2015 at 3:33 AM, Rustom Mody wrote: As best as I can see python makes no distinction between such a foo and the more usual function/methods that have no returns. You can I can talk about these and distinguish them Python has no clue

Re: The idle gui

2015-03-14 Thread Dave Angel
On 03/14/2015 05:57 AM, Chris Angelico wrote: On Sat, Mar 14, 2015 at 12:35 PM, Dave Angel wrote: Not if you don't take it to him. If you just call him on the phone, and say "Jimmy doesn't work" he doesn't even know what make and model the vehicle is. Or whether it

Re: More or less code in python?

2015-03-16 Thread Dave Angel
On 03/15/2015 03:09 PM, jonas.thornv...@gmail.com wrote: Den söndag 15 mars 2015 kl. 20:01:36 UTC+1 skrev Paul Rubin: jonas.thornv...@gmail.com writes: I though it would be interesting doing comparissons in timing adding massive digits in different bases. Especially in Python. Python has buil

Re: More or less code in python?

2015-03-16 Thread Dave Angel
On 03/16/2015 03:36 AM, Chris Angelico wrote: On Mon, Mar 16, 2015 at 6:32 PM, Dave Angel wrote: Assuming Python 3.x of course. if you're in Python 2, you'd use "long" rather than int. Not sure you need to bother. Even in Py2, you can use the int constructor to get a lon

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 fi

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 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 of time, at least

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 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:

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 05:31 PM, Carsten Lechte wrote: On 23/03/15 19:44, Dave Angel wrote: I'll give you a worse version. Back in the day I had occasion to write a simple program in a language which had no add or subtract. It could only increment and decrement indices. Oh yes, the olden da

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 06:53 PM, Terry Reedy wrote: On 3/23/2015 2:44 PM, Dave Angel wrote: ## Example 2: Using recursion with caching cache = [0, 1] def fib4(n): if len(cache) <= n: value = fib4(n-2) + fib4(n-1) cache.append(value) return cache[n] This one takes less t

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 07:49 PM, Chris Angelico wrote: On Tue, Mar 24, 2015 at 10:12 AM, Dave Angel wrote: On the other hand, my loop makes some non-obvious assumptions, like that append is always the right place to put a new value. Yes, I had to stop and think about that one a bit. And that strongly

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 08:19 PM, Steven D'Aprano wrote: On Tue, 24 Mar 2015 03:16 am, Chris Angelico wrote about the standard recursive version of the Fibonacci series: On Tue, Mar 24, 2015 at 3:01 AM, Ganesh Pal wrote: def fib(n): if n == 0: return 0 elif n == 1: return

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Dave Angel
On 03/23/2015 08:27 PM, Chris Angelico wrote: On Tue, Mar 24, 2015 at 11:09 AM, Dave Angel 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 of flow charts

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 t

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 wrote: "Frank Millman" : Here is another python-based sudoku solver - http://www.ics.uci.edu/~eppstein/PADS/Sudoku.py >From its docstring - "A proper Sudoku puzzle must have a unique solution, an

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 t

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 incredib

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 | | Retur

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 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 logical deduction

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 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 in a hu

Re: Sudoku solver

2015-03-27 Thread Dave Angel
On 03/27/2015 09:35 AM, Frank Millman wrote: "Dave Angel" 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 reaso

Re: Sudoku solver

2015-03-27 Thread Dave Angel
On 03/27/2015 09:56 AM, Marko Rauhamaa wrote: "Frank Millman" : 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 their heads.

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 cross-plat

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 wrote: Am 30.03.15 um 08:50 schrieb Ian Kelly: On Sun, Mar 29, 2015 at 12:03 PM, Marko Rauhamaa wrote: Be careful with the benchmark comparisons. Ian's example can be solved with the identical al

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

2015-03-30 Thread Dave Angel
On 03/30/2015 12:45 PM, Saran A wrote: On Sunday, March 29, 2015 at 10:04:45 PM UTC-4, Chris Angelico wrote: On Mon, Mar 30, 2015 at 12:08 PM, Paul Rubin wrote: Saran Ahluwalia writes: cross-platform... * Monitors a folder for files that are dropped throughout the day I don't see a cross-p

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

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 wrote: The biggest difference is syntactic. Here's an iterator which returns a never-ending sequence of squared numbers 1, 4, 9, 16, ... class Squares:

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 y

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 randomly

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: 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 this

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 w

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 the

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()

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. N

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: 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 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, the

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 wrote: On Wed, Apr 8, 2015 at 12:36 AM, wrote: Integers are internally assumed to be base 10 otherwise you could not calculate without giving the base. All operations on integers addition, subtraction, multiplicatio

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, wrote: I want todo faster baseconversion for very big bases like base 1 000 000, so instead of adding up digits i search it. I need the fastest al

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 writes: On Tue, Apr 7, 2015 at 12:55 PM, Terry Reedy wrote: On 4/7/2015 1:44 PM, Ian Kelly wrote: def to_base(number, base): ... digits = [] ... whi

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: 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 writes: Alain Ketterlin : 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 ever had dealings with have used 2's-complemen

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: Here's a couple of ranges of output, showing that the 7bit scheme does better for values between 384 and 16379. T

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, I'

<    9   10   11   12   13   14   15   16   17   18   >