Re: error

2013-11-27 Thread Dave Angel
On Wed, 27 Nov 2013 16:37:37 -0800 (PST), speen saba wrote: p = [1,2] And below is the error. Evrything works fine untill class polar point, but when I try to pick point (instance) p in the list i.e x,y (1,2,3,1). It does not work. I mean p.x gets the error where it should give me the value

Re: Python project

2013-11-27 Thread Dave Angel
On Wed, 27 Nov 2013 17:43:27 -0800 (PST), ngangsia akumbo wrote: I a beginner in python. The first project is to build an online city guide start with my own city. I will need some support on where to get started. Are you experienced in other languages, in html? Is this your first time prog

Re: Python Unicode handling wins again -- mostly

2013-11-29 Thread Dave Angel
On Fri, 29 Nov 2013 21:28:47 -0500, Roy Smith wrote: In article , Chris Angelico wrote: > On Sat, Nov 30, 2013 at 1:08 PM, Roy Smith wrote: > > I would certainly expect, x.lower() == x.upper().lower(), to be True for > > all values of x over the set of valid unicode codepoints. Having >

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-03 Thread Dave Angel
On Tue, 3 Dec 2013 09:14:49 -0800 (PST), Piotr Dobrogost wrote: I find global getattr() function awkward when reading code. Me too. What is the reason there's no "natural" syntax allowing to access attributes with names not being valid Python identifiers in a similar way to other attributes

Re: The input and output is as wanted, but why error?

2013-12-03 Thread Dave Angel
On Tue, 3 Dec 2013 08:35:20 -0800 (PST), geezl...@gmail.com wrote: really, i dont know why.. :( How about because you do a system exit on the first line of their input? The one that's all digits. And even if you get past that, you only process one of their words. -- DaveA -- https://mail.p

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-04 Thread Dave Angel
On Wed, 4 Dec 2013 14:05:11 -0800 (PST), Piotr Dobrogost wrote: Object's attributes and dictionary's keys are quite different things. Right. So if you need arbitrary keys, use a dict. Attributes are keyed by identifiers, which are constrained. No problem. -- DaveA -- https://mail.python.or

Re: [newbie] struggling wth tkinter

2013-12-07 Thread Dave Angel
On Sat, 7 Dec 2013 08:52:08 -0800 (PST), Jean Dubois wrote: I'm trying to go through a tutorial on tkinter which has the code below as an example. The only thing I see when running it is a little popup with "Click mouse here to quit" which works as expected but always shows the following error

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Dave Angel
On Sat, 7 Dec 2013 23:45:06 -0800 (PST), Jean Dubois wrote: This is what I get: Traceback (most recent call last): File "./feet2meters.py", line 2, in from tkinter import * File "/home/jean/tkinter.py", line 2, in import Tkinter as tk ImportError: No module named Tkinter Regardle

Re: Fwd: Eliminate "extra" variable

2013-12-08 Thread Dave Angel
On Sun, 8 Dec 2013 12:58:18 -0800, Igor Korot wrote: It's input is the query result, so there is no looping when the function is called. It is called only once. Then why save part of the result in an instance attribute? Just return all of the results as a tuple. -- DaveA -- https://mail.py

Re: squeeze out some performance

2013-12-09 Thread Dave Angel
On Mon, 09 Dec 2013 15:54:36 +, Robin Becker wrote: On 06/12/2013 22:07, Joel Goldstick wrote: > end, start = start, end a similar behaviour for simple assignments for less than 4 variables the tuple method is faster. What does speed have to do with it? When you want to swap tw

Re: grab dict keys/values without iterating ?!

2013-12-10 Thread Dave Angel
On Wed, 11 Dec 2013 02:02:20 +0200, Tamer Higazi wrote: Is there a way to get dict by search terms without iterating the entire dictionary ?! I want to grab the dict's key and values started with 'Ar'... Your wording is so ambiguous that each respondent has guessed differently. I'm gue

Re: load_module for import entire package

2013-12-11 Thread Dave Angel
On Tue, 10 Dec 2013 23:28:31 -0800 (PST), Sergey wrote: def get_obj(): pkg = load_package_strict("tmp", basedir) from tmp import main return main.TTT() It is working, but if package code changes on disc at runtime and I call get_obj again, it returns instance of class, loaded for the

Re: Movie (MPAA) ratings and Python?

2013-12-12 Thread Dave Angel
On Wed, 11 Dec 2013 23:22:14 -0700, Michael Torrie wrote: From what I can see gmail is producing a multipart message that has a plaint text part and an html part. This is what gmail normally does and as far as I know it's RFC-compliant and that's what gmail always does. "Always does" does

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dave Angel
On Thu, 12 Dec 2013 13:27:16 -0800, Dan Stromberg wrote: On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards wrote: I haven't done a lot of UDP, but are you pretty sure UDP can't at least fragment large packets? What's a router or switch to do if the Path MTU isn't large enough for an original

Re: Eliminate "extra" variable

2013-12-15 Thread Dave Angel
On Sun, 15 Dec 2013 18:43:53 -0800, Igor Korot wrote: On Sun, Dec 15, 2013 at 4:58 PM, MRAB wrote: > When writing paths on Windows, it's a good idea to use raw string > literals or slashes instead of backslashes: > > conn = sqlite3.connect(r'c:\Documents and > Settings\Igor.FORDANWORK

Re: Wrapping around a list in Python.

2013-12-16 Thread Dave Angel
On Sun, 15 Dec 2013 21:26:49 -0800 (PST), shengjie.sheng...@live.com wrote: The idea is to grab the last 4 elements of the array. However i have an array that contains a few hundred elements in it. And the values continues to .append over time. How would i be able to display the last 4 elements

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Dave Angel
On Mon, 16 Dec 2013 10:26:14 -0800 (PST), Jean Dubois wrote: File "./test.py", line 7 def flush() ^ SyntaxError: invalid syntax A definition line needs to end with a colon (fix the other as well) -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and MIDI

2013-12-17 Thread Dave Angel
On Tue, 17 Dec 2013 08:45:28 -0800, Tobiah wrote: Is there a module out there that would let me send a predetermined list of midi messages to a MIDI device in such a way that the timing would be precise enough for music? Probably. I haven't tried it but I'd look first at pygame. Maybe first

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-18 Thread Dave Angel
On 18 Dec 2013 08:22:58 GMT, Steven D'Aprano wrote: On Wed, 18 Dec 2013 13:11:58 +1100, Chris Angelico wrote: > The one differentiation that I don't like is between the . and -> > operators. The distinction feels like syntactic salt. There's no context > when both are valid, save in C++ where

Re: Re: Experiences/guidance on teaching Python as a first programming language

2013-12-18 Thread Dave Angel
On Thu, 19 Dec 2013 01:55:10 +1100, Chris Angelico wrote: Sure, but you can figure out whether p is a local struct or a local pointer to some other struct by looking at its declaration. Do you also need to look at every usage of it? C is a glorified macro assembler. So the -> operator is not

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-19 Thread Dave Angel
On Thu, 19 Dec 2013 19:41:00 +1300, Gregory Ewing wrote: But it's not above inferring a dereferencing operation when you call a function via a pointer. If f is a pointer to a function, then f(a) is equivalent to (*f)(a) If the compiler can do that for function calls, ther

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-19 Thread Dave Angel
On Thu, 19 Dec 2013 16:32:37 +0100, Wolfgang Keller wrote: With Windows it *is* "normal". An experienced software developer once even explained the reason to me. When a single process on Windows does I/O, then the system essentially falls back to "single tasking". Or (non-)"cooperative mult

Re: How can i return more than one value from a function to more than one variable

2013-12-22 Thread Dave Angel
On Sun, 22 Dec 2013 15:41:06 -0800 (PST), Bob Rashkin wrote: On Sunday, December 22, 2013 4:54:46 PM UTC-6, dec...@msn.com wrote: > How am I supposed to do so I can return also a value to the variable y WITHOUT printing 'Now x =', w, 'and y = ' , z a second time ? You are apparently aski

Re: Variables in a loop, Newby question

2013-12-24 Thread Dave Angel
On Tue, 24 Dec 2013 09:54:48 -0800 (PST), vanommen.rob...@gmail.com wrote: You should always start by mentioning python version and o.s. import time global Sens_Raw1, Sens_Raw2, Sens_Raw3, Sens_Raw4, Sens_Raw5, Sens_Raw6, Sens_Raw7, Sens_Raw8, Sens_Raw9, Sens_Raw10 The global statement make

Re: Variables in a loop, Newby question

2013-12-26 Thread Dave Angel
On Thu, 26 Dec 2013 16:41:57 +1100, Steven D'Aprano wrote: Chris Angelico wrote: > Does anyone else have the vague feeling that the OP's problem might be > better served by simply importing the script (thus making those values > available to another Python script) than by any of these rat

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dave Angel
On Thu, 26 Dec 2013 14:06:17 -0800 (PST), matt.doolittl...@gmail.com wrote: On Thursday, December 26, 2013 2:22:10 PM UTC-5, Dan Stromberg wrote: > In [1]: import time > In [2]: time.time() > Out[2]: 1388085670.1567955 OK i did what you said but I am only getting 2 decimal places. You're

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dave Angel
On Thu, 26 Dec 2013 20:03:34 -0500, Terry Reedy wrote: On 12/26/2013 5:48 PM, Dave Angel wrote: > You're probably on Windows, which does time differently. With 3.3 and 3.4 on Windows 7, time.time() gives 6 fractional digits. >>> import time; time.time() 1388105935.9

Re: unicode to human readable format

2013-12-27 Thread Dave Angel
On Fri, 27 Dec 2013 02:43:58 -0800 (PST), tomasz.kaczo...@gmail.com wrote: can I ask you for help? when I try to print s[0] i vane the message: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128). how to solve my problem, please? First, what v

Re: Google Groups + this list

2013-12-27 Thread Dave Angel
On Thu, 26 Dec 2013 12:04:22 -0800 (PST), ru...@yahoo.com wrote: On 12/26/2013 05:41 AM, Chris Angelico wrote: > On Thu, Dec 26, 2013 at 4:13 PM, wrote: >> On 12/25/2013 09:17 PM, Chris Angelico wrote: >>>[...] >>> Or maybe I should have just filtered everything from Google Groups >>> into th

Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Dave Angel
On Fri, 27 Dec 2013 07:40:29 -0800 (PST), matt.doolittl...@gmail.com wrote: I am on Ubuntu 12.10. I am still working with the 2 decimal places. Sometime ago i had this issue and I forget how i solved it. maybe i used datetime? thanks! Now I'm stumped. 2.7.3 on Ubuntu 12.04 and time.time giv

Re: Python 2.x and 3.x usage survey

2014-01-01 Thread Dave Angel
On Wed, 01 Jan 2014 14:38:59 +0200, Steve Hayes wrote: >>> python g:\work\module1.py File "", line 1 python g:\work\module1.py ^ Which gave a different error the previous time I did it. But, hey, it worked from the DOS prompt C:\Python32>python g:\work\module1.py Hel

Re: need to print seconds from the epoch including the millisecond

2014-01-02 Thread Dave Angel
On Thu, 2 Jan 2014 16:23:22 + (UTC), Grant Edwards wrote: AFAIK, that's irrelevent. time.time() returns a float. On all the CPython implementations I know of, that is a 64-bit IEEE format, which provides 16 decimal digits of precision regardless of the granularity of the system time va

Re: function to split strings and lists on predicate

2014-01-06 Thread Dave Angel
On Mon, 06 Jan 2014 06:48:11 +, Mark Lawrence wrote: I came across this over the weekend http://paddy3118.blogspot.co.uk/2013/10/unifying-pythons-string-and-lis t.html. I couldn't come up with a solution to the fsplit function that seemed in any way cleaner. What can our nest of avid

Re: class inheritance python2.7 vs python3.3

2014-01-06 Thread Dave Angel
On Mon, 6 Jan 2014 09:14:08 -0800 (PST), jwe.van.d...@gmail.com wrote: I have problems with these two classes: class LPU1() : You forgot to derive from object. That's implied on 3.x, but you say you're also running on 2.7 Without naming your base class you're asking for an old style clas

Re: Drawing shaded area depending on distance with latitude and altitude coordinate

2014-01-06 Thread Dave Angel
On Mon, 6 Jan 2014 12:08:19 -0800 (PST), Isaac Won wrote: dis1 = [[]]*1 for c in range(0,275): dis1[0].append(dis[c]) So dis1 has 1 row in it. But contourf is expecting many rows, matching the length of lat. I'm guessing you have to fill in the others. cs = plt.

Re: python copy selected lines from one file to another using argparse or getopt

2014-01-08 Thread Dave Angel
On Wed, 8 Jan 2014 13:51:40 -0800 (PST), sagarnild...@gmail.com wrote: I am trying to write a program in python which searches for user specified words in a txt file and copies the selected lines containing that word into another file. John Gordon has given you a good start on argument parsing

Re: Recover handle to shadowed builtin?

2014-01-08 Thread Dave Angel
On Wed, 8 Jan 2014 14:52:10 -0500, Roy Smith wrote: I'm working with ipython's pylab mode, which replaces the builtin sum() with the one from numpy: In [105]: sum Out[105]: Is there any way to recover a reference to the builtin sum()? goodsum=__builtins__.sum -- DaveA -- https://ma

Re: Time zones and why they change so damned often (was: the Gravity of Python 2)

2014-01-09 Thread Dave Angel
On Thu, 9 Jan 2014 15:14:55 +1100, Chris Angelico wrote: [1] For those who aren't right up on timezone trivia, AZ has no DST. Similarly the Australian state of Queensland does not shift its clocks. And Indiana. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Send array back in result from urllib2.urlopen(request, postData)

2014-01-10 Thread Dave Angel
On Fri, 10 Jan 2014 12:57:59 -0800 (PST), vanommen.rob...@gmail.com wrote: No idea about the php.. In python when i do para = result.read() print para the output is: [null,null,null,null,null,"J"] That's a string that just looks like a list. This is correct according to the data in P

Re: Input Error issues - Windows 7

2014-01-10 Thread Dave Angel
On Fri, 10 Jan 2014 11:38:32 -0800 (PST), bryan.kardi...@gmail.com wrote: It's in the following directory on my machine C:\workspace\PyFoo\src\foo In that folder is __init__.py (created automatically) and foo.py foo.py looks like this class foo(): Ned has pointed out your path prob

Re:python first project

2014-01-11 Thread Dave Angel
ngangsia akumbo Wrote in message: > Hi everyone, > > I have been around this group for some time and i saw that we have very > helpful people here. > Welcome to the group, and to Python. > i have been learning python just for about 5 months now and i have been given > a task to do. This w

Re: python first project

2014-01-11 Thread Dave Angel
ngangsia akumbo Wrote in message: > On Saturday, January 11, 2014 2:06:41 PM UTC+1, Dave Angel wrote: >> >> I second the recommendation for version 3. And I suggest that if >> >> this is a business assignment, it's a lot harder than you think. >>

Re:Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

2014-01-11 Thread Dave Angel
pintreo mardi Wrote in message: > Hi, I've just begun to learn programming, I have an open question for the > group: > Is the Python language an all in one computer language which could replace C, > C++, Java etc.. I only ask becuase I am starting off with python and I want > to learn everythi

Re:Python example source code

2014-01-12 Thread Dave Angel
ngangsia akumbo Wrote in message: > where can i find example source code by topic? > Any help please > http://code.activestate.com/recipes/langs/python/ http://code.activestate.com/recipes/sets/2-python-cookbook-edition-2/ http://shop.oreilly.com/product/mobile/0636920027072.do http://www.mi

Re:plotting slows down

2014-01-13 Thread Dave Angel
norman.elli...@gmail.com Wrote in message: > First let me say I have not done much python programming! > I am running Python 2.7.3. > I am trying to use python as a front end to a simple oscilloscope. > Ultimately I intend to use it with my micropython board. > > At the moment I am just developin

Re: plotting slows down

2014-01-13 Thread Dave Angel
Chris Angelico Wrote in message: > On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly wrote: >> On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel wrote: >>> Next, please repost any source code with indentation preserved. >>> Your message shows it all flushed to the left ma

Re: plotting slows down

2014-01-14 Thread Dave Angel
Norman Elliott Wrote in message: > > I cannot see how to change from html to text mode in chromium or within the > group. > You already did post in text mode, my error. The new newsreader I'm using apparently eats tabs. -- DaveA Android NewsGroup Reader http://www.piaohong.tk/ne

Re:plotting slows down

2014-01-14 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Mon, 13 Jan 2014 08:26:11 -0500, Dave Angel wrote: > >> norman.elli...@gmail.com Wrote in message: > >>> [code] >>> #!/usr/bin/python >>> from graphics import * >> >> First things first. what ope

Re:dictionary with tuples

2014-01-14 Thread Dave Angel
Igor Korot Wrote in message: > Hi, ALL, > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. dict = {} dict[(1,2)]

Re:Question about object lifetime and access

2014-01-15 Thread Dave Angel
Asaf Las Wrote in message: > Hi community > Welcome. > > Multithreading will be enabled in uwsgi and 'p' will be used for read only. > > Questions are: > - what is the lifetime for global object (p in this example). The name will be visible in this module until the application shuts down

Re: Compiling main script into .pyc

2014-01-16 Thread Dave Angel
MRAB Wrote in message: > On 2014-01-17 02:56, bob gailer wrote: >> On 1/16/2014 8:01 PM, Sam wrote: >>> One thing I observe about python byte-code compiling is that the main >>> script does not gets compiled into .pyc. Only imported modules are compiled >>> into .pyc. >>> >>> May I know how can

Re:use class in class

2014-01-21 Thread Dave Angel
Robert Voigtländer Wrote in message: > Hi, > > I have a problem using a class object within another class. > It is about the line: > > self.openlist.append(Node(self.start, None, 0, 0)) > > If I use it in __init__ it works. If I use it in calcRoute(self) I get the > following error: local v

Re: [newbie] advice and comment wanted on first tkinter program

2014-01-22 Thread Dave Angel
Jean Dupont Wrote in message: > Op maandag 20 januari 2014 07:24:31 UTC+1 schreef Chris Angelico: >> On Mon, Jan 20, 2014 at 3:04 PM, Jean Dupont wrote: >> > I started a thread "[newbie] starting geany from within idle does not >> > work" > I did try to do the same on my linux desktop compute

Re:No overflow in variables?

2014-01-22 Thread Dave Angel
Philip Red Wrote in message: > Hi everyone. First of all sorry if my english is not good. > I have a question about something in Python I can not explain: > in every programming language I know (e.g. C#) if you exceed the max-value of > a certain type (e.g. a long-integer) you get an overflow. H

Re: Self healthcheck

2014-01-22 Thread Dave Angel
Asaf Las Wrote in message: > On Wednesday, January 22, 2014 10:56:30 AM UTC+2, Frank Millman wrote: >> >> class MainObject: >> def __init__(self, identifier): >> self._del = delwatcher('MainObject', identifier) >> class delwatcher: >> def __init__(self, obj_type, identifier): >>

Re:Initialise dictionary of dictionary

2014-01-23 Thread Dave Angel
Ayushi Dalmia Wrote in message: > I need to initialise a dictionary of dictionary with float values. I do not > know the size of the dictionary beforehand. How can we do that in Python > Do what? There's no concept of pre-initializing a dictionary, and there's no specific limit to its eventu

Re:generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Dave Angel
Vincent Davis Wrote in message: > (something about your message seems to make it unquotable) 64gig is 4^18, so you can forget about holding a string of size 4^50 If memory size is your issue, why not make the function a generator, by replacing the append with a yield? -- DaveA -- http

Re: SIngleton from __defaults__

2014-01-23 Thread Dave Angel
Johannes Schneider Wrote in message: > On 22.01.2014 20:18, Ned Batchelder wrote: >> On 1/22/14 11:37 AM, Asaf Las wrote: >> Chris is right here, too: modules are themselves singletons, no matter >> how many times you import them, they are only executed once, and the >> same module object is pro

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Dave Angel
Vincent Davis Wrote in message: > I didn't really study the code, and the fact that there's a nested function could mess it up. But if it were a straightforward function with exactly one append, , then replacing the append with a yield would produce the string one character at a time. -

Re: Class and instance related questions.

2014-01-24 Thread Dave Angel
Asaf Las Wrote in message: > On Friday, January 24, 2014 10:45:30 PM UTC+2, Chris Angelico wrote: >> On Sat, Jan 25, 2014 at 7:32 AM, Asaf Las wrote: >> > On Friday, January 24, 2014 6:37:29 PM UTC+2, Chris Angelico wrote: >> >> >> It's possible to unbind the name, but every instance retains a

Re: Need Help with Programming Science Project

2014-01-24 Thread Dave Angel
kvxde...@gmail.com Wrote in message: > Alright. I have the code here. Now, I just want to note that the code was not > designed to work "quickly" or be very well-written. It was rushed, as I only > had a few days to finish the work, and by the time I wrote the program, I > hadn't worked with Py

Re:Remove unwanted characters from column

2014-01-26 Thread Dave Angel
matt.s.maro...@gmail.com Wrote in message: > School assignment is to create a tab separated output with the original given > addresses in one column and then the addresses split into other columns (ex, > columns for city, postal code, street suffix). > > Here is my code: > > inHandler = open(i

Re:buggy python interpretter or am I missing something here?

2014-01-26 Thread Dave Angel
me Wrote in message: > I'm writing a linux daemon in python 2.x to process batches of GPS/GIS > data and I'm running into something that seems to break the expected > program flow in a REALLY BAD WAY. > > Consider the attached template script and execute it with the -h option. > It is fallin

Re:fseek In Compressed Files

2014-01-30 Thread Dave Angel
Ayushi Dalmia Wrote in message: > Hello, > > I need to randomly access a bzip2 or gzip file. How can I set the offset for > a line and later retreive the line from the file using the offset. Pointers > in this direction will help. > Start with the zlib module. Note that it doesn't handle all

Re:Try-except-finally paradox

2014-01-30 Thread Dave Angel
Jessica Ross Wrote in message: > I found something like this in a StackOverflow discussion. def paradox(): > ... try: > ... raise Exception("Exception raised during try") > ... except: > ... print "Except after try" > ... return True > ... fina

Re:1 > 0 == True -> False

2014-01-30 Thread Dave Angel
Thibault Langlois Wrote in message: > Hello, > > $ python > Python 2.7.4 (default, Sep 26 2013, 03:20:26) > [GCC 4.7.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. 1 > 0 == True > False (1 > 0) == True > True 1 > (0 == True) > True > >

Re: fseek In Compressed Files

2014-01-30 Thread Dave Angel
Ayushi Dalmia Wrote in message: > On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote: >> Hello, >> >> >> >> I need to randomly access a bzip2 or gzip file. How can I set the offset for >> a line and later retreive the line from the file using the offset. Pointers >> in th

Re: 1 > 0 == True -> False

2014-01-30 Thread Dave Angel
Rotwang Wrote in message: > On 30/01/2014 12:49, Dave Angel wrote: >> [...] >> >> For hysterical reasons, True and False are instances of class >> bool, which is derived from int. So for comparison purposes >> False==0 and True==1. But in my opinion, you sh

Re: fseek In Compressed Files

2014-02-01 Thread Dave Angel
Ayushi Dalmia Wrote in message: > > > The size of this file will be 10 GB. The version of Python I am using is > 2.7.2. Yes, performance is an important issue. > Then the only viable option is to extract the entire file and write it to a temp location. Perhaps as you extract it, you could

Re: Tkinter widgets into classes.

2014-02-01 Thread Dave Angel
Lewis Wood Wrote in message: > Oh and another question, say I make another window in the program itself > using this: > > def secondwindow(): > root2=Tk() > root2.mainloop() > > Would it be possible for me to use some code which would return True if one > of these windows is currently

Re:Python prime numbers

2014-02-01 Thread Dave Angel
Panagiotis Anastasiou Wrote in message: > Hi i'm new in programming and in python and i have an assignment that i cant > complete. I have to Write a Python program to compute and print the first 200 > prime numbers. The output must be formatted with a title and the prime > numbers must be prin

Re:Python prime numbers

2014-02-01 Thread Dave Angel
Panagiotis Anastasiou Wrote in message: > Hi i'm new in programming and in python and i have an assignment that i cant > complete. I have to Write a Python program to compute and print the first 200 > prime numbers. The output must be formatted with a title and the prime > numbers must be prin

Re: Tkinter widgets into classes.

2014-02-01 Thread Dave Angel
Lewis Wood Wrote in message: > >> (deleting doublespaced googlegroups trash) >> >> >> To put it another way, you only want one mainloop in your code. >> >> -- >> >> DaveA > > But I can click the button Multiple times and it will create multiple windows? > Not using the function you show

Re: __init__ is the initialiser

2014-02-02 Thread Dave Angel
Chris Angelico Wrote in message: > > > [1] Scrub the RAM clean and return it to the computer, put the 1 bits > onto the stack for subsequent reuse, and throw all the useless 0 bits > out onto the heap. > But don't you realize, we have to keep the zero bits around, so the one bits have some

Re:Python 3.3 and Pygame 19.2a install problems

2014-02-02 Thread Dave Angel
edvoge...@gmail.com Wrote in message: > That being said there is a base.pyd file but not a base.dll. I understand > .pyd files are a type of dll. Could there be something about Win7 doesn't > like about that naming convention? > > Please advise. > > I highly doubt that. Most Windows dlls

Re: __init__ is the initialiser

2014-02-02 Thread Dave Angel
Roy Smith Wrote in message: > In article , > Dave Angel wrote: > >> Chris Angelico Wrote in message: >> > >> > >> > [1] Scrub the RAM clean and return it to the computer, put the 1 bits >> > onto the stack for subsequent reuse, and

Re: __init__ is the initialiser

2014-02-02 Thread Dave Angel
Skip Montanaro Wrote in message: > On Sun, Feb 2, 2014 at 9:14 PM, Dave Angel wrote: >> And when the q-bits get entangled up, we won't know the question >> till after the answer has collapsed. > > Won't looking at the answer change it? > No, looking at it

Re: fseek In Compressed Files

2014-02-03 Thread Dave Angel
Ayushi Dalmia Wrote in message: > On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote: >> Hello, >> >> >> >> I need to randomly access a bzip2 or gzip file. How can I set the offset for >> a line and later retreive the line from the file using the offset. Pointers >> in th

Re: Finding size of Variable

2014-02-04 Thread Dave Angel
Ayushi Dalmia Wrote in message: >> getsizeof() gives you the size of the list only; to complete the picture you >> >> have to add the sizes of the lines. >> >> >> >> However, why do you want to keep track of the actual memory used by >> >> variables in your script? You should instead con

Re:Finding size of Variable

2014-02-04 Thread Dave Angel
Ayushi Dalmia Wrote in message: > > Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even properly specifying your problem. To get the "total" size of a list of strings, try (untested): a = sys.getsizeof

Re: kivy

2014-02-05 Thread Dave Angel
Rustom Mody Wrote in message: > On Wednesday, February 5, 2014 1:25:43 AM UTC+5:30, bharath wrote: >> please help im just frustrated after writing a long code and seeing that it >> isn't working.. > > Prior to Kernighan and Ritchie people did tend to write 'a long code' > and then check that i

Re: Finding size of Variable

2014-02-05 Thread Dave Angel
Ayushi Dalmia Wrote in message: > On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: >> On 2014-02-04 14:21, Dave Angel wrote: >> >> > To get the "total" size of a list of strings, try (untested): >> >> > >> >&

Re:parse a csv file into a text file

2014-02-05 Thread Dave Angel
Zhen Zhang Wrote in message: > Hi, every one. > > I am a second year EE student. > I just started learning python for my project. > > I intend to parse a csv file with a format like > > 3520005,"Toronto (Ont.)",C > ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 > 2466023,"Montr

Re:[Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread Dave Angel
dave em Wrote in message: > > > Fixed the error and am now onto the next issue. > > Solution was to return a list (I think) and then break out the components of > the list and put in the variable. Here is how we did it: > > secretWord = getRandomWord(words) > print('The secretWord is ' + str

Re: parse a csv file into a text file

2014-02-06 Thread Dave Angel
Zhen Zhang Wrote in message: > > I am currently running python 2.7. > > Yes, i thought there must be a print function in python like fprint in C++ > that allows you to print into a file directly. > But i google about "print string into text file" I got answers using > f.write() instead. :) >

Re: parse a csv file into a text file

2014-02-06 Thread Dave Angel
Dave Angel Wrote in message: > Zhen Zhang Wrote in message: >> > >> I am currently running python 2.7. >> >> Yes, i thought there must be a print function in python like fprint in C++ >> that allows you to print into a file directly. >> But i go

Re:Question about `list.insert`

2014-02-06 Thread Dave Angel
cool-RR Wrote in message: > Hi, > > I'm curious. If I append an item to a list from the left using `list.insert`, > will Python always move the entire list one item to the right (which can be > super-slow) or will it check first to see whether it can just allocate more > memory to the left of

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Dave Angel
cstrutto...@gmail.com Wrote in message: > > I didn't realize I could use formatting with triple quoted strings. I will > look into that. > You probably realize this, but formatting does not work on literals of any kind. It works on str objects, which can be created by any kind of litera

Re: Google Cloud Platform and GlassSolver Project

2014-02-09 Thread Dave Angel
eliasbylar...@gmail.com Wrote in message: > Also I should mention that I will credit whomever writes the scripts. I have > contacted Google on their Compute Engine which would execute these scripts. I > am await a reply! > It might help if you mention that you're talking about the Rubic cube,

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Dave Angel
Wesley Wrote in message: > >> > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx >> > always exist in pair. So, now, how to change the sequence to >> > a1,b1,...,an,bn, with time complexity as O(n) and space as O(1). >> >> >> >> The two halves of the list are already s

Re:Drawing polygons in python turtle

2014-02-10 Thread Dave Angel
genius...@gmail.com Wrote in message: > Hi > can anyone help finding the angle to draw different polygons shapes > > in this example > > import turtle > wm = turtle.Screen() > alex = turtle.Turtle() > for i in range(5): > alex.left(216) > alex.forward(50) > wm.exitonclick() > > Why d

Re:Get a datetime with nanoseconds

2014-02-11 Thread Dave Angel
Igor Korot Wrote in message: > Construct a datetime. timedelta object, and add it to your datetime. mytime += datetime. timedelta (microseconds=nano//1000) -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: pip3.x error using LIST instead of list

2014-02-11 Thread Dave Angel
Mark Lawrence Wrote in message: > > > No matter what I try I can't get the subcommands in lower-case when I > have caps lock on, is there a simple work-around for this as well? :) > You could do what I've done for my own DOS, Windows, and Linux computers for years: disable the caps-lock ke

Re:Python programming

2014-02-11 Thread Dave Angel
ngangsia akumbo Wrote in message: > Please i have a silly question to ask. > No silly questions, just silly answers. > How long did it take you to learn how to write programs? > An hour, twenty years. It took an hour to learn how the keypunch worked, where the manuals were mounted, and

Re: (-1)**1000

2014-10-24 Thread Dave Angel
Terry Reedy Wrote in message: > On 10/22/2014 4:27 AM, ast wrote: >> Hello >> >> If i am writing (-1)**1000 on a python program, will the >> interpreter do (-1)*(-1)*...*(-1) or something clever ? > > The answer depends on the implementation. > >> In fact i have (-1)**N with N an integer potenti

Re: I am out of trial and error again Lists

2014-10-24 Thread Dave Angel
Seymore4Head Wrote in message: > On Fri, 24 Oct 2014 09:54:23 -0700 (PDT), Rustom Mody > wrote: > >>Totally befuddled myself! >> >>Are you deliberately misspelling list to lst >>and hoping the error will go away. >> >>And Puh LEESE >>dont post screen shots of good ol ASCII text > > I didn't do

Re:% symbol in python

2014-10-28 Thread Dave Angel
satishmlm...@gmail.com Wrote in message: > key > rowhtml = '%s\n" > > what does % mean in first line of code and > what does %%(%s)s mean in second line of code > > kindly explain > Please post Python code, and we can try to comment on it. Those extra and thingies are really killing my menta

Re: Anyone know the solution

2014-10-28 Thread Dave Angel
Cameron Simpson Wrote in message: > On 28Oct2014 09:07, ngangsia akumbo wrote: >>This is a sample code on how to read data from a file >> >>files1 {} >> >>result = open("file1.txt") >>for line in result: >>file1 = line>split() >>files1.append(file1) >>result.close() >>file1.sort() >>file1.rev

Re: set environmental variable from python

2014-10-30 Thread Dave Angel
On 10/30/2014 09:22 PM, Artur Bercik wrote: I have to set environmental variable in my windows PC as follows: variable name: GISBASE value: C:\GRASS-64 Is it possible to set it from python? Which Python? I'll have to assume 3.x import sys sys.path.append("C:\\GRASS-64") But how to give

Re: set environmental variable from python

2014-10-31 Thread Dave Angel
On 10/30/2014 10:40 PM, Artur Bercik wrote: On Fri, Oct 31, 2014 at 11:30 AM, Zachary Ware < zachary.ware+pyl...@gmail.com> wrote: On Thursday, October 30, 2014, Artur Bercik wrote: Dear Dave Angel Thanks for your answer. I am using Python 2.7 I want to set it permanently. I have

<    4   5   6   7   8   9   10   11   12   13   >