Re: parse a csv file into a text file

2014-02-06 Thread Dave Angel
Zhen Zhang zhen.zhang.u...@gmail.com 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

Re: parse a csv file into a text file

2014-02-06 Thread Dave Angel
Dave Angel da...@davea.name Wrote in message: Zhen Zhang zhen.zhang.u...@gmail.com 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

Re:Question about `list.insert`

2014-02-06 Thread Dave Angel
cool-RR ram.rac...@gmail.com 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

Re: kivy

2014-02-05 Thread Dave Angel
Rustom Mody rustompm...@gmail.com 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

Re: Finding size of Variable

2014-02-05 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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): a = sys.getsizeof (mylist ) for item in mylist

Re:parse a csv file into a text file

2014-02-05 Thread Dave Angel
Zhen Zhang zhen.zhang.u...@gmail.com 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

Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread dave em
+ '') gameIsDone = True Any help to get us past this error message is most appreciated. Thanks in advance, Dave -- https://mail.python.org/mailman/listinfo/python-list

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

2014-02-05 Thread dave em
On Wednesday, February 5, 2014 7:21:29 PM UTC-7, dave em wrote: Hello, Background. My 11 y/o son and I have taken on the task to learn python and work our way through the http://inventwithpython.com/chapters/ book. - We are currently on Chapter 9 and trying to modify the hangman

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

2014-02-05 Thread Dave Angel
dave em daveandem2...@gmail.com 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

Re: Finding size of Variable

2014-02-04 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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

Re:Finding size of Variable

2014-02-04 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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

Re: fseek In Compressed Files

2014-02-03 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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.

Re: __init__ is the initialiser

2014-02-02 Thread Dave Angel
Chris Angelico ros...@gmail.com 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

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 have

Re: __init__ is the initialiser

2014-02-02 Thread Dave Angel
Roy Smith r...@panix.com Wrote in message: In article mailman.6316.1391387539.18130.python-l...@python.org, Dave Angel da...@davea.name wrote: Chris Angelico ros...@gmail.com Wrote in message: [1] Scrub the RAM clean and return it to the computer, put the 1 bits onto the stack

Re: __init__ is the initialiser

2014-02-02 Thread Dave Angel
Skip Montanaro s...@pobox.com Wrote in message: On Sun, Feb 2, 2014 at 9:14 PM, Dave Angel da...@davea.name 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 is what

Re: fseek In Compressed Files

2014-02-01 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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

Re: Tkinter widgets into classes.

2014-02-01 Thread Dave Angel
Lewis Wood fluttershy...@gmail.com 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

Re:Python prime numbers

2014-02-01 Thread Dave Angel
Panagiotis Anastasiou panas...@gmail.com 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

Re:Python prime numbers

2014-02-01 Thread Dave Angel
Panagiotis Anastasiou panas...@gmail.com 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

Re: Tkinter widgets into classes.

2014-02-01 Thread Dave Angel
Lewis Wood fluttershy...@gmail.com 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

Re:fseek In Compressed Files

2014-01-30 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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

Re:Try-except-finally paradox

2014-01-30 Thread Dave Angel
Jessica Ross deathwea...@gmail.com 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 ...

Re:1 0 == True - False

2014-01-30 Thread Dave Angel
Thibault Langlois thibault.langl...@gmail.com 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 What am I

Re: fseek In Compressed Files

2014-01-30 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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.

Re: 1 0 == True - False

2014-01-30 Thread Dave Angel
Rotwang sg...@hotmail.co.uk 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 should never take

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(inFile,

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

2014-01-26 Thread Dave Angel
me no...@all.net 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

Re: Class and instance related questions.

2014-01-24 Thread Dave Angel
Asaf Las roeg...@gmail.com 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 r@gmail.com wrote: On Friday, January 24, 2014 6:37:29 PM UTC+2, Chris Angelico wrote: It's possible to unbind the name, but

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 Python

Re:Initialise dictionary of dictionary

2014-01-23 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com 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

Re:generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Dave Angel
Vincent Davis vinc...@vincentdavis.net 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

Re: SIngleton from __defaults__

2014-01-23 Thread Dave Angel
Johannes Schneider johannes.schnei...@galileo-press.de 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

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Dave Angel
Vincent Davis vinc...@vincentdavis.net 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

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

2014-01-22 Thread Dave Angel
Jean Dupont jeandupont...@gmail.com 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 jeandupont...@gmail.com wrote: I started a thread [newbie] starting geany from within idle does not work I did try to do

Re:No overflow in variables?

2014-01-22 Thread Dave Angel
Philip Red filippo.biolc...@googlemail.com 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

Re: Self healthcheck

2014-01-22 Thread Dave Angel
Asaf Las roeg...@gmail.com 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,

Re:use class in class

2014-01-21 Thread Dave Angel
Robert Voigtländer r.voigtlaen...@gmail.com 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

Re: Compiling main script into .pyc

2014-01-16 Thread Dave Angel
MRAB pyt...@mrabarnett.plus.com 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

Re:Question about object lifetime and access

2014-01-15 Thread Dave Angel
Asaf Las roeg...@gmail.com 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

Re: plotting slows down

2014-01-14 Thread Dave Angel
Norman Elliott norman.elli...@gmail.com 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

Re:plotting slows down

2014-01-14 Thread Dave Angel
Steven D'Aprano st...@pearwood.info 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 operating system are you using, and where did you get

Re:dictionary with tuples

2014-01-14 Thread Dave Angel
Igor Korot ikoro...@gmail.com Wrote in message: Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdbpython 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: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 developing it.

Re: plotting slows down

2014-01-13 Thread Dave Angel
Chris Angelico ros...@gmail.com Wrote in message: On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel da...@davea.name wrote: Next, please repost any source code with indentation preserved. Your message shows it all flushed

Re:Python example source code

2014-01-12 Thread Dave Angel
ngangsia akumbo ngang...@gmail.com 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/

Re:python first project

2014-01-11 Thread Dave Angel
ngangsia akumbo ngang...@gmail.com 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

Re: python first project

2014-01-11 Thread Dave Angel
ngangsia akumbo ngang...@gmail.com 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. For example, handling dollars

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 bigearl...@outlook.com 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

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

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

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 ros...@gmail.com 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: 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

Re: Recover handle to shadowed builtin?

2014-01-08 Thread Dave Angel
On Wed, 8 Jan 2014 14:52:10 -0500, Roy Smith r...@panix.com wrote: I'm working with ipython's pylab mode, which replaces the builtin sum() with the one from numpy: In [105]: sum Out[105]: function numpy.core.fromnumeric.sum Is there any way to recover a reference to the builtin sum()?

[issue20162] Test test_hash_distribution fails on RHEL 6.5 / ppc64

2014-01-07 Thread Dave Malcolm
Dave Malcolm added the comment: On Tue, 2014-01-07 at 16:30 +, Yury V. Zaytsev wrote: Yury V. Zaytsev added the comment: After lots of fiddling, I can tell you what's wrong with the macro: apparently it's a compiler bug, visible at -O2 and disappearing at -O1. Can you reduce

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 breamore...@yahoo.co.uk 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.

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

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 winef...@gmail.com 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.

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 invalid@invalid.invalid 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

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 hayes...@telkomsa.net wrote: python g:\work\module1.py File stdin, 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:\Python32python

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

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, ru...@yahoo.com wrote: On 12/25/2013 09:17 PM, Chris Angelico wrote: [...] Or maybe I should have just filtered everything from Google Groups

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

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 steve+comp.lang.pyt...@pearwood.info 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

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 tjre...@udel.edu 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.971099

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

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 rrash...@gmail.com 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

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 greg.ew...@canterbury.ac.nz 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

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 felip...@gmx.net 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

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 st...@pearwood.info 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,

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 ros...@gmail.com 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 -

Re: Python and MIDI

2013-12-17 Thread Dave Angel
On Tue, 17 Dec 2013 08:45:28 -0800, Tobiah tshep...@rcsreg.com 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

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

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 jeandubois...@gmail.com 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 --

Re: Eliminate extra variable

2013-12-15 Thread Dave Angel
On Sun, 15 Dec 2013 18:43:53 -0800, Igor Korot ikoro...@gmail.com wrote: On Sun, Dec 15, 2013 at 4:58 PM, MRAB pyt...@mrabarnett.plus.com wrote: When writing paths on Windows, it's a good idea to use raw string literals or slashes instead of backslashes: conn =

Re: Movie (MPAA) ratings and Python?

2013-12-12 Thread Dave Angel
On Wed, 11 Dec 2013 23:22:14 -0700, Michael Torrie torr...@gmail.com 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.

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 drsali...@gmail.com wrote: On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards invalid@invalid.invalid 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

Re: load_module for import entire package

2013-12-11 Thread Dave Angel
On Tue, 10 Dec 2013 23:28:31 -0800 (PST), Sergey sh0...@gmail.com 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,

Re: grab dict keys/values without iterating ?!

2013-12-10 Thread Dave Angel
On Wed, 11 Dec 2013 02:02:20 +0200, Tamer Higazi tamerito...@arcor.de 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

Re: squeeze out some performance

2013-12-09 Thread Dave Angel
On Mon, 09 Dec 2013 15:54:36 +, Robin Becker ro...@reportlab.com 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

Re: [newbie] struggling wth tkinter

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

Re: Fwd: Eliminate extra variable

2013-12-08 Thread Dave Angel
On Sun, 8 Dec 2013 12:58:18 -0800, Igor Korot ikoro...@gmail.com 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

Re: [newbie] struggling wth tkinter

2013-12-07 Thread Dave Angel
On Sat, 7 Dec 2013 08:52:08 -0800 (PST), Jean Dubois jeandubois...@gmail.com 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

[issue19901] tests fail due to unsupported SO_REUSEPORT when building Python 3.3.2-r2

2013-12-05 Thread Dave Malcolm
Dave Malcolm added the comment: [FWIW, this looks similar to an issue I ran into on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=913732 which was due to a mismatch between the kernel headers on the system vs the actually running kernel. I patched around it there with a downstream-only

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 p...@google-groups-2013.dobrogost.net 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.

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 p...@google-groups-2013.dobrogost.net 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

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

Re: Python Unicode handling wins again -- mostly

2013-11-29 Thread Dave Angel
On Fri, 29 Nov 2013 21:28:47 -0500, Roy Smith r...@panix.com wrote: In article mailman.3417.1385777557.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sat, Nov 30, 2013 at 1:08 PM, Roy Smith r...@panix.com wrote: I would certainly expect, x.lower() ==

Re: error

2013-11-27 Thread Dave Angel
On Wed, 27 Nov 2013 16:37:37 -0800 (PST), speen saba moonlightmadnes...@gmail.com 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

Re: Python project

2013-11-27 Thread Dave Angel
On Wed, 27 Nov 2013 17:43:27 -0800 (PST), ngangsia akumbo ngang...@gmail.com 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

Re: Excute script only from another file

2013-11-25 Thread Dave Angel
On Mon, 25 Nov 2013 02:52:46 -0800 (PST), Himanshu Garg hgarg.in...@gmail.com wrote: My motive is I will give scripts to somebody else and he should not run the script directly without running the parent script. Perhaps it should be a module, not a script. Have it protect itself with the

[issue19743] test_gdb failures

2013-11-25 Thread Dave Malcolm
Dave Malcolm added the comment: FWIW, I feel that it's worth just expecting failures with an *optimized* build: with an optimizing compiler, there's likely to always be some program counter location where the debugger is going to get confused for some variables. Given umpteen different

Re: Excute script only from another file

2013-11-24 Thread Dave Angel
On Sun, 24 Nov 2013 17:55:08 -0800 (PST), Himanshu Garg hgarg.in...@gmail.com wrote: Like, I have two scripts scrip1.py and script2.py and there is a line in script1.py to call script2.py as subprocess.call([python, script2.py]). Then this is should call script2 but I should not be able to

Re: Help me to print to screen as well as log

2013-11-23 Thread Dave Angel
On Sat, 23 Nov 2013 05:11:11 -0800 (PST), Himanshu Garg hgarg.in...@gmail.com wrote: How can I write to the same file from two different scripts opened at same time? Using what version of python and on what OS? Sone OS's will open the file exclusively by default. Others will let you stomp

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-22 Thread Dave Angel
Try posting in text, as some of us see nothing in your message. This is a text newsgroup, not html. Also make a subject line that summarizes your issue, not the urgency. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: using getattr/setattr for local variables in a member function

2013-11-21 Thread Dave Angel
On Fri, 22 Nov 2013 00:52:21 +, MRAB pyt...@mrabarnett.plus.com wrote: If I have a class that has some member functions, and all the functions define a local variable of the same name (but different type), is there some way to use getattr/setattr to access the local variables

Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Dave Angel
On 20 Nov 2013 00:17:23 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: problem by hand. I'll get you started by solving the problem for 7. Positive integers less than 23 are 1, 2, 3, 4, 5, 6. So let's start checking them for divisors: Where did 23 come from? - 1 is

Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Dave Angel
On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two

Re: Oh look, another language (ceylon)

2013-11-18 Thread Dave Angel
On 18 Nov 2013 14:30:54 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: - 15 bits for a length. 15 bits give you a maximum length of 32767. There are ways around that. E.g. a length of 0 through 32766 means exactly what it says; a length of 32767 means that the next two

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