Re: Threading in Python, Please check the script

2015-01-14 Thread Dave Angel
On 01/14/2015 01:22 AM, Robert Clove wrote: Hi All, In any new thread, you should specify what versions of Python and OS you're using. I'll assume Python 2.7 and Linux for this message. I have made a script in which i have started two thread named thread 1 and thread 2. In thread 1 one fu

Re: Threading in Python, Please check the script

2015-01-14 Thread Dave Angel
On 01/14/2015 07:11 AM, Robert Clove wrote: Can u provide me the pseudo script. You say you're a beginner. If so, you shouldn't be trying to use threads, which are tricky. I've been programming for 46 years, and I seldom have had to write multi-threading code. But this looks like a school

Re: How to terminate the function that runs every n seconds

2015-01-14 Thread Dave Angel
On 01/14/2015 08:09 AM, Ganesh Pal wrote: Corrected Typos . a) How to I prevent the execution of Print "EXECUTED SLEEP" after 4 seconds ? , current this is running in an infinite loop Please on't top-post. If you want to comment on a message, insert your comments after the portion of

Re: Calling a derived class's constructor from a parent method

2015-01-14 Thread Dave Angel
On 01/14/2015 01:10 PM, jason wrote: On Wednesday, January 14, 2015 at 12:05:55 PM UTC-5, Mark Lawrence wrote: I'm confused, can you please explain what you're trying to achieve rather than how you're trying to achieve it and I'm sure that others will give better answers than I can :) Good c

Re: Benchmarking some modules - strange result

2015-02-03 Thread Dave Angel
On 01/24/2015 09:36 PM, Dan Stromberg wrote: On Sat, Jan 24, 2015 at 6:24 PM, Chris Angelico wrote: On Sun, Jan 25, 2015 at 1:11 PM, Dan Stromberg wrote: For simplicity, let's say I've been running the suite of performance tests within a single interpreter - so I test one module thoroughly, t

Re: Idiomatic backtracking in Python

2015-02-03 Thread Dave Angel
On 01/25/2015 08:45 PM, Chris Angelico wrote: On Mon, Jan 26, 2015 at 12:31 PM, Marko Rauhamaa wrote: Backtracking means the part of depth-first traversal where you retreat to the parent node. If you implement your traversal with a recursive function, backtracking means — more or less — a retur

Re: Problem while reading files from hdfs using python

2015-02-03 Thread Dave Angel
On 01/25/2015 03:23 PM, Shalini Ravishankar wrote: Hello Everyone, I am trying to read(open) and write files in hdfs inside a python script. But having error. Please copy/paste the full error traceback. Can someone tell me what is wrong here. Code (full): sample.py #!/usr/bin/python

Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2015-02-04 Thread Dave Angel
On 01/28/2015 07:34 PM, Steven D'Aprano wrote: Devin Jeanpierre wrote: On Wed, Jan 28, 2015 at 1:40 PM, Chris Angelico wrote: On Thu, Jan 29, 2015 at 5:47 AM, Chris Kaynor wrote: I use Google Drive for it for all the stuff I do at home, and use SVN for all my personal projects, with the SVN

Re: Setuptools, __init__ and __main__

2015-02-06 Thread Dave Angel
On 02/06/2015 04:35 PM, Ben Finney wrote: Rob Gaddi writes: So I'm trying to wrap my head around packaging issues Congratulations on tackling this. You will likely find the Python Packaging User Guide https://packaging.python.org/> helpful. Also know that Python packaging was in a terrible

Re: Setuptools, __init__ and __main__

2015-02-06 Thread Dave Angel
On 02/06/2015 06:56 PM, Steven D'Aprano wrote: Dave Angel wrote: And don't name any source code __main__.py, That's incorrect. Starting from Python 2.6, __main__.py is reserved for the application main script in packages. That is, if you design your application as a packag

Re: help for using Python rsa

2015-02-06 Thread Dave Angel
On 02/07/2015 12:14 AM, mhr1...@gmail.com wrote: I use this code to create public and private keys: import rsa (pubkey, privkey) = rsa.newkeys(512) And then convert it to PEM format: exppub =pubkey.save_pkcs1(format='PEM') exppriv = privkey.save_pkcs1(format='

Re: help for using Python rsa

2015-02-07 Thread Dave Angel
On 02/07/2015 10:00 PM, Chris Angelico wrote: On Sun, Feb 8, 2015 at 1:55 PM, Cameron Simpson wrote: Given that Dave Angel has a tool that displays the 'SEcP...' string using mhr1224's input string, I'd say we're missing some context. I don't think he does; tha

Re: Please help.

2015-02-09 Thread Dave Angel
On 02/09/2015 01:08 PM, John Ladasky wrote: On Monday, February 9, 2015 at 9:44:16 AM UTC-8, chim...@gmail.com wrote: Hello. Am trying to change the key words to my tribal language. Eg change English language: print() to igbo language: de(). I have been stuck for months I need a mentor or some

Re: TypeError: list indices must be integers, not tuple

2015-02-09 Thread Dave Angel
On 02/09/2015 07:02 PM, Ethan Furman wrote: On 02/09/2015 03:52 PM, james8boo...@hotmail.com wrote: import random RandomNum = random.randint(0,7) restraunt = raw_input("What's your favourite takeaway?Pizza, Chinease or Indian?") if restraunt == ("Pizza"): fav = ("1") elif restraunt == ("C

Re: Weird behavior on __dict__ attr

2015-02-09 Thread Dave Angel
On 02/09/2015 09:52 PM, Shiyao Ma wrote: Hi. My context is a little hard to reproduce. WHY don't you try? Telling us about a class without showing how it's defined leaves us all guessing. Start by telling us Python version. And if it's 2.x, tell us whether this class is an old style or n

Re: TypeError: list indices must be integers, not tuple

2015-02-09 Thread Dave Angel
On 02/09/2015 10:05 PM, Dave Angel wrote: On 02/09/2015 07:02 PM, Ethan Furman wrote: On 02/09/2015 03:52 PM, james8boo...@hotmail.com wrote: import random RandomNum = random.randint(0,7) restraunt = raw_input("What's your favourite takeaway?Pizza, Chinease or Indian?") if restr

Re: TypeError: list indices must be integers, not tuple

2015-02-10 Thread Dave Angel
On 02/10/2015 06:35 AM, Mark Lawrence wrote: On 10/02/2015 00:05, Ryan Stuart wrote: Hi, If you can show me a one tuple anywhere in the original code I'll happily buy you a tipple of your choice. print Menu[fav,RandomNum] was in the original code -- DaveA -- https://mail.python.org/ma

Re: Varable parsing error with python

2015-02-10 Thread Dave Angel
On 02/10/2015 03:29 AM, OmPs wrote: On 10 Feb 2015 13:12, "Chris Angelico" wrote: On Tue, Feb 10, 2015 at 6:30 PM, OmPs wrote: def _getPackgeVersion(xmlfile, p): package = str(p) if isinstance(fpmdict["application"]["package"], list): for i in fpmdict["app

Re: TypeError: list indices must be integers, not tuple

2015-02-10 Thread Dave Angel
On 02/10/2015 09:33 AM, Chris Angelico wrote: On Wed, Feb 11, 2015 at 1:28 AM, Dave Angel wrote: If you can show me a one tuple anywhere in the original code I'll happily buy you a tipple of your choice. print Menu[fav,RandomNum] was in the original code That's not a one-tuple

Re: TypeError: list indices must be integers, not tuple

2015-02-10 Thread Dave Angel
On 02/10/2015 01:48 PM, Chris Angelico wrote: On Wed, Feb 11, 2015 at 2:51 AM, Dave Angel wrote: You're right of course. I didn't notice the meaning of one-tuple; I took Mark's comment as if he had said: If you can show me a one tuple anywhere ... Ah, yeah. I see the ambigui

Re: Varable parsing error with python

2015-02-10 Thread Dave Angel
On 02/10/2015 01:24 PM, Denis McMahon wrote: On Tue, 10 Feb 2015 18:39:42 +1100, Chris Angelico wrote: On Tue, Feb 10, 2015 at 6:30 PM, OmPs wrote: def _getPackgeVersion(xmlfile, p): package = str(p) if isinstance(fpmdict["application"]["package"], list): f

Re: Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-10 Thread Dave Angel
On 02/10/2015 04:05 PM, Skip Montanaro wrote: I know this is way off-topic for this group, but I figured if anyone in the online virtual communities I participate in would know the answer, the Pythonistas would... Google has so far not been my friend in this realm. One of the things I really lik

Re: function inclusion problem

2015-02-11 Thread Dave Angel
On 02/11/2015 08:27 AM, Victor L wrote: Laura, thanks for the answer - it works. Is there some equivalent of "include" to expose every function in that script? Thanks again, -V Please don't top-post, and please use text email, not html. Thank you. yes, as sohcahto...@gmail.com pointed out, yo

Re: Floating point "g" format not stripping trailing zeros

2015-02-13 Thread Dave Angel
On 02/13/2015 03:33 PM, Grant Edwards wrote: On 2015-02-13, Ian Kelly wrote: Significant digits are within the precision of the calculation. Writing 1.230 indicates that the fourth digit is known to be zero. Writing 1.23 outside a context of exact calculation indicates that the fourth digit i

Re: Printing to printer, windows 7

2015-02-16 Thread Dave Angel
On 02/16/2015 09:08 PM, ken.hes...@gmail.com wrote: Would seem to be a simple problem. I just want to print to my printer instead of the console using Python 2.7, Windows 7. Hours of looking through FAQ's and Google haven't yielded a solution. Any suggestions appreciated -- It is a simple

Re: [Tutor] sql-like join on two lists or dictionaries

2015-02-16 Thread Dave Angel
On 02/16/2015 09:26 PM, Joel Goldstick wrote: On Sun, Feb 15, 2015 at 2:14 PM, Peter Otten <__pete...@web.de> wrote: Joel Goldstick wrote: You can dispense with the slicing if you use the str.split() method. It will put each item in a list. Only if there are no whitespace chars in the fiel

Re: python implementation of a new integer encoding algorithm.

2015-02-17 Thread Dave Angel
On 02/17/2015 06:22 AM, janhein.vanderb...@gmail.com wrote: In http://optarbvalintenc.blogspot.nl/ I propose a new way to encode arbitrarily valued integers and the python code that can be used as a reference for practical implementations of codecs. The encoding algorithm itself is optimized f

Re: python implementation of a new integer encoding algorithm.

2015-02-17 Thread Dave Angel
On 02/17/2015 09:34 AM, Chris Angelico wrote: On Wed, Feb 18, 2015 at 1:12 AM, Dave Angel wrote: They had a field type called a "compressed integer." It could vary between one byte and I think about six. And the theory was that it took less space than the equivalent format of

Re: python implementation of a new integer encoding algorithm.

2015-02-17 Thread Dave Angel
On 02/17/2015 09:58 AM, Chris Angelico wrote: On Wed, Feb 18, 2015 at 1:50 AM, Dave Angel wrote: But the first thing I'd expect to see would be a target estimate of the anticipated distribution of number values/magnitudes. For example, if a typical integer is 1500 bits, plus/minus 200

Re: python implementation of a new integer encoding algorithm.

2015-02-18 Thread Dave Angel
On 02/18/2015 04:04 AM, janhein.vanderb...@gmail.com wrote: On Tuesday, February 17, 2015 at 3:35:16 PM UTC+1, Chris Angelico wrote: Oh, incidentally: If you want a decent binary format for variable-sized integer, check out the MIDI spec. I did some time ago, thanks, and it is indeed a decent

Re: python implementation of a new integer encoding algorithm.

2015-02-18 Thread Dave Angel
On 02/18/2015 03:59 AM, janhein.vanderb...@gmail.com wrote: encoding individual integers optimally without any assumptions about their values. Contradiction in terms. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: python implementation of a new integer encoding algorithm.

2015-02-18 Thread Dave Angel
On 02/18/2015 02:55 PM, janhein.vanderb...@gmail.com wrote: Op woensdag 18 februari 2015 17:47:49 UTC+1 schreef Dave Angel: On 02/18/2015 03:59 AM, janhein.vanderb...@gmail.com wrote: encoding individual integers optimally without any assumptions about their values. Contradiction in

Re: What behavior would you expect?

2015-02-18 Thread Dave Angel
On 02/19/2015 12:10 AM, Chris Angelico wrote: On Thu, Feb 19, 2015 at 3:44 PM, Jason Friedman wrote: I have need to search a directory and return the name of the most recent file matching a given pattern. Given a directory with these files and timestamps, q.pattern1.abc Feb 13 r.pattern1.cdf

Re: urgent help

2015-02-19 Thread Dave Angel
On 02/19/2015 03:35 AM, ismaham...@gcuf.edu.pk wrote: this is the error in the following python code, can any one help me error{Traceback (most recent call last): File "C:\Python27\Scripts\BeOk\getBeOKExperts.py", line 6, in from BeautifulSoup import BeautifulSoup ImportError: No module

Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Dave Angel
On 02/19/2015 10:45 AM, janhein.vanderb...@gmail.com wrote: On Wednesday, February 18, 2015 at 11:20:12 PM UTC+1, Dave Angel wrote: I'm not necessarily doubting it, just challenging you to provide a data sample that actually shows it. And of course, I'm not claiming that 7bit is

Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Dave Angel
On 02/19/2015 01:34 PM, Chris Angelico wrote: On Fri, Feb 20, 2015 at 5:24 AM, Dave Angel wrote: In all my experimenting, I haven't found any values where the 7bit scheme does worse. It seems likely that for extremely large integers, it will, but if those are to be the intended distrib

Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Dave Angel
On 02/19/2015 01:32 PM, Ian Kelly wrote: On Thu, Feb 19, 2015 at 11:24 AM, Dave Angel wrote: Here's a couple of ranges of output, showing that the 7bit scheme does better for values between 384 and 16379. 382 2 80fe --- 2 7e82 383 2 80ff --- 2 7f82 384 3 81 --- 2 0083 384 jan g

Re: What behavior would you expect?

2015-02-20 Thread Dave Angel
On 02/20/2015 12:51 AM, Jason Friedman wrote: I'd still advise using my_list.sort() rather than sorted(), as you don't need to retain the original. Hmm. Trying to figure out what that looks like. If I understand correctly, list.sort() returns None. What would I return to the caller? r

Re: Python path on windows

2015-02-20 Thread Dave Angel
On 02/20/2015 09:43 AM, loial wrote: On Linux we use #!/usr/bin/env python At the start of scripts to ensure that the python executable used is the one defined in the PATH variable, rather than hardcoding a path to the python executable. What is the equivalent functionality in Windows? Dep

Re: urgent help

2015-02-20 Thread Dave Angel
On 02/20/2015 07:20 PM, ms.isma...@gmail.com wrote: On Saturday, February 21, 2015 at 8:17:06 AM UTC+8, ms.is...@gmail.com wrote: On Saturday, February 21, 2015 at 8:14:43 AM UTC+8, ms.is...@gmail.com wrote: On Friday, February 20, 2015 at 4:41:57 PM UTC+8, Mark Lawrence wrote: On 20/02/2015 0

Re: Python path on windows

2015-02-21 Thread Dave Angel
On 02/21/2015 06:05 AM, Gisle Vanem wrote: Dave Angel wrote: Finally, when py.exe starts, it reads that first (shebang) line, and decides which python interpreter to actually use. py.exe? Do you mean python.exe? Reread my post, or read Mark's reply to yours. The job of py.exe or py

Re: Best practice: Sharing object between different objects

2015-02-21 Thread Dave Angel
On 02/21/2015 07:15 AM, pfranke...@gmail.com wrote: Hello! I have a best-practice question: Imagine I have several hardware devices that I work with on the same I2C bus and I am using the python smbus module for that purpose. The individual devices are sensors, ADC, DAC components. As I said,

Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements

2015-02-21 Thread Dave Angel
On 02/21/2015 02:46 PM, TommyVee wrote: Start off with sets of elements as follows: 1. A,B,E,F 2. G,H,L,P,Q 3. C,D,E,F 4. E,X,Z 5. L,M,R 6. O,M,Y Note that sets 1, 3 and 4 all have the element 'E' in common, therefore they are "related" and form the following superset: A,B,C,D,E,F,X,Z Likewis

Future of Pypy?

2015-02-22 Thread Dave Farrance
As an engineer, I can quickly knock together behavioural models of electronic circuits, complete units, and control systems in Python, then annoyingly in a few recent cases, have to re-write in C for speed. I've tried PyPy, the just-in-time compiler for Python, and that is impressively, hugely fa

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
jkn wrote: > I'm curious what ...behavioural... models you are creating quickly in > Python that then need rewriting in C for speed. SPICE? some other CAD? > Might be interesting to learn more about what and how you are actually > doing. The convert-to-C cases were complex filtering functions.

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Laura Creighton wrote: >I don't understand 'an interpreter rather than a JIT'. PyPy has a >JIT, that sort of is the whole point. Yes. I meant that from my end-user, non-software-engineer perspective, it looked as though CPython was proceeding with leaps and bounds and that PyPy remained mostly

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Steven D'Aprano wrote: >I assume you're talking about drawing graphics rather than writing text. Can >you tell us which specific library or libraries won't run under PyPy? Yes, mainly the graphics. I'm a hardware engineer, not a software engineer, so I might well be misunderstanding PyPy's curr

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Dave Farrance wrote: >Steven D'Aprano wrote: > >>I assume you're talking about drawing graphics rather than writing text. Can >>you tell us which specific library or libraries won't run under PyPy? > >Yes, mainly the graphics. I'm a hardware enginee

Re: calling subprocess

2015-02-22 Thread Dave Angel
On 02/22/2015 08:13 PM, jkuplin...@gmail.com wrote: OK (1) sorry about for/from That's not what you should be sorry about. You should be sorry you didn't use cut&paste. (2) print() sounds nice, but fact is , no matter what I try, i always get C:\\apps instead of c:\apps. So in this sense

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Dave Angel
On 02/22/2015 09:29 PM, Chris Angelico wrote: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. This can mask bugs, especially when Windows path names are used: 'C:\sqlite\Beginner.db' 'C:\\sqlite\\Beginner.db' 'c:\

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Dave Angel
On 02/22/2015 09:41 PM, Ben Finney wrote: Chris Angelico writes: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. Right. Text strings literals are documented to work that way https://docs.python.org/3/library/stdt

Re: calling subprocess

2015-02-22 Thread Dave Angel
On 02/22/2015 09:38 PM, Dave Angel wrote: On 02/22/2015 08:13 PM, jkuplin...@gmail.com wrote: OK (1) sorry about for/from That's not what you should be sorry about. You should be sorry you didn't use cut&paste. (2) print() sounds nice, but fact is , no matter what I try,

Re: Future of Pypy?

2015-02-23 Thread Dave Cook
On 2015-02-22, Dave Farrance wrote: > It's still quicker to do a re-write in the more cumbersome C You should try Cython. Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: list storing variables

2015-02-23 Thread Dave Angel
On 02/23/2015 07:55 AM, ast wrote: hi a = 2; b = 5 Li = [a, b] Li [2, 5] a=3 Li [2, 5] Ok, a change in a or b doesn't impact Li. This works as expected Is there a way to define a container object able to store some variables so that a change of a variable make a change in this object c

Re: Future of Pypy?

2015-02-23 Thread Dave Farrance
Laura Creighton wrote: >Good news -- it seems to be working fine with PyPy. >https://travis-ci.org/hugovk/Pillow/builds > >for me, not extensively tested, it just seems to be working. > >I have several pypy's floating around here, each within its own >virtualenv. If you aren't familiar with vir

Re: Future of Pypy?

2015-02-23 Thread Dave Farrance
Dave Cook wrote: >On 2015-02-22, Dave Farrance wrote: > >> It's still quicker to do a re-write in the more cumbersome C > >You should try Cython. I did try Cython when I was trying to figure out what to do about the slow speed. My initial attempt showed no speedup at

Re: Newbie question about text encoding

2015-02-24 Thread Dave Angel
On 02/24/2015 05:49 AM, pierrick.brih...@gmail.com wrote: Hello, Working with pyshp, this is my code : What version of Python, what version of pyshp, from where, and what OS? These are the first information to supply in any query that goes outside of the standard library. For example, you

Re: Newbie question about text encoding

2015-02-24 Thread Dave Angel
On 02/24/2015 11:20 AM, Laura Creighton wrote: In a message of Wed, 25 Feb 2015 02:33:30 +1100, Chris Angelico writes: Also a reasonable baseline assumption; but the trouble is that if you automatically assume that text is encoded in your favourite eight-bit system, you're taking a huge risk.

Re: Newbie question about text encoding

2015-02-24 Thread Dave Angel
On 02/24/2015 02:57 PM, Laura Creighton wrote: Dave Angel are you another Native English speaker living in a world where ASCII is enough? I'm a native English speaker, and 7 bits is not nearly enough. Even if I didn't currently care, I have some history: No. CDC display code

Re: Bug in timsort!?

2015-02-24 Thread Dave Angel
On 02/24/2015 07:07 PM, Chris Angelico wrote: On Wed, Feb 25, 2015 at 10:50 AM, Skip Montanaro wrote: Even if/when we get to the point where machines can hold an array of 2**49 elements, I suspect people won't be using straight Python to wrangle them. Looking just at CPython, what is the abso

Re: Python Worst Practices

2015-02-25 Thread Dave Angel
On 02/25/2015 08:44 PM, Mark Lawrence wrote: On 25/02/2015 20:45, 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? Throwing in my own, how about built-in functions should not use "object

Re: Flag control variable

2014-02-11 Thread Dave Angel
luke.gee...@gmail.com Wrote in message: > Can I make it that if > C = int(sys.argv[3]) > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 > Why do you ask for 'automatically'? You're the programmer, write the test in the code. if len (sys.argv) == 3: sys.argv. ap

Re:singleton ... again

2014-02-11 Thread Dave Angel
Asaf Las Wrote in message: > playing a bit with subject. > > pros and cons of this approach? did i create bicycle again? :-) > > class myclass(object): > class_instance = None > > def __new__(cls, *args, **kwargs): > if myclass.class_instance == None: > return

Re: Combination Function Help

2014-02-12 Thread Dave Angel
kjaku...@gmail.com Wrote in message: > def choices(n, k): > if k == 1: > return n > if n == k: > return 1 > if k == 0: > return 1 > return choices(n - 1, k) + choices(n - 1, k - 1) > print ("Total number of ways of choosing %d out of %d courses: " % (n,

Re: Flag control variable

2014-02-12 Thread Dave Angel
luke.gee...@gmail.com Wrote in message: > Deleting all the obnoxious doublespaced googlegroups nonsense. .. > > then i keep getting IndexError: list index out of range > anyway to prevent it and just set the value to 0? > My car makes a funny noise. What kind of coat should I wear to the da

Re:Simple Object assignment giving me errors

2014-02-12 Thread Dave Angel
Nir Wrote in message: > This is from the book 'dive into python'. I am trying to define jeez as being > an instance of FileInfo. > > class UserDict(object): > def __init__(self, dict = None): > self.data = {} > if dict is not None: self.update(dict) > > class

Re: How does python know?

2014-02-12 Thread Dave Angel
Tobiah Wrote in message: > On 02/12/2014 12:17 PM, Tobiah wrote: >> I do this: >> >> a = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' >> b = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' >> >> print >> print id(a) >> print id(b) >> >> >> And get this: >> >> True >> 140329184721376 >> 1403291847213

Re: Working with the set of real numbers

2014-02-12 Thread Dave Angel
Gregory Ewing Wrote in message: > Chris Angelico wrote: >> Sure, but nobody said the text file had to be _stored_ anywhere :) >> Computers are quite capable of working with streams of incoming data >> that are potentially infinite in size. > > However, they *can't* work with arbitrary real numbe

Re: Combination Function Help

2014-02-12 Thread Dave Angel
kjaku...@gmail.com Wrote in message: > def choices(n, k): > if k == 1: > return n > if n == k: > return 1 > if k == 0: > return 1 > return choices(n - 1, k) + choices(n - 1, k - 1) > > comb = choices(n, k) > print comb > > print ("Total number of ways of c

Re:Python version problem for rpm

2014-02-14 Thread Dave Angel
anju tiwari Wrote in message: > I have two version of python 2.4 and 2.7. > By default python version is 2.4 . I want to install need to install some rpm which needs python 2.7 interpreter. how can I enable 2.7 interpreter for only those packages which are requiring python 2.7, I don’t wa

Re: A curious bit of code...

2014-02-14 Thread Dave Angel
Terry Reedy Wrote in message: > On 2/13/2014 1:37 PM, forman.si...@gmail.com wrote: >> I ran across this and I thought there must be a better way of doing it, but >> then after further consideration I wasn't so sure. >> >>if key[:1] + key[-1:] == '<>': ... > > if key[:1] == '<' and key[-1:]

Re: Working with the set of real numbers

2014-02-14 Thread Dave Angel
Chris Angelico Wrote in message: > On Fri, Feb 14, 2014 at 5:37 PM, Gregory Ewing >> >> >> If it's a quantum computer, it may be able to execute >> all branches of the iteration in parallel. But it >> would only have a probability of returning the right >> answer (in other cases it would kill yo

Re:Best practices to overcome python's dynamic data type nature

2014-02-14 Thread Dave Angel
Sam Wrote in message: > Dynamic data type has pros and cons. It is easier to program but also easier > to create bugs. What are the best practices to reduce bugs caused by Python's > dynamic data-type characteristic? Can the experienced Python programmers here > advise? > > Thank you. > Cl

Explanation of list reference

2014-02-14 Thread dave em
memory location of the list reference. And all of those variable can act upon the list reference. Question: Is my explanation correct? If not please set me straight :) And does anyone have an easier to digest explanation? Thanks in advance, Dave -- https://mail.python.org/mailman/listinfo/python

Re: Explanation of list reference

2014-02-14 Thread dave em
On Friday, February 14, 2014 11:26:13 AM UTC-7, Jussi Piitulainen wrote: > dave em writes: > > > > > He is asking a question I am having trouble answering which is how a > > > variable containing a value differs from a variable containing a > > > list o

Re:Generator using item[n-1] + item[n] memory

2014-02-14 Thread Dave Angel
Nick Timkovich Wrote in message: > def biggen():     sizes = 1, 1, 10, 1, 1, 10, 10, 1, 1, 10, 10, 20, 1, 1, 20, 20, 1, 1     for size in sizes:         data = [1] * int(size * 1e6)         #time.sleep(1)         yield data > def consumer():     for data in biggen():     Â

Re: Explanation of list reference

2014-02-14 Thread dave em
All, Thanks for the excellent explanations and for sharing your knowledge. I definitely have a better understanding than I did this morning. Best regards, Dave -- https://mail.python.org/mailman/listinfo/python-list

Re:ipython

2014-02-15 Thread Dave Angel
greymausg Wrote in message: > using IPython, is there any way of recording the commands I have entered? > Try the history command. http://ipython.org/ipython-doc/rel-1.1.0/api/generated/IPython. core.magics.history.html -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Import order question

2014-02-17 Thread Dave Angel
Terry Reedy Wrote in message: > On 2/17/2014 8:01 AM, Nagy László Zsolt wrote: >> I have a class hierarchy like this: >> >> Widget <- VisualWidget <- BsWidget >> >> and then BsWidget has many descendants: Desktop, Row, Column, Navbar etc. >> >> Widgets can have children. They are stored in a tr

Re: Cannot figure out line of code, also not understanding error

2014-02-20 Thread Dave Angel
ApathyBear Wrote in message: > > On Thursday, February 20, 2014 12:54:54 AM UTC-8, Chris Angelico wrote: > >>Calling a class will create a new instance of it. [1] What you do with >>it afterwards is separate. > > Okay. So what you are saying is that > return(Athlete(temp1.pop(0),temp1.pop(0

Re:The sum of numbers in a line from a file

2014-02-20 Thread Dave Angel
kxjakkk Wrote in message: > Let's say I have a sample file like this: > > Name1 2 34 5 6 78 > > name1099-66-7871 A-FY10067815998 > name2999-88-776

Re:Function and turtle help

2014-02-20 Thread Dave Angel
Scott W Dunning Wrote in message: > Hello, > > I am trying to make a function that allows me to color in a star that was > drawn in Turtle. I just keep having trouble no matter what I do. I’ll > post the code I have for the star (just in case). The ultimate goal is to > create a script t

Re:TypeError: can't multiply sequence by non-int of type 'tuple'

2014-02-21 Thread Dave Angel
Jaydeep Patil Wrote in message: > HI, > > I have a tuple. I need to make sqaure of elements of tuple and after that i > want add all suared tuple elements for total. When i trying to do it, below > error came. > > > Code: > seriesxlist1 = ((0.0,), (0.01,), (0.02,), (0.03,), (0.04,), (0.05,),

Re:New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Dave Angel
ApathyBear Wrote in message: > I don't understand how APIs work to save my life. I am a complete beginner. > In fact, I am a bit confused on what API even means and what the meaning > entails. > > I am fairly competent with python, though I do lack some real world > experience. Regardless, an

Re: Function and turtle help

2014-02-21 Thread Dave Angel
Scott W Dunning Wrote in message: > > On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: > >> Look at turtle.begin_fill and turtle.end_fill >> >> That's after making sure your star is a closed shape. > > > > So, this is what I have so far and it â

Re: Function and turtle help

2014-02-21 Thread Dave Angel
On 02/21/2014 10:38 PM, Scott W Dunning wrote: On Feb 21, 2014, at 7:13 PM, Dave Angel wrote: Scott W Dunning Wrote in message: On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: Look at turtle.begin_fill and turtle.end_fill That's after making sure your star is a closed shape.

Re: Can global variable be passed into Python function?

2014-02-22 Thread Dave Angel
Mark Lawrence Wrote in message: > On 22/02/2014 02:47, Dennis Lee Bieber wrote: >> BASIC, C, FORTRAN, COBOL, Assembly... A "variable" is synonym for an >> address [a box that holds things]. >> > > In C. > > int xyz = 1; > > xyz is placed in a register. What is xyz called now as it's not

Re: Mac vs. Linux for Python Development

2014-02-23 Thread Dave Cook
'll note that Macs are very popular among the members of pythonsd. I think this is particularly true of the Django developers. Dave Cook -- https://mail.python.org/mailman/listinfo/python-list

Re:intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Dave Angel
mauro Wrote in message: > Dictionaries and sets share a few properties: > - Dictionaries keys are unique as well as sets items > - Dictionaries and sets are both unordered > - Dictionaries and sets are both accessed by key > - Dictionaries and sets are both mutables > > So I wonder why operatio

Re: exec and locals

2014-02-26 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Wed, 26 Feb 2014 14:46:39 +0100, Peter Otten wrote: > >> Steven D'Aprano wrote: >> >>> I have to dynamically generate some code inside a function using exec, >>> but I'm not sure if it is working by accident or if I can rely on it. >>> >> I eventually set

Re:How to run multiple virtualenv in product server

2014-02-27 Thread Dave Angel
YE SHANG Wrote in message: > I'm starting to learn virtualenv, I wonder how run python project developed > in virtualenv. > > Here is my situation, there is a server we can access with a common user name > and password, there are many py scripts wrote by different people on this > server. >

Re: posting code snippets

2014-02-27 Thread Dave Angel
"Mark H. Harris" Wrote in message: > my isp withdrew the post service (nntp) from their server at end of 2011... > and I didn't notice till now! ha! So, I'm not using seamonkey any > longer... using google groups/ and that has been a fit to get used to, but > I'm making progress. > >

Re: Boxes of O's

2014-03-01 Thread Dave Angel
genius...@gmail.com Wrote in message: > Well, This is what i got > > n = int(input("enter number of o: ")) > > for i in range(n): > print("O", end = '') > for j in range(n* 2): > print("O", end = '') > > print() > Are you permitted to write and call functions? If so,

Re: [OT] Can global variable be passed into Python function?

2014-03-01 Thread Dave Angel
Grant Edwards Wrote in message: > On 2014-02-24, Michael Torrie wrote: > >> >> Why would you think that? The address of the start of your malloc'ed >> structure is the same as the address of the first element. Surely >> this is logical? > > Not only is it logical, the C standard explicitly req

Re: [OT] Can global variable be passed into Python function?

2014-03-02 Thread Dave Angel
Chris Angelico Wrote in message: > On Sun, Mar 2, 2014 at 3:02 PM, Dave Angel wrote: >> The quote you make from the C standard doesn't mention malloc, so >> you're arguing different things. It's not the compiler that casts >> the malloc return valu

Re: [OT] Can global variable be passed into Python function?

2014-03-02 Thread Dave Angel
Chris Angelico Wrote in message: > On Mon, Mar 3, 2014 at 12:22 AM, Dave Angel wrote: >> Sure, for some definition of "usable". Overhead such as block >> size, freelist pointer etc., are obviously outside of the >> returned block. But the array size that&#

Re: [OT] Can global variable be passed into Python function?

2014-03-02 Thread Dave Angel
Chris Angelico Wrote in message: > > } > > so in that case, the array size is inside the malloc'd block, but it's > still invisible to the calling function. > Please quit using negative language when you're so vehemently agreeing with me. The data is sometimes not at the beginning of the m

Re:Origin of 'self'

2014-03-02 Thread Dave Angel
Westley Martínez Wrote in message: > I understand that in an object method the first argument in the object > itself, called self. However, it doesn't have to be called self, and can be > called anything. So my question is why is it called self and not this like > from C++ and Java. It's k

Re: Help with "Guess the number" script

2014-03-02 Thread Dave Angel
Scott W Dunning Wrote in message: > Here are the directions I’m stuck on and what I have so far, I’ll bold the part That assumes that people can see which parts of your message are bold. Rather a poor assumption in a text list like these two python forums. You should be posting in text,

Re: Working with the set of real numbers

2014-03-04 Thread Dave Angel
Oscar Benjamin Wrote in message: > On 4 March 2014 21:18, Chris Angelico wrote: > > > It does not take O(n*n) time. This is Newton iteration and for > well-behaved problems such as this it generates more than n digits > after n iterations. I modified my code to show the error (x**2 - y) at > ea

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