[Tutor] Question about autocomplete functionality

2012-06-12 Thread Richard Querin
Hi All,

I wrote a small utility several months ago to easily search a project list
(an excel spreadsheet) by project name or number etc. However I am thinking
of expanding it with the following sort of functionality - the ability to
add 'tags' to a given project (tags being just simple descriptive words
about a given project).

However, this is only really useful if I can keep a running list of all
tags that have ever been entered and use a sort of autocomplete
functionality to make them quicker to enter. And to reduce the number of,
and discourage the use of, 'almost duplicate' tags.

Are there any resources out there (libraries, tutorials etc) that could
help me figure this sort of autocomplete functionality out?

Thanks,
Richard
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How to find a substring within a list of items

2011-01-13 Thread Richard Querin
I have an object that contains about 3500 list items, each list containing
various data, some strings and some floats, like so:

['D', 123.4,'This is a project description', 'type', 52.1,'title']

What is the easiest way to search this list for a given string? So I want to
find out if this list contains the string 'scrip' anywhere within it (case
insensitive and including being just part of a larger string).

Incidentally, I'm using the xlrd module to read in a spreadsheet. I
effectively want to quickly pull out a list of lines from that spreadsheet
that contain that substring anywhere within them. Maybe there is a
better/faster way I should be doing this?

I'm trying to give employees here a better/faster way of filtering through
the company project list rather than opening up excel and doing a find
search each time.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to find a substring within a list of items

2011-01-13 Thread Richard Querin
On Thu, Jan 13, 2011 at 2:27 PM, Wayne Werner waynejwer...@gmail.comwrote:


 I don't know if either of these are the best options (they probably
 aren't), but they should work, and for 3500 it will probably loop faster
 than opening up excel.

 HTH,
 Wayne


Thanks Wayne. This would definitely be faster than getting Excel opened and
doing it there. Given Alan's great suggestion in only stepping through
string fields (this *does* have constant object formats) things should be
even quicker. Now to give them a nice simple GUI to do it in. :) Thinking
about wxPython (what I'm most used to), though it's been a while. Not sure
if there are better options for something simple like this.

Great help guys. Thanks.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] List processing question - consolidating duplicate entries

2007-11-29 Thread Richard Querin
On Nov 27, 2007 5:40 PM, Kent Johnson [EMAIL PROTECTED] wrote:


 This is a two-liner using itertools.groupby() and operator.itemgetter:

 data = [['Bob', '07129', 'projectA', '4001',5],
 ['Bob', '07129', 'projectA', '5001',2],
 ['Bob', '07101', 'projectB', '4001',1],
 ['Bob', '07140', 'projectC', '3001',3],
 ['Bob', '07099', 'projectD', '3001',2],
 ['Bob', '07129', 'projectA', '4001',4],
 ['Bob', '07099', 'projectD', '4001',3],
 ['Bob', '07129', 'projectA', '4001',2]
 ]

 import itertools, operator
 for k, g in itertools.groupby(sorted(data), key=operator.itemgetter(0,
 1, 2, 3)):
   print k, sum(item[4] for item in g)



I'm trying to understand what's going on in the for statement but I'm having
troubles. The interpreter is telling me that itemgetter expects 1 argument
and is getting 4.

I understand that groupby takes 2 parameters the first being the sorted
list. The second is a key and this is where I'm confused. The itemgetter
function is going to return a tuple of functions (f[0],f[1],f[2],f[3]).

Should I only be calling itemgetter with whatever element (0 to 3) that I
want to group the items by?

I'm almost getting this but not quite. ;)

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python CMS advice wanted

2007-11-27 Thread Richard Querin
Hi,

I've got a site that is currently a static site. While not unmanageable at
the moment (it's still pretty young), we've been entertaining thoughts of
converting it to a CMS system. I'm looking for some good suggestions based
on some simple criteria:

- Python based - I have a rudimentary knowledge of Python and like it, so
I'd prefer to go this route
- Simple - Our needs are not very complex, we're really just thinking about
maintainability and expandability.
- We want to be able to customize the look and layout of the site to our
whim.

I'm a complete newbie when it comes to CMS systems so I'm not sure whether
or not it might be better just to go with something like an install of
Wordpress instead.

Just looking for some suggestions. The current site btw is
http://screencasters.heathenx.org

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] List processing question - consolidating duplicate entries

2007-11-27 Thread Richard Querin
I'm trying to process a list and I'm stuck. Hopefully someone can help
me out here:

I've got a list that is formatted as follows:
[Name,job#,jobname,workcode,hours]

An example might be:

[Bob,07129,projectA,4001,5]
[Bob,07129,projectA,5001,2]
[Bob,07101,projectB,4001,1]
[Bob,07140,projectC,3001,3]
[Bob,07099,projectD,3001,2]
[Bob,07129,projectA,4001,4]
[Bob,07099,projectD,4001,3]
[Bob,07129,projectA,4001,2]

Now I'd like to consolidate entries that are duplicates. Duplicates
meaning entries that share the same Name, job#, jobname and workcode.
So for the list above, there are 3 entries for projectA which have a
workcode of 4001. (there is a fourth entry for projectA but it's
workcode is 5001 and not 4001).

So I'd like to end up with a list so that the three duplicate entries
are consolidated into one with their hours added up:

[Bob,07129,projectA,4001,11]
[Bob,07129,projectA,5001,2]
[Bob,07101,projectB,4001,1]
[Bob,07140,projectC,3001,3]
[Bob,07099,projectD,3001,2]
[Bob,07099,projectD,4001,3]

I've tried doing it with brute force by stepping through each item and
checking all the other items for matches, and then trying to build a
new list as I go, but that's still confusing me - for instance how can
I delete the items that I've already consolidated so they don't get
processed again?.

I'm not a programmer by trade so I'm sorry if this is a basic computer
science question.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python CMS advice wanted

2007-11-27 Thread Richard Querin
Whoa!. Lots of very good advice here. Thanks to all.

After reading it all I'm wondering if maybe a templating system like
Cheetah might be the way to go for us. I'll have to do a lot more
reading and exploring. I'd love to learn something like Django but
like it has been said, that's really a framework you'd use to build a
CMS. And this site is really a labour of love and not a business
venture so the time we invest into it at the moment is kind of in
short supply.

While we have less than 50 entries at the moment, adding each one is
still quite a hack. I've written a small wxpython app to take away
some of the pain of it, but it's still prone to corruption and still
too much work.

I think I'll have to watch some demo's to get a feel for how some of
these systems work before going down any specific path, because a lot
of it is still Greek to me.

Again sincere thanks for all the great info, and I'll try to check
back in on this thread once we get going on a solution.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Which GUI?

2007-08-02 Thread Richard Querin
On 8/2/07, scott [EMAIL PROTECTED] wrote:

 I was thinking about finding a copy of that book, so maybe starting
 WxPython would be easier then and not worry about Tkinter.  Is WxPython
 in Action a very good book?


I'm no programmer by trade, but dabble in Python/wxPython for fun and
bought the book several months ago. I've found it to be very good.
There are a lot of good online tutorials as well, but I was never sure
if they were up to date with the later versions of the framework - so
the book was blessing to me. I found the book to be very useful and
clearly written. It's no reference manual (the online docs serve that
purpose) but I think it really helped me get a good foundation in how
to program with wxPython. IMO a good book is still more useful and
efficient than online articles or tutorials for a newbie (like me)
most of the time. It's nice to be able to thumb through and study some
concept without flipping back and forth to some web page.

I own a lot of computer books, and I've found Learning Python (an
O'Reilly Book) and wxPython in Action to be my two most useful ones.


RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Which GUI?

2007-08-02 Thread Richard Querin
On 8/2/07, Eric Brunson [EMAIL PROTECTED] wrote:

 Switching gears from linear to event driven programming is a pretty
 significant paradigm shift.  Will this book help him get his head around
 that?


That's one of the main reasons why I bought it actually. I couldn't
grasp in any significant way how it worked. I could build a working
wxpython program based on tutorials etc. but didn't really know
why/how it worked. There are early sections in the book dealing with
the basics of the event-driven paradigm as well as a section
discussing the Model-View-Controller pattern too. It's not exhaustive
on the subject by any means, but cleared up a lot of questions for me.

It doesn't just throw you into building a detailed wxpython app
without any background as to how it works - although it does get you
going immediately with some small hello world type stuff to
immediately build a little confidence. ;)

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] eyeD3 module installation on XP

2007-07-16 Thread Richard Querin
Sorry Tino,

Missed your response completely. Your advice on using cygwin was
spot-on. I hadn't thought of using that.

Per my response to Terry, I've got the .10 version up and running now.

Thanks.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Fwd: eyeD3 module installation on XP

2007-07-16 Thread Richard Querin
On 7/16/07, Terry Carroll [EMAIL PROTECTED] wrote:

 You might want to try downloading .10 instead of the current release and
 see if that works for you.  See http://eyed3.nicfit.net/releases/

 Sorry I can't help more.

Nope. That's fine. Based on your response I was able to upgrade my
Cygwin (didn't have the make utility installed) and then was able to
download the .10 version and it's installed and working here right
now. Awesome. I won't be doing much coding here at work but I like to
dabble now and then ;). I'll (hopefully) be able to install the .deb
package without problem on my ubuntu box at home.

Thanks a lot.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] eyeD3 module installation on XP

2007-07-13 Thread Richard Querin
I'm interested in writing a small app - or attempting to ;) - which
will involve using the eyeD3 python module to process id3 tags of a
given set of files.

There are source downloads as well as downloads for various linux
distros, which is fine. However I also might want to work on this in
XP. I'm not sure how to install this on a Windows system. The install
instructions in the source code download describe the normal
./configure, make, make install which I've used several times before
when installing stuff on my home linux box, but I'm not sure these
will work on my Xp system.

Any pointers on how to go about installing this module? There's a file
called 'setup.py.in' as well. Not sure what that does..

Are there any id3 tag processing modules other than eyeD3 that I
should be looking at?

Thanks.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How can I escape a pound symbol in my script?

2007-07-05 Thread Richard Querin
Hi,

I'm writing a very simple python script which writes out some
predefined text to a file (which will later become part of an html
file). I need to write out a pound sign '#' to the file and I can't
figure out how to escape it. I've tried '\#' and '\u0023', but neither
works. How can I do it?

Thanks.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I escape a pound symbol in my script?

2007-07-05 Thread Richard Querin
Thanks for the quick responses guys...

I was fooled by Vim and my own inexperience. I had forgotten to escape
a preceding quote and the pound symbol was generating a python comment
which showed up in syntax highlighting... Grrr. Problem fixed now.

[walking away embarrassed...] ;)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Richard Querin
I'm interested in writing a quick script that would run a diff-type
command that would compare a local directory to a remote one to
identify the changes in the files within that directory.

I was initially thinking that I would maybe use the linux diff command
in conjunction with the wget command (or something similar) to create
a local copy but that involves downloading files. Is there any way in
python to do a similar thing but without having to download a copy of
the remote files/directories?

Any ideas?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] gmail

2007-05-29 Thread Richard Querin
On 5/29/07, Adam Urbas [EMAIL PROTECTED] wrote:
 Hey,

 I have gmail now, but I'm not sure how to turn off HTML.

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor




When you're typing in your email, you should see a ' Plain text'
button link on the upper left. This will put you in plain text mode.
Likewise you'll see a similar button to switch back to 'Rich
Formatting' mode from there.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Podcast aggregator - OPML Parsing?

2007-04-23 Thread Richard Querin
I'd like to try my hand at writing a very simple podcast aggregator
for linux. I'll be using wxPython and have found the Universal Feed
Parser which looks good for me to use, but I'm having trouble finding
a similar module that might parse OPML files. Does anybody know of a
good one? Or should I do that myself.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Running an exe from Python

2007-02-22 Thread Richard Querin

On 2/22/07, Nagendra Singh [EMAIL PROTECTED] wrote:



What it does is that opens and closes the command window really fast and
displays a value of 1 in the interpreter. How can I get python to display
the results in the interactive window or what is the right way to do this.



I assume you're using the PythonWin editor that comes from ActiveState. I
tend to use the editor to create and edit the scripts, but I open a separate
command line window (or terminal) for testing and running the scripts. This
way, the output is right there and remains visible. If you run the script
from within the PythonWin editor it will generate the output and then
immediately close the output window and you miss seeing it.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Richard Querin

On 2/14/07, Mike Hansen [EMAIL PROTECTED] wrote:



 The following tutor faq has an explanation:

 http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t
 he-person-who-sent-the-message-and-not-to-the-list/




It seems like this is designed for the 5% case when it makes the other 95%
of normal reply cases more difficult. I would (like to) think that the vast
majority of replies are meant for all eyes. I would think it's the
responsibility of the person replying if he/she wants to respond privately
only rather than making that the defacto default.

Hitting reply in Gmail responds only back to the sender and not to the list.
I've been corrected (politely I might add) on more than one occasion.

Either way, it's a good list though. ;)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Richard Querin

On 2/15/07, Alan Gauld [EMAIL PROTECTED] wrote:




I dunno about you but 95% of my email is private, only
about 5% comes from mailing lists.



Yeah, me too, but I guess it seems easier to just hit 'reply' 100% of the
time and have it go to the right recipient. My point really was that 95% of
the time, the recipient is everyone in the mailing list, and only 5% of the
time do I want to privately respond to a mailing list item.

I've just noticed that Gmail doesn't even show a reply-all button if there
is only one sender. If there is a cc included then it becomes available.
Either way I will just remember to hit reply-all. No big whup.

RQ
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Trouble getting os.execl() command to work

2007-02-11 Thread Richard Querin

On 2/11/07, Luke Paireepinart [EMAIL PROTECTED] wrote:



 for name in filelist:
oops! filelist still contains the non-normalized names of the files!




Dang! Thank you sir. I should have recaptured the file list before
continuing on.


Alan - thanks for the great info as well. I will check it out and hopefully
streamline it. I haven't worked with the os module much before, thanks for
pointing me in the right direction.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Converting Filenames to Lower case

2007-02-10 Thread Richard Querin

Hi, I'm interested in a writing a quick python script for use on the command
line. I'm at the linux terminal inside a directory with a bunch of files.
The files have mixed case (some are .JPG and some are .jpg, etc..) I'd like
to be able to run a python script that will take all the files in the
directory I'm in and convert all the filenames and extensions to lower case.

Any ideas on where to look? I've fiddled quite a bit with very basic
scripting but nothing to do with getting files from the current directory
and processing their names. Can anybody point me in the right direction to
get started?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Trouble getting os.execl() command to work

2007-02-10 Thread Richard Querin

I'm having a slight problem here. I've got a script (shown below) which is
run from the command line. I am converting the filenames to lowercase and
then, for each .cr2 file, I'm building a command line and running it. Seems
pretty simple. I print the resulting command line and it looks fine, but
os.execl() won't seem to execute it. It tells me no such file or
directory. Yet I can cut and paste the printed line onto the command line
and execute it and it works fine. Am I missing something? Here's the code:


import os
import string

# get a list of the files in the current working directory

filelist = os.listdir(os.getcwd())

# run through the list and convert all of them to lowercase

for name in filelist:
   lowered_name = string.lower(name)
   print name +  -  + lowered_name
   os.rename (name,lowered_name)


# run through the list again and for all .cr2 files run
# the exiftool command to copy the exif data from cr2 to jpg file


for name in filelist:

   #extract extension
   ext = name[-3:]

   if ext == 'cr2':
   jpg_dest = name[:-4]+.jpg
   cmd_string = /home/richard/ExifTool/exiftool -TagsFromFile  + name
+  -exif:all  + jpg_dest
   print cmd_string#this string looks correct
   os.execl(cmd_string)   #the resulting command throws an error ??
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] free IDE for Python?

2006-11-14 Thread Richard Querin
On 11/14/06, Tim Johnson [EMAIL PROTECTED] wrote:
I've used vim in the past for python and recommend it for ease ofuse and support. I also use emacs, which may be found harder tolearn but has the advantage of being able to evaluate code directlyin the editor.
timI have to chuckle when you recommend Vim for ease of use. Now don't start flaming me quite yet. I'm a big fan of Vim and I'm in the midst of learning it myself. I think it's a very powerful editor and I like it a lot. But recommending it for ease of use might be a little stretch. It's like a lot of things, the higher learning curve ultimately gets you greater rewards. 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A simple list question...

2006-09-07 Thread Richard Querin
On 9/7/06, Kent Johnson [EMAIL PROTECTED] wrote:

 No, it doesn't. You are confused somewhere; my guess is your original
 data has newlines.

Sorry, my bad. When I created the original list I was splitting a
string in two pieces. The latter portion of the string had a newline
at the end. I had taken the slice with [index:] instead of [index:-1].

Thanks for the help and the tips regarding other ways to do it.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Style query

2006-08-13 Thread Richard Querin
I believe you can find it here:http://www.python.org/doc/essays/styleguide.htmlAuthored by Guido Van Rossum himself.Cheers, 
RichardOn 8/13/06, dave s [EMAIL PROTECTED] wrote:
As my programs become more complex I am aware of the need to adopt aconsistent style. To differentiate between classes, instances  objects I usecapital letters for example:A class uses 'MyClass'A class instance 'myInstance'
A def uses 'myDef'An object 'myobject' or 'my_object' etcCan any of you more experienced programmers outline your style or critique myway of doing this ? Tell me if you have a different system - I am trying to
get myself into good habits :)Is there a Python style guide anywhere ?CheersDavePSI have started using packages, so much easier and more flexable than longPYTHONPATH declarations and am now proramming with QT :).
___Tutor maillist-Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Raw files and jpeg thumbnail extraction

2006-08-06 Thread Richard Querin
I am interested in extracting jpeg thumbnails that are stored in my camera's Canon .CR2 raw files. Does anybody know of any python libraries with this kind of functionality? Is dcraw the only way to implement this functionality? I'm writing a simple gui to selectively process raw files into jpegs, but I really would like to pick the photos based on thumbnails. I read somewhere that most digital camera raw files contain jpeg thumbnails that would be much quicker to load than doing an on-the-fly conversion just to get the thumbnails. 
Can anybody point me in a good direction on this?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Writing python scripts to control GIMP

2006-07-20 Thread Richard Querin
Hi,I'm interested in learning about how to write python scripts that can control the GIMP. I've read about several scripts but I'd like to know where to start learning about how it's done. Anybody got any good places to look for tutorials, references etc?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I copy files recursively?

2006-07-11 Thread Richard Querin
On 7/11/06, Alan Gauld [EMAIL PROTECTED] wrote:
Things which are easy in the shell are usually less easy in Python.In your case a simple cp -r will copy the files and an rm -rf willdelete the originals.Or you could just use mv on the top level folder.
But I don't want the sub folders to come along with the copy. I'd like to grab the mp3 files out of a set of subfolders and place them all into a single folder somewhere else. I'm completely lost when it comes to bash scripting, so I may take Michael P. Reilly's suggestion as a starting point since it's the only one I understand at first glance ;).
I'm really a newbie to python programming so readability and understanding it is first on my list. Efficiency and speed is secondary to me at the moment.Thanks to all for the help.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How can I copy files recursively?

2006-07-10 Thread Richard Querin
I know this is probably a dumb question:I've got mp3 files that are downloaded (by ipodder) into individual subfolders. I'd like to write a quick script to move (not copy) all the mp3 files in those folders into a single destination folder. I was thinking I could do it easily from the linux command line (cp -r copies the subfolders out as well) but I can't figure out how to do it. Is there an easy way to achieve this using Python? I am assuming this would be something Python was designed to make easy..

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python video?

2006-04-15 Thread Richard Querin
On 4/13/06, Steve Nelson [EMAIL PROTECTED] wrote:
On a similar line, I've recently discovered podcasts.I spend a lotof time driving, and have been listening through the Security Nowbroadcasts, and the last few days some stuff on Evolutionary Theory.
Does anyone know of some good sources for programming-type discussions- talks or lectures I could download and listen to?I've found some neat stuff at 
http://itconversations.com. They publish quite a few podcasts per week, some interest me, some don't, but they cover quite a large range of topics.Here's a link to part 1 of a 2-part podcast interview with Guido Von Rossum: 
http://www.itconversations.com/shows/detail545.htmlAlso, Leo Laport has started (finally!) a podcast on open source called Floss. He does several podcasts these days. You can find them (and the Floss podcast) here: 
http://twit.tvYou can also do a search on 'programming' or 'python' at http://podcastalley.com and sometimes find some good podcasts.One other way that's kind of neat, is to use 
http://podzinger.com which does searches via speech recognition on podcasts.There's quite a lot of potential sources for good programming related podcasts, however finding them is the tough part.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question About Function Arguments and Returned Results

2006-04-11 Thread Richard Querin
On 4/11/06, Kent Johnson [EMAIL PROTECTED] wrote:
There is no need to pass the class object in to the function, you cancreate it in the function and return it. A class might be nice becauseit gives names to the various values. A dict can also be used for this.
Do what feels right :-)To be more specific, I'm going to have probably 6 functions that do similar things. They all take slightly different arguments, they all do slightly different calculations, but the results of all the functions are the same format. So I guess it makes sense to use a class. Now, when you say 'create it in the function', you mean create the class instance inside the function and return that instance? The class itself is defined somewhere else in the module containing the functions so that all the functions have access to it. (Total newb to python and classes so sorry if that's a stupid question).

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] preliminary app design question

2006-04-06 Thread Richard Querin
On 4/5/06, Alan Gauld [EMAIL PROTECTED] wrote:
Sounds like creating each app as a class which can be instantiated ondemand by the master application would be a possible design option.I guess writing the master program (or some simplified version of it) would be required from the start in order to make launching the separate design programs possible (for testing, debugging etc..).
The class approach coupled to a config XML file would do this.Define a file that looks something like
applicationsapplicationdisplayNameMy Foo App/displayNameclassNameFoo/className/icon src="">
params param nameMyName/name/value default=15 /param param
 nameAnotherName/name/value default=0 /param /params /applicationapplication
displayNameMy Bar App/displayNameclassNameBar/className/icon src="">params param
 nameSomeName/name/value default=None /param /params /application/applications
Then you can read that and use it to construct a menu or set of buttonsor toolbar or whatever.So for the master program this makes sense. However, what about the input/output data of each individual design app. All the different programs will share some common data but each one may have different components, and some will be large arrays of numbers, is XML still applicable for that type of file data?
I think my first task will likely be settling on what I need each component of the system to do and how they will interact. It's becoming more complex the more I discuss it.. ;)
 Obviously this won't happen right away, I would likely develop each small design app as a standalone and then when I've got 3 or 4 done I would tie them together with the project app.Why wait for 3 or 4 just add them one by one! Its just aase of editing
the config file... In fact you could eveb make a config applet to createthe xml entries as your first project!Ease myself into it. ;)
Investigate ElementTree - its much easier than the standard xml domand sax parsers that ship with Python.I have the documentation printed out for study. Thanks for the help.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] preliminary app design question

2006-04-06 Thread Richard Querin
On 4/5/06, Hugo González Monteverde [EMAIL PROTECTED] wrote:
Now seriously. Are there file formats meant to be used and understood byother programs in principle (we know it is a nice feature, but is itnecessary?)?There will be input data and output results from program A that may be
utilized by program B. If the two independent designs are linked to the
same project then they will share this data, if they aren't part of the
same project they wouldn't. I would assume that would mean that the
file formats of all the design programs would have to be readable and
changeable by the master program. Not sure if this necessitates XML,
but to me it seems like standardizing the formats will make things
simpler.hope this rant helps a bitIt did. Thanks.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor