[Tutor] font colours

2007-07-10 Thread Dave Pata
Hello, I am currently doing an assignment for school using python and im at the stage of make it look good and i need more colours. So if anyone has URL with a list of colours, or even a list established by yourself. Anything of the sort would be appreciated. P.S I dont know if this has any effect

[Tutor] GUI backgrounds using Tk

2007-07-10 Thread Dave Pata
Hello,   I was wondering if anyone knows how to insert graphic images, such as JPEG and BMP, into a simple Tk GUI and use them as the background. Any help will be appreciated.   Cheers.Crowded House Time on Earth – catch them live in the USA! Enter here. __

Re: [Tutor] file methods

2007-07-10 Thread Dave Kuhlman
mode, less data than what was requested may be returned, even if no size parameter was given. IPython is at: http://ipython.scipy.org/moin/ Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Code query..works in IDLE but not DrPython editor

2007-07-10 Thread Dave Kuhlman
hat DrPython is finding a different module random from that which Idle finds. I was tripped by a similar error. Idle and IPython both have my bin directory on sys.path (I'm on Linux), while standard Python does not. IPython was finding one of my modules in the bin directory, whereas standard

Re: [Tutor] Module imports

2007-07-11 Thread Dave Kuhlman
ur life." haha It is not that you should "try not to worry". It's that you are doing things the way you are intended to. And, you are probably in sync with the cosmos, too. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Dave Kuhlman
fter the "%" character. The mapping key selects the value to be formatted from the mapping. For example: >>> print '%(language)s has %(#)03d quote types.' % \ {'language': "Python", "#": 2} Pytho

[Tutor] Here is newbie doc on how to implement generators

2007-07-12 Thread Dave Kuhlman
rs, please give me a link. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-13 Thread Dave Kuhlman
On Fri, Jul 13, 2007 at 12:39:40PM +1200, John Fouhy wrote: > On 13/07/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: > > And, I have a question -- If you look at the example of the > > iterative (non-recursive) generator (the Doubler class), you will > > see that it walks

Re: [Tutor] scrips

2007-07-20 Thread Dave Kuhlman
listed? If not, you will need to find your script. 3. If your script is not in the current directory, either (1) change to the directory containing the script with the "cd" command or (2) use the full path to the script, as in: python c:\some\path\to\myscript.py Hope

Re: [Tutor] How to determine if every character in one string is in another string?

2007-07-20 Thread Dave Kuhlman
ib/re-syntax.html http://docs.python.org/lib/node46.html Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] IDLE Usage - was Interpreter Restarts

2007-07-22 Thread Dave Kuhlman
gle window. For more on screen, do "man screen" and look here: http://en.wikipedia.org/wiki/GNU_Screen Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-23 Thread Dave Kuhlman
On Mon, Jul 16, 2007 at 06:13:35PM -0400, Kent Johnson wrote: Kent - Rather than try to reply in detail to your suggestions, I've tried to ammend my document to reflect your comments. Thanks again for the help. Dave [good suggestions and corrections from Kent, snipped] -- Dave Kuhlman

Re: [Tutor] Running Python on Gentoo

2007-07-26 Thread Dave Kuhlman
On Thu, Jul 26, 2007 at 01:48:44PM -0600, Eric Brunson wrote: > > Do other interpreters work? > > Try: > > #!/usr/bin/perl > print "Perl Sucks!!!\n"; > > or: Or, try: #!/usr/bin/env python Dave -- Dave

Re: [Tutor] function declaration problems perhaps?

2007-07-25 Thread Dave Kuhlman
B(object): pass By the way, this is an important and fundamental subject about Python. When I teach classes on Python, I always need to explain Python's execution model, and I always struggle with it. So, anything you can tell me that would

Re: [Tutor] passing form data into a class

2007-07-31 Thread Dave Kuhlman
r__(self, name): if name in self.vardict: return self.vardict[name] else: raise AttributeError, 'Bunch has no attribute: %s' % name def test(): d = {'aaa': 111, 'bbb': 222, } b = Bunch(d) print b.aaa

Re: [Tutor] Which GUI?

2007-08-02 Thread Dave Kuhlman
and enables them to afford to offer more titles. (Sorry for off-topic post. I'm a library "true believer".) Dave > -- > Your friend, > Scott > > Sent to you from a Linux computer using Ubuntu Version 7.04 (Feisty Fawn) > __

Re: [Tutor] Python Editors .. which do you reccomend for a amateur?

2007-08-04 Thread Dave Kuhlman
ns well and has built-in debugging support. http://www.die-offenbachs.de/eric/index.html Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Books with exercises and problems to solve

2007-08-07 Thread Dave Kuhlman
on in the book. And, as a bonus, the discussion section will help to understand how the solution works and why it's a good way to solve the problem. There is also an on-line version, which is definitely worth looking at, but does not have the problem-solution-discussion format: http://aspn.a

Re: [Tutor] send os.system() output to tarfile?

2007-08-07 Thread Dave Kuhlman
stdout and stderr. tarfile will enable you to stuff that captured output into a tar.gz file. Also, see the zipfile module if you want to save into a zip file. With tarfile, you may have to write data to a temp file and then archive that. With zipfile, you can write content directly

Re: [Tutor] global question

2007-08-11 Thread Dave Kuhlman
8 inte = 11 agl = 14 # etc ## # outside1.py import globals def whatever(): x = globals.stre # etc ## Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] open multiple files

2007-08-15 Thread Dave Kuhlman
('*.txt') for name in names: infile = open(name, 'r') etc. etc infile.close() Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] iterate list items as lvalue

2007-08-20 Thread Dave Kuhlman
gt;>> for idx, item in enumerate(array): array[idx] = item * 2 >>> array [2, 4, 6, 8, 10] >>> array2 [2, 4, 6, 8, 10] Basically, this modifies the list "in place", rather than making a new list from the old one. Dave -- Dave Kuhlman

Re: [Tutor] Off Topic: xrange, WAS: Re: the and command

2007-08-24 Thread Dave Kuhlman
as to create the values when asked for them) except when a very large range is used on a memory-starved machine or when all of the range's elements are never used (such as when the loop is usually terminated with break). http://docs.python.org/lib/built-in-funcs.html#l2h-80

Re: [Tutor] user in put

2007-08-27 Thread Dave Kuhlman
: 'peaches, nectarines, cantaloupe' Note that we append each food to a list, then do string.join(). That's faster than doing multiple string concatenations. In this case there are not enough strings to make a difference. But, it's a good hab

Re: [Tutor] Variable scope for class?

2007-08-30 Thread Dave Kuhlman
a class does not create an enclosing scope. Actually, the particular edition of Alan's book that I have is old enough so that it does not discuss the Enclosing namespace, which came later to Python. The enclosing namespace not make a difference in your example, but does in mine. Dave --

Re: [Tutor] parsing response from SOAPpy request

2007-09-01 Thread Dave Kuhlman
s to those requests, but it does not (directly) generate or parse XML. SOAPpy does that for you. You have most likely already looked at those examples. So, maybe there is something that I don't understand about your question? Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Image Analysis

2007-09-11 Thread Dave Kuhlman
nk you. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] pythons xf86misc documentation ?

2007-09-23 Thread dave selby
Can anyone tell me where the documentation for pythons xf86misc module is, ie what methods are avalible ? Many thanks Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Dave Kuhlman
k at the "exec" command (http://docs.python.org/ref/exec.html). But, that's a dangerous way to code. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] creating the equivalent of string.strip()

2007-10-02 Thread Dave Kuhlman
ex is a Python-like language for writing Python C extensions in a Python-like language. Pyrex/Cython gets you much closer to C code than Python. Question: Someday will all the Python built-ins be implemented in Cython/Pyrex. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman

Re: [Tutor] slice lists and slicing syntax questions

2007-10-13 Thread Dave Kuhlman
d = c[2,5,6,8] print 'd:', d e = c[2] print 'e:', e test() Which prints out: d: [10, 25, 30, 40] e: 10 Was that what you wanted? Notice that "c[2,5,6,8]" results in passing a tuple to __getitem__, because it is the comm

Re: [Tutor] Variables in workspace

2007-10-13 Thread Dave Kuhlman
for. However, as your mother might say: That's what's good for you. Also, remember, in Python, global variables are just entries in the dictionary returned by globals(), anyway. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Complexity of list operations

2007-10-23 Thread Dave Kuhlman
for example: lst.insert(0, obj) and: obj = lst.pop() Also, this is probably a good place to mention deque (http://docs.python.org/lib/deque-objects.html), which attempts to reduce those costs. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman __

Re: [Tutor] calling a variable name

2007-10-23 Thread Dave Kuhlman
like me, is it sort of like saying that the costs are averaged out over a sequence of appends? Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] question re type()

2007-10-27 Thread Dave Kuhlman
port types if type(n) is types.IntType Or, is this a frivolous question that makes no difference? Dave > > Alan G. > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- D

Re: [Tutor] visualizing code structure / flow charting

2007-11-06 Thread Dave Kuhlman
ttp://wiki.python.org/moin/IntegratedDevelopmentEnvironments Two that I've looked at: - Geany -- http://geany.uvena.de/ - Eric -- http://www.die-offenbachs.de/eric/index.html -- Eric was easy to install on Debian GNU/Linux, but may be more of a

[Tutor] Q1: Any way for script to intercept a HUP signal ?

2007-11-16 Thread dave selby
Is there a way for a Python script to intercept a HUP signal sent to it ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ___ Tutor maillist - Tutor@python.org http

[Tutor] Q2: logging not working as expected

2007-11-16 Thread dave selby
ntains no messages and no error messages are generated. Anybody any ideas as to what I am doing wrong ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] More logging probs ...

2007-11-17 Thread dave selby
OTICE") logger.log("TESTING", "ALERT") ALERT is above NOTICE & should log I am suspicious of '(self.case[priority] | syslog.LOG_USER)' although it looks right and have tried LOG_LOCAL6 etc but still no joy

Re: [Tutor] More logging probs ...

2007-11-17 Thread dave selby
syslog.closelog() Still stuck Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] ElementTree - reading large XML files as file handles

2007-11-21 Thread Dave Kuhlman
s: http://www.prescod.net/python/pulldom.html http://www.ibm.com/developerworks/xml/library/x-tipulldom.html http://www.idealliance.org/papers/dx_xml03/papers/06-02-03/06-02-03.html http://www.idealliance.org/papers/dx_xml03/papers/06-02-03/06-02-03.html#pull Hope this helps. Dave --

[Tutor] unexpected signal behaviour

2007-11-24 Thread dave selby
.. thought it would continue its infinate loop. Any idea anyone ? Cheers Dave import os, sys, time, signal, ConfigParser, kmotion_logger class Kmotion_Hkd2: def __init__(self): self.snap_init = [ 0 for i in xrange(16) ] self.snap_count = [ 0 for i in

Re: [Tutor] adding a new folder to Python's importable modules search path

2007-11-26 Thread Dave Kuhlman
ot notation). See: http://docs.python.org/ref/import.html (and search for __init__) Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python CMS advice wanted

2007-11-27 Thread Dave Kuhlman
//zope.org/ And, I do not know anything about this one, but it looks interesting -- Skeletonz: http://orangoo.com/skeletonz/ You might also find helpful info at: http://www.cmsreview.com/ If you have success with one, please report back here with your experience, suggestions, etc. Dave -- Dave Kuhlman ht

Re: [Tutor] Indentation Issue and Blind People

2007-12-02 Thread Dave Kuhlman
ode distribution. In particular, these may be of interest: reindent.py and tabify.py. And, for those who feel that they must have some marker at the end of a block (in addition to an "out-dent"), look at Tools/scripts/pindent.py. Dave --

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread Dave Kuhlman
thing that looks a bit like an enum. If so, here is a Python idiom for enums: Mode_none, Mode_moving, Mode_inserting, Mode_jumping = range(4) action = Mode_moving if action == Mode_jumping: o o o - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___

Re: [Tutor] Using 'join ' function to create a string

2007-12-21 Thread Dave Kuhlman
;s problem, you could also try map() and a lambda: ', '.join(map(lambda x,y: '%s:%s' % (x, y, ), X, Y)) Or, maybe unrolling it makes it more readable: In [31]: fn = lambda x,y: '%s:%s' % (x, y, ) In [32]: ', '.join(map(fn, a, b)) Out[32]: '

[Tutor] Cant write new line at end of file append

2007-12-21 Thread dave selby
Hi all, I need to write a newline at the end of a string I am appending to a file. I tried ... journal.write('%s#%s\n' % (jpeg[:-4], self.snap_init[feed])) The text is all there but no new line at the end any idea what I am doing wrong ? ... thought \n would do it. Ch

Re: [Tutor] Learning about callbaks

2007-12-29 Thread Dave Kuhlman
perator" (parentheses). Here is a trivial example: def f1(x): print 'f1: %s' % x def f2(x): print 'f2: %s' % x def use_them(funcs): for func in funcs: func('abcd') def test(): funcs = [f1, f2]

Re: [Tutor] Mobile Python

2007-12-31 Thread Dave Kuhlman
60 http://sourceforge.net/projects/pys60/ There is an emulator, so you can test some of your code without even loading it onto a cell phone device. This sounds like exciting stuff. Please keep us informed about your progress. - Dave -- Dave

Re: [Tutor] Document Control System

2008-01-14 Thread Dave Kuhlman
, in contrast with content management might mean something slightly different to you. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] os.system() problem

2008-02-03 Thread dave selby
le /etc/motion/motion.2.conf [1] Thread is from /etc/motion/motion.1.conf [2] Thread is from /etc/motion/motion.2.conf [1] Thread started [2] Thread started [1] File of type 2 saved to: /var/lib/motion/20080203/01/tmp/175253.jpg ...etc ... I just can't work out why this is happenin

[Tutor] if ... else shorthand form ?

2008-02-09 Thread dave selby
0 I thought Python had a shorthand version of something like self.snap_init[i] = (items.has_keys('snapshot_interval'))?items['snapshot_interval']:0 Googled but no luck ... or is it my poor overloaded brain getting confused ? Cheers Dave

Re: [Tutor] if ... else shorthand form ?

2008-02-09 Thread Dave Kuhlman
On Sat, Feb 09, 2008 at 09:21:41AM +, dave selby wrote: > Hi all, > > Returning to python after a brief affair with C++, I have the following code > ... > > if (items.has_keys('snapshot_interval')): > self.snap_ini

Re: [Tutor] designing POOP

2008-02-10 Thread Dave Kuhlman
racted from: http://dirtsimple.org/2004/12/python-is-not-java.html Maybe I'm "old school", but I still use getters and setters for access from outside the class and direct access from within methods in the class. - Dave [some good arguments snipped] -- Dave Kuhlman

[Tutor] How do I destroy class instances ?

2008-02-24 Thread dave selby
I have created a list of class instances, works a treat. I need to be able to re __init__ the instances on a SIGHUP so I guess the best way is to destroy them & re make them. err ... how do I destroy an instance ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments.

Re: [Tutor] How do I destroy class instances ?

2008-02-24 Thread Dave Kuhlman
On Sun, Feb 24, 2008 at 04:14:02PM +, dave selby wrote: > I have created a list of class instances, works a treat. I need to be > able to re __init__ the instances on a SIGHUP so I guess the best way > is to destroy them & re make them. > > err ... how do I destroy an in

Re: [Tutor] How do I destroy class instances ?

2008-02-24 Thread dave selby
On 24/02/2008, Dave Kuhlman <[EMAIL PROTECTED]> wrote: > On Sun, Feb 24, 2008 at 04:14:02PM +0000, dave selby wrote: > > I have created a list of class instances, works a treat. I need to be > > able to re __init__ the instances on a SIGHUP so I guess the best way > &

[Tutor] IDLE will not appear under Win95 (Python 2.4.2)

2005-10-15 Thread Dave Shea
a clue but the Microsoft Knowledge Base article it refers to does not appear to exist (any more ?). Then again, it may be nothing to do with my actual IDLE problem. http://www.python.org/doc/faq/windows.html#id15 I look forward to receiving any help Cheers. Dave Sh

[Tutor] smtplib mail header problem

2005-12-06 Thread dave s
= '[EMAIL PROTECTED]' def email_test(): for trys in xrange(10): try: mail_server = SMTP(email_SMTP) mail_server.login('', '') subject = 'Test Email'

Re: [Tutor] smtplib mail header problem

2005-12-06 Thread dave s
On Tuesday 06 December 2005 21:13, Liam Clarke-Hutchinson wrote: > Hi Dave, > > IIRC The first argument to sendmail() is the name of the account that's > sending... So when you include your subject there, it seems your ISP is > somewhat forgiving. > > Liam Clarke-Hutchins

Re: [Tutor] smtplib mail header problem

2005-12-07 Thread dave s
gt; > Regards, > > Liam Clarke-Hutchinson > Thanks for that I 'pydoc smtplib' but got somewhat confused :) Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] smtplib mail header problem

2005-12-10 Thread dave s
; > Liam > But its all worth it, problem now solved & work gets my emails :) Cheers Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Looking for an open source project

2006-04-13 Thread Dave S
sourceforge but could not work out how to filter for Python. Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Looking for an open source project

2006-04-14 Thread Dave S
On Friday 14 April 2006 11:07, Kent Johnson wrote: > Dave S wrote: > > Hi all, > > > > I have been playing around with Python for a while now and am looking > > for open source KDE projects written in Python that I can help with / > > learn from. > > >

Re: [Tutor] _next

2006-05-30 Thread Dave Kuhlman
elegant. It also gives us the ability to write clearer and more maintainable code, for example, separating the producer and consumer parts of our code. But, it does so only if we can work out a clear and unconfused way to explain and teach it. Thanks f

Re: [Tutor] module versus file

2006-06-07 Thread Dave Kuhlman
cation imports the package or something in it. Dave [snip] -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Offtopic observation

2006-06-07 Thread Dave Kuhlman
; > question clearly. 1. That's why we write and ask questions: to make things clear to ourselves. 2. And the reason we teach (Python etc) is so that students ask us questions and we are forced to explain ourselves, which enables us to understand what we are talking about. Dave &

Re: [Tutor] making a python program part of xhtml

2006-06-09 Thread Dave Kuhlman
n scroll down and look for "Templating Engines": http://wiki.python.org/moin/WebProgramming Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difference between popens

2006-06-09 Thread Dave Kuhlman
(after the command runs), read from that pipe to get the results of your command (i.e. the text that the command wrote to stdout). Here is a simple example that uses popen2:: import os def test(): instream, outstream = os.popen2('grep dave') instream.write(&#x

Re: [Tutor] numpy speed problems

2006-06-09 Thread Dave Kuhlman
.org/, *and* check into the mailing lists there. That's not just for your benefit; if there are problems with SciPy, the people at that list will want to know about them. [snip] Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [tutor] debug process

2006-06-13 Thread Dave Kuhlman
http://ipython.scipy.org/ Embedding IPython: http://ipython.scipy.org/doc/manual/node9.html Using the Python debugger (pdb) (with IPython): http://ipython.scipy.org/doc/manual/node10.html Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ T

Re: [Tutor] Interfaces in Python

2006-06-13 Thread Dave Kuhlman
rder for this to work, I believe you will need: my_zope_install/lib/python on your PYTHONPATH. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I Give Up.

2006-06-18 Thread Dave Kuhlman
ry reference, etc) are reference docs, they do not replace tutorial books like "Learning Python" or "Learn to Program Using Python" (by Alan Gauld, who also posts on this list). Still I've found so much of what I need in those documents, that I have a hard time complaining.

[Tutor] A few more notes on Python interfaces

2006-06-22 Thread Dave Kuhlman
find these notes here: http://www.rexx.com/~dkuhlman/python_comments.html#interfaces I'll welcome any comments. And, thanks for the interesting and helpful discussion on interfaces, and other topics, on this list. Dave -- Dave Kuhlman http://www.rexx.com/~dku

Re: [Tutor] NumPy

2006-06-28 Thread Dave Kuhlman
There is also a NumPy page. But, I believe that NumPy is built into SciPy. See: - http://www.scipy.org/more_about_SciPy - http://numpy.org/ Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.p

Re: [Tutor] File compression

2006-06-28 Thread Dave Kuhlman
python.org/lib/module-zipfile.html - http://docs.python.org/lib/module-zlib.html - http://docs.python.org/lib/module-gzip.html - http://docs.python.org/lib/module-bz2.html Dave > > -mtw > > On Wed, Jun 28, 2006 at 12:19:19AM +0200, Magnus Wirström ([EMAIL PROTECTED]) > wrote: >

Re: [Tutor] Splitting text

2006-06-29 Thread Dave Kuhlman
> a.count('ATTTA') > 2 > And, if you need to search for a more complicated pattern, consider using the regular expression module (re): >>> import re >>> a = 'TCCCTGCGGCGCATGAGTGACTGGCGTATTTAGCCCGTCACATTTA' >>> pat = re.compile('A

[Tutor] can't import module

2006-07-02 Thread Dave S
]:~/my_files/my_gg/gg1.4/get_data$ ./live_datad.py Traceback (most recent call last): File "./live_datad.py", line 15, in ? from logger import log ImportError: No module named logger OK that's my problem [EMAIL PROTECTED]:~/my_files/my_gg/gg1.4/get_data$ echo $PYTHONPATH /hom

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 11:29, Kent Johnson wrote: > Dave S wrote: > > > [EMAIL PROTECTED]:~/my_files/my_gg/gg1.4/get_data$ ./live_datad.py > > > > Traceback (most recent call last): > > File "./live_datad.py", line 15, in ? > > from logger impo

Re: [Tutor] can't import module

2006-07-02 Thread Dave Kuhlman
On Sun, Jul 02, 2006 at 11:55:24AM +0100, Dave S wrote: [snip] > > Thanks for replying :) > > The app is fairly big and distributed around the gg1.4 directory. I get the > feeling that 'from logger import log' is the first of a lot of import > problems, this scrip

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 17:02, Dave Kuhlman wrote: > On Sun, Jul 02, 2006 at 11:55:24AM +0100, Dave S wrote: > > [snip] > > > Thanks for replying :) > > > > The app is fairly big and distributed around the gg1.4 directory. I get > > the feeling that 'from lo

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
Here goes ... I have two files test1 and test2 ... [EMAIL PROTECTED]:~$ ls -l total 37620 drwx-- 8 dave dave 4096 2006-06-30 23:26 Desktop drwxr-xr-x 9 dave dave 4096 2006-06-15 22:48 google-earth drwxr-xr-x 13 dave dave 4096 2006-05-27 09:51 my_files drwxr-xr-x 2 dave dave

Re: [Tutor] can't import module

2006-07-02 Thread Dave Kuhlman
On Sun, Jul 02, 2006 at 10:32:51AM -0700, Danny Yoo wrote: > > PYTHONPATH=/home/dave/my_files/my_gg/gg1.4/configs:/home/dave/my_files/my_gg/gg1.4/logs:/home/dave/my_files/my_gg/gg1.4/get_data:/home/dave/my_files/my_gg/gg1.4/gg_utils:/home/dave/my_files/my_gg/gg1.4/ipc:/home/dave/my_files

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
ed you could do that. It sound like a good solution and a lot less messy than the way I have created my own modules & scripts. Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] SOLVED :)

2006-07-02 Thread Dave S
On Sunday 02 July 2006 18:32, Danny Yoo wrote: > > PYTHONPATH=/home/dave/my_files/my_gg/gg1.4/configs:/home/dave/my_files/my > >_gg/gg1.4/logs:/home/dave/my_files/my_gg/gg1.4/get_data:/home/dave/my_file > >s/my_gg/gg1.4/gg_utils:/home/dave/my_files/my_gg/gg1.4/ipc:/home/dave/

Re: [Tutor] can't import module

2006-07-02 Thread Dave S
On Sunday 02 July 2006 18:48, Dave Kuhlman wrote: > On Sun, Jul 02, 2006 at 10:32:51AM -0700, Danny Yoo wrote: > > > PYTHONPATH=/home/dave/my_files/my_gg/gg1.4/configs:/home/dave/my_files/ > > >my_gg/gg1.4/logs:/home/dave/my_files/my_gg/gg1.4/get_data:/home/dave/my_ > >

[Tutor] Basic QT query

2006-07-14 Thread Dave S
same problem. Also I am struggling with "QObject.connect(self.tickerevent, PYSIGNAL("ticker"), self.hello)" I am unsure of what the source of the connect is - I suspect my guess of self.tickerevent is wrong. The source of the event should be PYSIGNAL("ticker"

Re: [Tutor] Basic QT query #2

2006-07-14 Thread Dave S
On Friday 14 July 2006 19:21, Dave S wrote: > Hi all, > > I am trying to get to grips with QT, putting a friendly face on some of my > apps :) Its early days and my first attempt but I expected the following to > print 'hi it works' every second. > > There problem

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Dave Kuhlman
key = 'k%d' % idx ...: d1[key] = idx * 10 ...: ...: In [3]: d1 Out[3]: {'k0': 0, 'k1': 10, 'k2': 20, 'k3': 30, 'k4': 40, 'k5': 50, 'k6': 60, '

Re: [Tutor] [SOLVED] Basic QT query #2

2006-07-15 Thread Dave S
On Friday 14 July 2006 23:21, Dave S wrote: > On Friday 14 July 2006 19:21, Dave S wrote: > > Hi all, > > > > I am trying to get to grips with QT, putting a friendly face on some of > > my apps :) Its early days and my first attempt but I expected the > > follo

Re: [Tutor] What is the square bracket about?

2006-07-22 Thread Dave Kuhlman
And, for example, add code to set a few temporary variables: tmp1 = args[0] tmp2 = tmp1[:0] Then, in the debugger, inspect tmp1 and tmp2. Or, just add a few print statements. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] loops to assign variables

2006-07-22 Thread Dave Kuhlman
of the object model and execution model of Python. And, that's why compile-time (static) type checking in Python is either impossible or would require type inference. And, also, that's why the following statements all have exactly the same effect: total = 5 locals()['total'] = 5 exec('total = 5') But, again, as Lloyd said, don't do that. (1) Use a dictionary of your own and do a look up. Or, (2) implement a class that does a lookup. Or, (3) use one of the other suggestion made on this list. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] search path

2006-07-22 Thread Dave Kuhlman
vironment variable PYTHONPATH. How you do that depends on your platform (Linux, MS Windows, ...). Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] loops to assign variables

2006-07-22 Thread Dave Kuhlman
On Sat, Jul 22, 2006 at 01:41:17PM -0400, Kent Johnson wrote: > Dave Kuhlman wrote: [snip] > > And, also, that's why the following statements all have exactly > > the same effect: > > > > total = 5 > > locals()['total'] = 5 > > ex

[Tutor] open(file, 'rw') problem

2006-07-26 Thread Dave S
Good morning, I am having a problem with file open, read & write. The example shows my problem. I would have expected it to print a sequence 1,2,3,4 incrementing every time it is run. #!/usr/bin/env python import os, shutil, time basher_dir = '/home/dave/PodCasts' bit_bucke

Re: [Tutor] open(file, 'rw') problem

2006-07-27 Thread Dave S
On Thursday 27 July 2006 09:08, Andre Engels wrote: > 2006/7/27, Dave S <[EMAIL PROTECTED]>: > > It appears to be a problem with me opening the file as 'rw' although I > > have googled and opening as 'rw' appears legal. Can you only open a file > >

[Tutor] Notes on namespaces, scopes, etc

2006-07-27 Thread Dave Kuhlman
a few days ago. I'm hoping that my notes show that I learned from that thread. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Dave Kuhlman
On Thu, Jul 27, 2006 at 05:34:13PM +0100, Alan Gauld wrote: > Hi Dave, > > You are causing yourself some confusion by still treating variables > as something other than a name. Your first paragraph says: > > (Actually, functions and classes are just variables that hold > r

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Dave Kuhlman
On Thu, Jul 27, 2006 at 12:46:44PM -0400, Kent Johnson wrote: > Dave Kuhlman wrote: > > I've written up a few notes on Python namespaces and scopes. If > > anyone has corrections, comments, or suggestions, I'd appreciate > > them. You can find my comments here:

<    1   2   3   4   5   6   7   8   9   10   >