Re: [Tutor] Why does the Hex builtin function in Python return a string ?

2008-08-25 Thread John Fouhy
2008/8/26 John Fouhy <[EMAIL PROTECTED]>: > The hex() function (and oct() too) provides you with a different > string representation from the default. If you want to change python > to display integers in hex instead of decimal by default, I can't help > you.. (well, maybe

Re: [Tutor] Concatenation vs formatting

2008-09-01 Thread John Fouhy
from another perspective, it's less than half a millisecond different. So, like Bob said, unless you're really doing a whole lot of this, go for whatever makes for the clearest or most maintainable code. (and don't forget ''.join if you're doing a lot of concatenation) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How Compute # of Days between Two Dates?

2008-09-01 Thread John Fouhy
t: >>> datetime.datetime.today() datetime.datetime(2008, 9, 2, 13, 17, 13, 345793) >>> datetime.datetime.today().time() datetime.time(13, 17, 15, 786378) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Checking for a Valid Date

2008-09-01 Thread John Fouhy
e place to go for docs on strptime/strftime format strings) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread John Fouhy
count = 0 while count < x: i += 5 count += fives(i) return i Although I am curious to know how long it took your algorithm to find the answer for 7**20 ... -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread John Fouhy
21_113045' >>> dt1 = datetime.datetime.strptime(timeStr, '%Y%m%d_%H%M%S') >>> dt2 = dt1 + datetime.timedelta(seconds=200) >>> print dt2.strftime('%Y%m%d_%H%M%S') 20080321_113405 You can find the format codes for strptime and strftime in the documentation

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread John Fouhy
ately. datetime.strptime only came in with Python 2.5, IIRC. The Python 2.4 version is: d = datetime.datetime(*(time.strptime(date_string, format)[0:6])) (i.e. that corresponds to "d = datetime.datetime.strptime(date_string, format)") -- John. __

Re: [Tutor] absolute beginner

2008-09-10 Thread John Fouhy
through doing. The best thing a tutorial can do for you is give you a progression of things to do :-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] problem with building dict w/ SQlite SELECTS in loop

2008-09-15 Thread John Fouhy
a single select statement? i.e. cur.execute("select code, start from codes where code != '' and style = ? and start >= ? and start < ?", (style, self.start_datestring, self.end_datestring)) (heck, you could select code, start, style form codes -- pull all the information you need in a single query, and skip the loop altogether..) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] problem with building dict w/ SQlite SELECTS in loop

2008-09-16 Thread John Fouhy
self.style_data_dict = {} for code, start, style in results: self.style_data_dict.setdefault(style, []).append((code, start)) This will leave your data dict in a different form from the one in your original code.. but you could change it by: for style in self.style_data_dict: self.style_dat

[Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread John Toliver
limit? thanks in advance, John T ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread John Fouhy
hest familiesSorted = [] for inc in incomes: familiesSorted.extend(familiesByIncome[inc]) ## HTH! -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] trying to put Tkinter widget handlers in a module

2008-09-28 Thread John Fouhy
r ### main code ### c = Checkbutton( master, text='Check if yes', variable=self.var, command=handlers.handleCheckButton(self) ) ### I think this would work, though I have not checked it. Whether it is a

Re: [Tutor] Multiple windows in Tkinter

2008-10-02 Thread John Fouhy
w'] for c in colours: b = Button(left, text=c, command=changeColour(c)) b.pack(side=TOP, expand=True) tk.mainloop() -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help Python String Search

2008-10-06 Thread John Fouhy
gt; strings = ['I need help', 'This string does not contain the word', 'I no >>> longer need help'] >>> for s in strings: ... if 'help' in s: ... print s ... I need help I no longer need help >>> If you are worr

Re: [Tutor] Difficult loop?

2008-10-15 Thread John Fouhy
program is to calculate vector similarities in the > context of the letters in a machine learning approach called "Memory-based > learning" I did wonder what it was for ;-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difficult loop?

2008-10-15 Thread John Fouhy
when you get stuck. For example, you could look at the code I wrote and figure out how to make the last change yourself :-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How Do I tell Which Versions of Libraries/Modules I Have?

2008-10-15 Thread John Fouhy
2008/10/16 Wayne Watson <[EMAIL PROTECTED]>: > That's the question in the Subject. Can Idle tell me? I see a Path Browser. You could check the __version__ attribute. Not all modules provide it, though. (e.g.: import pickle ; pickle.__version

Re: [Tutor] remap tab key to 4 spaces in a Tkinter text box

2008-10-30 Thread John Fouhy
ed, > after thinking about it). Not good. My Tkinter is a bit rusty, but the latter approach might be the one to take. Just remember to return 'break' at the end of your callback. This prevents the event from being passed on to the text widget. -- John. _

[Tutor] request from john caldwell to get off the mailing list

2008-11-02 Thread john caldwell
Please take me oof of the mailing list. thank you [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] using rect.inflate()

2008-11-05 Thread John Fouhy
70 pixels to 20 pixels) I'm not sure what's going on with the height, though. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] validating decimal class

2008-11-05 Thread John Fouhy
ecimal(13) >>> type(d) == decimal.Decimal True -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] please help with sqlite replace function

2008-11-06 Thread John Fouhy
p first :-) ). Alternatively, you could define the replace() function in python and then add it to your database: see http://www.initd.org/pub/software/pysqlite/doc/usage-guide.html#creating-user-defined-functions . HTH. -- John. ___ Tutor maill

Re: [Tutor] How to use function from specific module and then switch to other module

2008-11-06 Thread John Fouhy
2008/11/7 Ertl, John C CIV 63134 <[EMAIL PROTECTED]>: > The idea is as I step through a list I want to use a different function > (same name but from a different module) for each element in the list. How > do I have a generic way to do this. > > for example for point 1 I

Re: [Tutor] accessing list from a string

2008-11-25 Thread John Fouhy
he most devious attacks. If I, as an evildoer, can control e, it seems that I could set it to: ,), __import__('os').system('rm -rf /' I've never thought of myself as all that devious :-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] 'for' loops

2008-12-01 Thread John Fouhy
for i in range(n): # do something, possibly involving i range(n) is a function that will produce the list [0, 1, 2, ..., n-1]. Tutorials should cover this, so I'm not sure if I'm telling you anything new. If there's something particular y

Re: [Tutor] try except block for multiple statements

2008-12-01 Thread John Fouhy
, no -- but you could always use a loop. attrs = ['a', 'b', 'c', 'd'] for attr in attrs: try: fo.write('A = %s\n' % getattr(plan, attr)) except AttributeError: pass -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] using windows wide proxy settings

2008-12-03 Thread John Fouhy
-> Connection -> LAN settings. Install pythonwin, then look here: http://www.microsoft.com/technet/scriptcenter/scripts/python/network/client/list/nwlspy02.mspx?mfr=true General Microsoft Windows python script repository: http://www.microsoft.com/technet/scriptcenter/scripts/python/d

Re: [Tutor] Graph theory

2008-12-03 Thread John Fouhy
building your own is part of the attraction :-) ). -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] list.index() question

2008-12-08 Thread John Fouhy
If you wanted to roll your own solution (the fnmatch module is a bit obscure, I think), you could do something with os.path.splitext: files = os.listdir('.') extensions = [os.path.splitext(f)[1] for f in files] if '.flac' in extensions: print 'FLAC files found!'

Re: [Tutor] advice on regex matching for dates?

2008-12-11 Thread John Fouhy
espace for formatting. See this article for an example: http://diveintopython.org/regular_expressions/verbose.html HTH! -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Functions and Mainloop()

2009-01-08 Thread John Fouhy
es > around? I thought about adding the function to the event handler, but I was > hoping I could just submit the function to the mainloop. Hi Jonathan, You can use the after() method. See here: http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-hand

[Tutor] How do we upload multiple files simultaneously?

2009-01-10 Thread john dow
Dear All, I a newbie to python... my problem is to upload more than one file on a single go. I have an option open is using some FTP client... Is there any other methods like what mega upload uses??? thanks in advace.. regards, john -- View this message in context: http

Re: [Tutor] Modify a dictionary using csv.DictWriter

2009-01-12 Thread John Fouhy
let the DictWriter know that the header of the csv file > corresponds to all the > fieldnames? To avoid typing all the names. If you read in the csv file using DictReader, you should have access to the field names as keys of the dictionaries (although possibly not in the same order

Re: [Tutor] quoting and escaping

2009-01-13 Thread John Fouhy
1 >{"aKey" : "a value with "literal quotes" in it"} > ^ > SyntaxError: invalid syntax Is it an option to just do: >>> b = """{'aKey':'a value with "literal quotes" in it&#

Re: [Tutor] Sys.stdin Question

2009-01-13 Thread John Fouhy
uess you are using unix/linux. Source: http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/ I found that by searching for "python stdin non-blocking". This is because "blocking" is jargon for "waiting until something happens". In this case, st

Re: [Tutor] Sys.stdin Question

2009-01-13 Thread John Fouhy
" showed up] You could "fix" it by adding a delay to your consumer script.. as long as none of your input scripts take longer than the delay to generate output. Or do things differently, which might be smarter :-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Corpora

2009-01-15 Thread John Fouhy
2009/1/16 Ishan Puri : > Hi, > I was wondering if anyone could tell me where I can get corpora > containing IMs, or blogs or any internet communication? This is kind of > urgent. Have you tried the enron email dataset? http://www.cs.cmu.edu/~enron/ (google may turn up other link

Re: [Tutor] 2.5 vs 3k?

2009-01-19 Thread John Fouhy
st of what's new/different here: http://docs.python.org/3.0/whatsnew/3.0.html If any of that appeals to you, then go for it :-) An argument for _not_ migrating (yet) is that most 3rd party libraries are still python 2.x. I expect they'll start to change, though, and you might need to migrate eventu

Re: [Tutor] Finding the shortest word in a list of words

2009-01-19 Thread John Fouhy
gt; words ['he', 'man', 'woman', 'children'] This essentially does the decorate-sort-undecorate in one step, where len is the function we used to do the decoration. Of course, this is not necessarily the best answer for your particular problem. The problem

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
;*.txt'), ('Stuff', '*.stf'), ('Et cetera', '*.etc')]) http://www.pythonware.com/library/tkinter/introduction/x1164-data-entry.htm -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
x27;, '*.fits'), ('Dogs', '*.dog')]) If that's not what you want, you need to explain yourself better.. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
and write the data to it. It's up to you to make sure the data is in the right format.. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
tput appropriately. At any rate, your question seems more to do with the image library you are using, and nothing at all to do with tkFileDialog.asksaveasformat. It's probably PIL -- the Python Image Library. See the documentation here: http://www.pythonware.com/library/pil/handbook/index.htm -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Program: Newton's Method

2009-01-25 Thread John Fouhy
2009/1/26 Donna Ibarra : > I need to write a program that implements Newton's method [...] What problems are you having? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] operator, mult

2009-01-27 Thread John Fouhy
;mult". I tried using "mul" which is in "operator" but that is > obviously not the same thing. It seems pretty obvious that operator.mul is what they mean (based on what the reduce function does). Perhaps it's a typo? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] operator, mult

2009-01-28 Thread John Fouhy
*p_0**(m_0-1) * (p_1-1)*p_1**(m_1-1) * (p_2-1)*p_2**(m_2-1) * (p_3-1)*p_3**(m_3-1) which seems to match the description in the comment. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Installing python via ftp in virtual domain

2009-02-02 Thread John Fouhy
d be 64bit?) - wrong libraries It might be easier if you can build a statically-linked version of python -- although it appears that can have issues: http://bytes.com/groups/python/23235-build-static-python-executable-linux Or upload the python sources and buil

Re: [Tutor] Installing python via ftp in virtual domain

2009-02-02 Thread John Fouhy
nd play around with LD_LIBRARY_PATH. This is really a linux question, rather than a python question, though, so this may not be the best place to ask. (but see: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html and http://blogs.sun.com/ali/entry/avoiding_ld_library_p

Re: [Tutor] Alarm Clock (suggestions please)

2009-02-02 Thread John Fouhy
ke sure the hour and minutes are in-range. Perhaps you could add code to check whether the alarm time is more than a certain number of hours in the future. Depends how complex you want to make it. (you could also inspect sys.argv -- this would allow you to specify the time on the comman

Re: [Tutor] Fw: Installing Pyserial for Python27 on Win 7

2010-11-24 Thread John Smith
Hi, Walter - Thanks to you, pyserial is installed and imports into Python. Not having double backslashes was the latest problem that you got me through. I am grateful for the support and education you have given me. Cheers, John ___ Tutor maillist

[Tutor] lambda in python

2010-11-26 Thread john tsolox
since in Java i can pass an anonymous class to a function, and this anon class has member functions that can contain a body of implementation codes having the full expression of permissible syntax (if,for,while...), my question is, after seeing various examples of lambda in python being ALL one-l

[Tutor] Pyserial and invalid handle

2010-11-28 Thread John Smith
Can anybody tell me why the handle below is invalid? I'm running Win7. TIA, John Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import serial

Re: [Tutor] Pyserial and invalid handle

2010-11-28 Thread John Smith
On 11/28/2010 10:57 AM, Emile van Sebille wrote: On 11/28/2010 7:55 AM John Smith said... Can anybody tell me why the handle below is invalid? I'm running Win7. TIA, John Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 Type "copyright"

Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith
On 11/28/2010 8:06 PM, Walter Prins wrote: John, (snip stuff) Ugh, you're probably not going to like this. I've done some googling and it appears this may be a 64-bit issue with the "ctypes" module... apparently "64-bit ctypes can only import 64-bit libraries"

Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith
On 11/29/2010 4:20 PM, Emile van Sebille wrote: On 11/29/2010 1:44 PM John Smith said... But, when I tried it in Python, I got the same as before: >>> import serial >>> ser = serial.Serial(0, timeout = 1) out of curiosity, if you change the timeout above to 5 &

Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith
ser=403744 Emile I'll consider that, Emile. First, though, I would like to hear from Walter again after my last post. Thanks for your suggestions. Cheers, John ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Pyserial and invalid handle

2010-11-29 Thread John Smith
On 11/29/2010 9:41 PM, Rance Hall wrote: On Mon, Nov 29, 2010 at 8:21 PM, John Smith wrote: On 11/29/2010 5:56 PM, Emile van Sebille wrote: (snip) Hmmm... any chance you don't have administrative rights on the account performing this? I never got to Win7 (having stopped at XP) but I

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith
On 11/30/2010 10:37 AM, Walter Prins wrote: Hello John (snip) In any case, to fix it let's delete all instances of pySerial and then install it again, as follows: 1.) Open up your Python "site-packages" folder in Windows Explorer, e.g. open up: E:\Python27\lib\site-packages

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith
On 11/30/2010 6:23 PM, Walter Prins wrote: Hello John, (snip) Apparently so. Well, win32file is part of the PyWin32 package, which are a set of modules that wrap many Windows API's. I'm not sure why it was't/isn't required for PySerial 2.5 or whether as you say pe

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith
On 11/30/2010 7:27 PM, Adam Bark wrote: On 01/12/10 01:00, John Smith wrote: Hi, Walter - I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm guessing that the AMD versions are for the AMD processor). However, all of the exe offerings have the same "Python not found i

[Tutor] Slicing Tuples

2010-12-11 Thread John Russell
Last night I started working through a book (Beginning Python: Using Python 2.6 and Python 3.1) I bought to learn Python, and there is an example in it that doesn't make sense to me. There is an example on slicing sequences that goes like this: slice_me=("The", "next", "time", "we","meet","the",

Re: [Tutor] Slicing Tuples

2010-12-12 Thread John Russell
ing the time to answer and explain such a basic concept. I appreciate it! -jlr On Sat, Dec 11, 2010 at 6:39 PM, Steven D'Aprano wrote: > John Russell wrote: > > So, my question is this, and I realize that this is *very* basic - what is >> going on with the last element? Why is

[Tutor] Composing lists from both items and other lists

2011-02-01 Thread John Simon
x27;+', 'def', ')'] Of course, the star doesn't work there. Is there any easy, syntactically-lightweight way to get that output? Thanks, John ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Composing lists from both items and other lists

2011-02-01 Thread John Simon
Andre Engels gmail.com> writes > Is: > > [start] + items + [end] > > lightweight enough? Oh man, duh. I knew it was something simple. Thanks :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org

[Tutor] process and modify a list of strings, in place

2011-02-10 Thread John Martinetti
Hello - I'm a novice programmer, not even amateur level and I need some help with developing an algorithm to process a list of strings. I hope this list is tolerant of n00bs, if not, please let me know and I'll take this elsewhere. Some background. I cut up a text based report from a reporting

Re: [Tutor] process and modify a list of strings, in place

2011-02-11 Thread John Martinetti
o modify my code and I'll get back to the list if I have any other issues that I need help with. Lastly - this list is great...I think I'm going to learn a lot here. Thanks. On Thu, Feb 10, 2011 at 5:52 PM, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, John Martinetti wrote: >

Re: [Tutor] process and modify a list of strings, in place

2011-02-11 Thread John Martinetti
to have a list like this to get another set of eyes reviewing the code, very very helpful. Thanks again Steve for your response, I really appreciate it. I'll report back once I get the changes implemented. On Thu, Feb 10, 2011 at 7:31 PM, Steven D'Aprano wrote: > John Martinetti wrote

Re: [Tutor] process and modify a list of strings, in place

2011-02-12 Thread John Martinetti
Hi Mark - The characters skipped were unintentional, I sliced up the report based on starting/ending column numbers that I somewhat guessed and massaged by merely comparing the output of the openPOs list to the actual report. There might even been some room to massage those boundaries further to

Re: [Tutor] Conceptual Question About Use of Python for Employee Training Program

2011-06-25 Thread John Fabiani
On Saturday, June 25, 2011 06:18:14 am Adam Carr wrote: > Good Morning: > > I am very new to Python but I am enjoying the learning process. I have a > question about the application of Python to a problem at the industrial > business where I work. My two main questions are: > > 1. Can Python be u

[Tutor] Filling orders FIFO

2011-07-15 Thread Charles John
Hi I am new to python and was wondering what the best way to create an order(bid and offer) queue, then match a bid and offer so that if bid==offer, creates a filled order FIFO in python cgi using mysql? Does anybody have any ideas? It would be greatly appreciated. Best chuck ___

[Tutor] print to file probelm

2011-08-15 Thread John Collins
a long single line beginning with a "[", containing a mixture of integers and signed real numbers separated only by a commas, and ending in a "]". Any help to begin my understanding of print (re)assignments, and, fixing this script would be MOST welcome, thanks to you all!

Re: [Tutor] Windows vs Linux processing speed.

2011-10-14 Thread John Fabiani
On Friday, October 14, 2011 09:45:57 am Tony Pelletier wrote: > Hi, > > I have a question regarding the speed of my program on linux in comparison > to windows. > > I'm using geopy and contacting Google for geocodes for records in a csv I > created. Like such: > > try: > reader = csv.r

[Tutor] Remove python modules

2011-12-12 Thread John De
Hi, I want to build python-2.7.2 and omit some modules that I don't need in order to create a smaller Python interpreter. Am I able to do this? Any recommendations? Thank you ___ Tutor maillist - Tutor@python.o

[Tutor] new to programming and wondering about an IDE for Python on Linux

2012-02-27 Thread John Jensen
Hi All, I'm new to programming and wondering about an IDE for Python on Linux. I'd appreciate any feedback on this and good tutorials or books on Python 3 and the IDEs suggested. There are many available and I'm wondering what you as users find effective. Thanks, John_

Re: [Tutor] Tuple - Immutable ?

2012-03-08 Thread John Jensen
From: Steven D'Aprano To: tutor@python.org Sent: Thursday, March 8, 2012 7:51:33 AM Subject: Re: [Tutor] Tuple - Immutable ? col speed wrote: > I was just thinking about the immutability of things and tried this > (which -at least I- find interesting: >

[Tutor] which gets called

2012-04-06 Thread John Fabiani
Hi, I want to create a class that inherits two other classes. class NewClass( A,B) But both "A" and "B" contain a method with the same name ("onKeyDown"). If my "NewClass" does not contain something to override the methods which one would be called if myinstance = NewClass() myinstance.onKe

Re: [Tutor] which gets called

2012-04-06 Thread John Fabiani
On Friday, April 06, 2012 06:54:28 AM John Fabiani wrote: > Hi, > > I want to create a class that inherits two other classes. > > class NewClass( A,B) > > But both "A" and "B" contain a method with the same name ("onKeyDown"). > > If

[Tutor] user created lists

2012-04-11 Thread john moore
Hello Pyhton World, I'm new at this and was wondering how I create a number of user specified lists? Example: "How many list would you like to create?" User inputs 5 creates five lists, list1 [] list2 [] list3 [] list4 [] list5 [] I can create one with append, but I don't know how to loop it to

[Tutor] PYFTDI Library for FT232H

2012-08-02 Thread John Battle
string to one of them to start a data download and then receive straming data on the other one. I have a C program that will do this but I need to do it in Python. Any help would be gretly appreciated. Thanks John Battle ___ Tutor maillist - Tutor

[Tutor] understanding pydoc try

2012-08-30 Thread John Maclean
What does the first line from `pydoc try` actually mean? This does not look like the syntax that one is supposed to use. try_stmt ::= try1_stmt | try2_stmt I can write simple statements as shown below, but I want to actually understand what I am doing. try: import io print("import

Re: [Tutor] understanding pydoc try

2012-08-30 Thread John Maclean
On 08/30/2012 03:05 PM, Dave Angel wrote: On 08/30/2012 09:30 AM, John Maclean wrote: What does the first line from `pydoc try` actually mean? This does not look like the syntax that one is supposed to use. try_stmt ::= try1_stmt | try2_stmt You're looking at the first of thre

Re: [Tutor] understanding pydoc try

2012-08-30 Thread John Maclean
On 08/30/2012 05:15 PM, Alan Gauld wrote: On 30/08/12 15:43, John Maclean wrote: Thanks. This is a heck of a lot more clearer to me! BNF, huh? Another set TLA that I don't need to know ;-) Actually, BNF is one of those useful skills for any programmer because almost every langua

[Tutor] greater precision?

2012-10-29 Thread John Collins
her, but if I can squeeze out *at least* 15 sig figs, (30 or more would be better!) I'd be a happy camper! XNumbers addon for Excel allows over 200 sig figs by switching to base 256 IIRC. It is this with which I'd like to examine the output of these pyto scripts at finer re

[Tutor] greater precision?

2012-10-29 Thread John Collins
her, but if I can squeeze out *at least* 15 sig figs, (30 or more would be better!) I'd be a happy camper! XNumbers addon for Excel allows over 200 sig figs by switching to base 256 IIRC. It is this with which I'd like to examine the output of these pyto scripts at finer re

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
'machine' precision, one needs to change base 10 floats to a higher base, do foo, then come back. Sounds daunting! John. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
rr.write(str(dist) + "\n") if dist < 2.10005e-16: break # Output the points. for x, y, z in points: pprint(x, y, z) The nfaces.py used on the output from this is a tad longer! Well, yes, but only with some significant changes Well, it seems I may have to learn "

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
t lost me. Of more practical relevance may be something like gmpy <http://code.google.com/p/gmpy/> I've just had a peek. Looks like what I need. Haven't a clue if I'll understand how to 'patch it in' to the scripts. Doco read time! John. _

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
ecimal. The class name within that module is Decimal. A minor thing to me, a non programmer, but I do understand that being very precise is very important to programmers, so thank you! John. ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
o display. Hmm, well, I did modify the original script by setting the convergence test value to 2.005e-16 up from 1e-6, s, I 'guess' 15 sig.figs. will be OK. I'll have a go! That's 3 orders of magnitude better for a few key strokes! Great! (maybe...) John.

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
Hi Dave, You just lost me. If you don't use any transcendental functions, then a fraction has no quantization error. It's totally precise. Ah ha! Another light bulb moment - two in one night! Thank you Dave, and all! John. ___ Tuto

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
t after use', or will python just default back to what it sees next? I know this sounds silly, but to me the command 'looks' like it's setting a 'hidden pyton variable' to "15f" which may need to be explicitly revoked, or not,...??? John. ___

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
o many insights in one night - terrific! Wish I'd picked this language up *years* ago - it's so foreign to me now, yet so beautifully useful! Cheers, John. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
7f') '0.09952' Python says the precision is 15 decimal digits: >>> import sys >>> sys.float_info.mant_dig # bits of precision 53 >>> sys.float_info.dig# decimal digits 15 Regs, John. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
o back to year zero exercise I feel. John. On 30/10/2012 2:15 AM, Mark Lawrence wrote: It's 16 digits with 3.3.0. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] greater precision?

2012-10-29 Thread John Collins
Hi Mark, Thanks. I wouldn't know C if I fell over it. Until recently, the *only* language I'd ever used was (HP, GW)BASIC aside from Fortran 101, 3 decades ago! John. On 30/10/2012 2:45 AM, Mark Lawrence wrote: If you're more comfortable with C you can use printf style form

[Tutor] who makes FOR loop quicker

2015-08-05 Thread John Doe
To pass by reference or by copy of - that is the question from hamlet. ("hamlet" - a community of people smaller than a village python3.4-linux64) xlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] i = 0 for x in xlist: print(xlist) print("\txlist[%d] = %d" % (i, x)) if x%2 == 0

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Can You, please, elaborate this "..Passing in Python is different than in C or other languages..." 'Cause as far as I know - default major Python's implementation CPython is written in C. Joel Goldstick 於 08/05/2015 03:44 PM 寫道: On Wed, Aug 5, 2015 at 3:53 AM, John

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
TEMENT, which must be created only once. Any INITIATIONS make once. 'Cause it sucks CPU-memory-allocation-cycle. Does this point make sense for You? Joel Goldstick 於 08/06/2015 03:57 PM 寫道: On Thu, Aug 6, 2015 at 4:34 AM, John Doe wrote: Can You, please, elaborate this "..Passing in P

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
5 04:45 PM 寫道: On Thu, Aug 06, 2015 at 11:34:51AM +0300, John Doe wrote: Can You, please, elaborate this "..Passing in Python is different than in C or other languages..." Argument passing in Python is: - different to Perl, C, Scala, Algol and Pascal; - the same as Ruby, Lua, Apple

<    5   6   7   8   9   10   11   >