Re: [Tutor] basic problem

2011-10-06 Thread Mac Ryan
On Thu, 6 Oct 2011 22:11:37 + ADRIAN KELLY wrote: > can someone spell out to me in (simply if possible) what this > programme is doing. i understand the concept of the "for" loop and > what its doing with the message the user enters. i just cant > understand the VOWELS and how it keeps add

Re: [Tutor] Mailing list archive oddity?

2011-09-29 Thread Mac Ryan
On Thu, 29 Sep 2011 23:08:19 +0200 Hugo Arts wrote: > * someone from the future is in need of python help and is sending > messages back in time. I told Guido that Python version 5.2 sucked, but he wouldn't / will not listen! :-/ /mac ___ Tutor mailli

Re: [Tutor] Why subclassing exceptions?

2011-09-28 Thread Mac Ryan
On Wed, 28 Sep 2011 10:15:07 -0400 "Prasad, Ramit" wrote: > >If you are using asserts for data validation, then your code is > >broken. The caller can disable every single assert, and hence remove > >your data validation, by simply passing a command line switch when > >calling your program. >

Re: [Tutor] Why subclassing exceptions?

2011-09-28 Thread Mac Ryan
On Wed, 28 Sep 2011 09:03:11 +0100 Alan Gauld wrote: > Remember that when handling exceptions we should be trying > to recover the situation not just bombing with an error message. > Exceptions should not be thought of as purely about > messages, they are opportunities to recover the situation w

[Tutor] Why subclassing exceptions?

2011-09-27 Thread Mac Ryan
On Wed, 28 Sep 2011 09:58:49 +1000 Steven D'Aprano wrote: > Mac Ryan wrote: > > > raise BaseException('Something is wrong here!') > > Never raise BaseException directly! BaseException is the very top of > the exception hierarchy, you should raise the

Re: [Tutor] help with a recursive function

2011-09-27 Thread Mac Ryan
On Tue, 27 Sep 2011 14:32:00 -0400 c smith wrote: > hi list, > i understand the general idea of recursion and if I am following well > written code I can understand how it works, but when I try to write > it for myself I get a bit confused with the flow. > I was trying to turn an ackerman functio

Re: [Tutor] Need a bump in the right direction (network programming)

2011-09-23 Thread Mac Ryan
On Fri, 23 Sep 2011 17:03:29 +0800 Cheeyung wrote: > >> On 09/23/2011 01:15 AM, Cheeyung wrote: > >>> I'm creating a mobile application and I'm using python for a > >>> desktop server. However, I don't have access to a static IP on the > >>> desktop, but do have a website. Is it possible to conne

Re: [Tutor] Need a bump in the right direction (network programming)

2011-09-23 Thread Mac Ryan
On Fri, 23 Sep 2011 03:20:53 -0400 Dave Angel wrote: > On 09/23/2011 01:15 AM, Cheeyung wrote: > > I'm creating a mobile application and I'm using python for a > > desktop server. However, I don't have access to a static IP on the > > desktop, but do have a website. Is it possible to connect from

Re: [Tutor] How it is better than java

2011-09-20 Thread Mac Ryan
On Tue, 20 Sep 2011 10:27:12 +1000 Steven D'Aprano wrote: > There are three misunderstandings with that statement. > [snip] > There's also JPype, which claims to give full access to Java > libraries in Python. Now: this was one of the best write-ups on the subject I read. Concise, clear, docume

Re: [Tutor] Flat is better than Nested

2011-09-09 Thread Mac Ryan
On Thu, 8 Sep 2011 21:39:47 -0500 "Ryan Strunk" wrote: > By the time I write this all into a file, the end user will never > even know this crazy hierarchy exists, but I will, and I don't like > it. Do I just need to get over it and realize that sometimes nested > is necessary, or is there a bett

Re: [Tutor] Standard way to create debian packages for python programs?

2011-08-18 Thread Mac Ryan
On Thu, 18 Aug 2011 14:55:19 -0400 "Prasad, Ramit" wrote: > Have you taken a look at: http://pypi.python.org/pypi/stdeb/0.5.1 Thank you for this. Actually I got the same advice also on my SO question here: http://stackoverflow.com/q/7110604/146792 at about the same time you answered me. Good so

Re: [Tutor] Standard way to create debian packages for python programs?

2011-08-18 Thread Mac Ryan
On Fri, 19 Aug 2011 00:08:30 +0100 Alan Gauld wrote: > I notice there is also a distutils SIG with a mailing list which > looks like they might help. A quick look at some mails suggests they > cover this kind of issue. > > FWIW I used the gmane web site to take a quick look... Thanks for both t

Re: [Tutor] Standard way to create debian packages for python programs?

2011-08-18 Thread Mac Ryan
On Thu, 18 Aug 2011 12:48:19 -0400 "Prasad, Ramit" wrote: > To be honest, even after reading your original post twice (now > knowing you are actually asking a Python question) I am unsure what > Python question you are asking. Apologies, English is not my mother tongue, maybe I wasn't able to ex

Re: [Tutor] Standard way to create debian packages for python programs?

2011-08-18 Thread Mac Ryan
On Thu, 18 Aug 2011 13:01:08 -0400 Brett Ritter wrote: > On Thu, Aug 18, 2011 at 11:39 AM, Mac Ryan > wrote: > >        In particular, `distutils` is part of the standard python > > distribution and it is in no way specific to Debian, so I don't feel > > this is the

Re: [Tutor] Standard way to create debian packages for python programs?

2011-08-18 Thread Mac Ryan
On Thu, 18 Aug 2011 22:43:09 +1000 Steven D'Aprano wrote: > Mac Ryan wrote: > > Although it's years I program with python, I never distributed my > > software with packages (I never created *any* packages in my life, > > indeed). > > This is a mailing lis

[Tutor] Standard way to create debian packages for python programs?

2011-08-18 Thread Mac Ryan
Although it's years I program with python, I never distributed my software with packages (I never created *any* packages in my life, indeed). Out there there is ton of information on how to do this, but after a day of scouring the Internet I still did not wrap my mind around it. The problem for me

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

2011-06-25 Thread Mac Ryan
Just thought to google for "S5 python", and google came out with a lot of interesting links! :o /mac > 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

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

2011-06-25 Thread Mac Ryan
On Sat, 25 Jun 2011 06:18:14 -0700 (PDT) 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

Re: [Tutor] Python Exercise

2010-11-27 Thread Mac Ryan
On Sat, 27 Nov 2010 22:00:03 +0800 Kok Cheng Tan wrote: > I created this website for practising python online: > http://www.pyschools.com. Hope to gather feedback from people here > who are interesting in teaching and learning python. Here you go with the first suggestion: remove the need to log

Re: [Tutor] Random Number Question

2010-11-26 Thread Mac Ryan
On Fri, 26 Nov 2010 18:33:07 +0100 Piotr Kamiński wrote: > You can get the list of Python's standard modules by typing help() > and then you will see something similar to: Thanks a lot! This is what I was after! Mac. ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Random Number Question

2010-11-25 Thread Mac Ryan
On Thu, 25 Nov 2010 11:09:10 +0100 Timo wrote: > > I was wondering... apart from checking each name individually, is > > there any easy-peasy way to get a list of names used in the > > standard library (I am thinking to something like "dir()"? > This is the webpage I always use for searchin

Re: [Tutor] Random Number Question

2010-11-24 Thread Mac Ryan
On Thu, 25 Nov 2010 00:58:23 + Adam Bark wrote: > Ah yes always avoid giving your modules names that appear in the > standard library. It goes wrong, sometimes in unexpected ways. I was wondering... apart from checking each name individually, is there any easy-peasy way to get a list of nam

Re: [Tutor] IDEs

2010-11-23 Thread Mac Ryan
On Wed, 24 Nov 2010 01:15:48 - "Alan Gauld" wrote: > In a recent project that we > completed we had 600k lines of production code and over a > million lines of test code. > > And we still wound up with over 50 reported bugs during Beta test... > But that was much better than the 2000 bugs on

Re: [Tutor] IDEs

2010-11-23 Thread Mac Ryan
On Tue, 23 Nov 2010 15:02:27 +0100 "Josep M. Fontana" wrote: > Does anybody know of any good reference on testing? How do you develop > tests for functions? I haven't found much information on this in the > Python books I own. When I first learnt python I found the "Dive into Python" section of

Re: [Tutor] variable numbers of for loops

2010-11-23 Thread Mac Ryan
On Tue, 23 Nov 2010 13:16:46 + Jose Amoreira wrote: > I read somewhere that for any recursive algorithm there is a > sequential one that is equivalent > [...] > Is there a more straightforward way of solving my specific problem > or, better yet, a general solution to the need of a variable nu

Re: [Tutor] Too different 2.6 vs 2.7?

2010-11-09 Thread Mac Ryan
On Mon, 2010-11-08 at 17:16 -0800, Terry Carroll wrote: > The only feature I'm pining for at all is the new argparse; but it > depends on your needs. Ubuntu 10.10 here (running python 2.6.6) I use argparse without any problems: I believe the difference between 2.6 and 2.7 [I am not an expert

Re: [Tutor] argparse: how to use the returned Namespace object?

2010-11-05 Thread Mac Ryan
On Fri, 2010-11-05 at 01:11 +, Walter Prins wrote: > You need to distinguish between what __dict__ *is*, and what it > *contains*. dir() does introspection, it inspects what an object in > Python *is*, e.g. displays all the methods and attributes of the > object. It does not however know anyt

Re: [Tutor] argparse: how to use the returned Namespace object?

2010-11-04 Thread Mac Ryan
On Fri, 2010-11-05 at 00:17 +, Walter Prins wrote: > > > On 4 November 2010 23:20, Mac Ryan wrote: > My question boils down to: how can I expand the Namespace > object in > order to get a list of keyword arguments? > > If "ns" is

[Tutor] argparse: how to use the returned Namespace object?

2010-11-04 Thread Mac Ryan
Hi, I'm writing a small command line utility using the argparse module (I am on python 2.6.6 so that's not in the standard lib, but this should not play any role in my problem, I believe). My goal is to use a class that I already wrote and cannot change for a GUI app, as a command

Re: [Tutor] Where to start with Unit Testing

2010-08-03 Thread Mac Ryan
On Mon, 2010-08-02 at 11:59 -0400, Che M wrote: > Mac, I found this an excellent brief overview of UT and your points > all > seem very strong to me. Thanks very much. I admit I didn't really > know > anything about the topic and was mentioning my feelings on the matter > partly to elicit enlight

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Mac Ryan
> A different analogy comes to my mind; I once saw two different sets of > people analyze data. One did it "by hand": visually inspecting > thousands > of signals herself and typing Y or N to accept or reject each signal. > The > other did it with an automated system that accepted or rejected > s

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Mac Ryan
On Sun, 2010-08-01 at 03:30 -0400, Huy Ton That wrote: > Hi all, > > Do any of you have any feedback, strategies and best practices related > to unit testing within Python. This is a relatively new topic for me. > I was thinking of starting with reading the documentation associate > with the unitt

Re: [Tutor] problem with subprocess

2010-07-31 Thread Mac Ryan
On Fri, 2010-07-30 at 14:36 +0200, Bala subramanian wrote: > I have to do a series of job in a remote machine. I put each job in a > text file called 'job' as and wrote the following code that can read > each line in the text file and execute the job. If that works for you, no need to change it, o

Re: [Tutor] Plugin system - how to manage plugin files?

2010-07-28 Thread Mac Ryan
On Wed, 2010-07-28 at 13:53 -0500, Scott Nelson wrote: > On Wed, Jul 28, 2010 at 10:07 AM, Mac Ryan > wrote: > Hi everybody, > > > Mac, > > I don't know if this is exactly what you are after, but I created a > poor-man's plugin system by s

[Tutor] Plugin system - how to manage plugin files?

2010-07-28 Thread Mac Ryan
Hi everybody, This is more of a python software design question rather than a question on the Python syntax alone. I hope it is fine to ask here. I am working on a small project, that I will release under a GPL license, whose main design guiding principle is extensibility. Thus I

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread Mac Ryan
On Tue, 2010-07-27 at 23:31 +0100, Mark Lawrence wrote: > On 27/07/2010 23:20, ZUXOXUS wrote: > > Hi all pythoners > > > > I've got a probably easy to answer question. > > > > Say I've got a collections of strings, e.g.: 'man', 'bat', 'super', 'ultra'. > > > > They are in a list, or in a sequence o

Re: [Tutor] lambda vs list comp

2010-07-27 Thread Mac Ryan
On Tue, 2010-07-27 at 09:44 -0700, Jon Crump wrote: > Just as a matter of curiosity piqued by having to understand someone > else's code. Is the difference here just a matter of style, or is one > better somehow than the other? > > >>> l > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > >>> ','.join([str(

Re: [Tutor] django help....

2010-07-27 Thread Mac Ryan
On Mon, 2010-07-26 at 14:03 +0100, Dipo Elegbede wrote: > what ook would you recommend for a beginner? I am a django beginner myself. I did the tutorial first (http://docs.djangoproject.com/en/dev/intro/tutorial01/) and now I am very happy with "Practical Django Projects": http://www.amazon.com/Pr

Re: [Tutor] xml question

2010-07-27 Thread Mac Ryan
On Mon, 2010-07-26 at 12:09 -0700, Albert-Jan Roskam wrote: > I am making a data processing program that will use a configuration > file. The file should contain information about: (1) source files > used, (2) (intermediate) output files, (3) used parameters/estimation > methods (4) manual data edi

[Tutor] Tutor list as pair progamming plush toy

2010-02-12 Thread Mac Ryan
Have you ever got that piece of advice about - when you have stuck on a bug you seem unable to track - getting a plush toy to whom you explain your code? (This is of course a workaround if you do not have a fellow developer to help you out). Well... I found out this advice kind of works for me, wi

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Mac Ryan
On Fri, 2009-09-04 at 06:18 -0700, dan06 wrote: > I'd like to learn a programming language - and I need help deciding between > python and ruby. I'm interesting in learning what are the difference, both > objective and subjective, between the two languages. I know this is a python > mailing list, s

Re: [Tutor] how to read and transmit/send only section of the image (sub-image)

2009-09-03 Thread Mac Ryan
On Fri, 2009-09-04 at 00:01 +0200, Jojo Mwebaze wrote: > thanks guys, > > > Currently i am using pyfits, a bit slow cause loads the file in > memory, creates a subimage and then saves the file then transmits > the file over the network! My idea is, if there is a way of creating > a file pointer

Re: [Tutor] Please delete my mail address from that mail list. Thanks!

2009-09-01 Thread Mac Ryan
On Tue, 2009-09-01 at 04:27 +0200, Luke Paireepinart wrote: > there are directions on how to remove yourself from the list at the > bottom of every message that the list sends out. > ___ > click. > ___

Re: [Tutor] Initialize Class Variables by Dictionary ...

2009-08-29 Thread Mac Ryan
On Sat, 2009-08-29 at 16:31 -0400, Damon Timm wrote: > Hi again - thanks for your help with my question early today (and last > night). Tried searching google for this next question but can't get > an answer ... here is what I would like to do (but it is not working) > ... > > >>>dict = {'test1':

Re: [Tutor] How to convert binary files back to text files?

2009-08-29 Thread Mac Ryan
On Sat, 2009-08-29 at 18:42 +0530, prasad rao wrote: > >On 8/29/09, Geneviève DIAGORN wrote: > >Bonjour, > >Je suis absente jusqu'au 02/09 inclus. > >En cas d'urgence Soprane, contacter notre adresse générique > >projet.sopr...@teamlog.com. > >Cordialement

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-29 Thread Mac Ryan
On Sat, 2009-08-29 at 11:44 +, ALAN GAULD wrote: > First recall that xsstatic methods were historically the first attempt at > giving Python class methods. (They were called staticmethods because > C++ and Java define their class methods using the label 'static' ) > ... > > The only differenc

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-29 Thread Mac Ryan
On Fri, 2009-08-28 at 18:03 +0100, Alan Gauld wrote: > "Mac Ryan" wrote > > > I am not sure I understood the difference between staticmethod end > > classmethod, though, even if I can guess it has to do with subclassing, > > I think it is mainly historical

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-29 Thread Mac Ryan
On Fri, 2009-08-28 at 12:24 -0400, Dave Angel wrote: > > Thank you Dave, very helpful as ever. I made a few tests and experiments > > to understand better, and I feel I am understanding how it works. > > Although the mechanic of this is increasingly clear, the logic behind is > > still a bit obscur

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-28 Thread Mac Ryan
On Fri, 2009-08-28 at 08:55 -0400, Dave Angel wrote: > Mac Ryan wrote: > > On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote: > > > > > >> Now there are a couple of decorators that are in the standard library > >> that everyone should know a

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-28 Thread Mac Ryan
On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote: > Now there are a couple of decorators that are in the standard library > that everyone should know about:classmethod() and staticmethod(). > They wrap a method in a new one (which ends up having the same name), > such that the first arg

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-26 Thread Mac Ryan
On Wed, 2009-08-26 at 15:46 -0400, Dave Angel wrote: > So define a classmethod to finish the job, and invoke it later > > class Employee(object): > @classmethod > def finish(cls): > cls.__storm_table__ = "employee" > cls.company_id = [] > cls.company = Company.id

[Tutor] Declaration order of classes... why it is important?

2009-08-26 Thread Mac Ryan
Hello everybody, I am using "storm" (https://storm.canonical.com/) to manage my database. In storm, relationships between tables (each table is represented by a class) are expressed like this (line #4): 1 >>> class Employee(Person): 2 ... __storm_table__ = "employee" 3 ... company

[Tutor] Pexpect latest version.

2009-08-24 Thread Mac Ryan
Hello everybody, this is more a request of info than of help. I want to play around with pexpect a bit, but I am confused on what is the latest stable version. On SF (linked from the site of the pexpect developer) http://pexpect.sourceforge.net/pexpect.html it seems the latest version (

Re: [Tutor] Algorithm

2009-08-24 Thread Mac Ryan
On Sun, 2009-08-23 at 15:06 -0700, kreglet wrote: > Hello, > > The problem that I am having is writing an algorithm for finding all the > possible words from a given word. For example: python > > from "python" you can make the words pot, top, hop, not etc. There are few > examples for making an

Re: [Tutor] Packaging for distribution

2009-08-20 Thread Mac Ryan
On Thu, 2009-08-20 at 11:26 -0500, Wayne wrote: > Hi, > > > I have a program written in python + pygtk and I'm trying to figure > out what would be the best way to distribute my program. I've googled > all over and I find lots of build scripts, the py2exe utility... > > > It just seems that th

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Mac Ryan
On Mon, 2009-08-17 at 20:27 +0100, Alan Gauld wrote: > > way I could enforce behaviours like "not null" or "default" from within > > the datastructure itself (for example in the __init__ method) rather > > than enforcing a logic from outside (i.e. the "mother class"). > > But those features are fe

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Mac Ryan
On Mon, 2009-08-17 at 13:33 -0400, Kent Johnson wrote: > On Mon, Aug 17, 2009 at 1:12 PM, Mac Ryan wrote: > > > Finally, I somewhere read that embedded declarations are much faster > > than external ones in being referenced. So, if performance is an issue, > > maybe em

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Mac Ryan
On Fri, 2009-08-14 at 11:26 -0400, Serdar Tumgoren wrote: > Hi everyone, > > I was wondering if there's anyone who can offer a use case/rationale > for nested class? ... > Are there specific situations when nested classes come in handy > (perhaps for grouping conceptually related classes that don'

[Tutor] Web framework: looking for python-tutor's angle.

2009-08-13 Thread Mac Ryan
A couple of months ago I took the time to read a few articles on python web application frameworks and I got the impression that the two most mature and active projects are Zope and Django. Zope vs. Django hits 879.000 pages on google but much of the debate - or at least this is my impression - fa

[Tutor] Troubles with the mailing list.

2009-07-30 Thread Mac Ryan
Hi all, having seen a few people in the past days sending "trial messages" on the list I figured it out that I must not be the only one to experience problems with it. I even set up the "notification" feature that sends you an acknowledgement message when your mail is received fro

Re: [Tutor] Two problems related to dispathing.

2009-07-28 Thread Mac Ryan
On Tue, 2009-07-28 at 19:03 +0100, Alan Gauld wrote: > There is no simpler solution without changing the class. > If you can do that you could pass the container to the constructor > and get the class to add itself to the container Kent, Alan... thank you very much, indeed I finally

[Tutor] Two problems related to dispathing.

2009-07-28 Thread Mac Ryan
Hello, I'm working on an application in which I need the main loop to call the same method on a number of objects. I came up with this solution that seem to work, but I was wondering if there is a better / more pythonic solution to the problem. def invokeAll(method, data): """This fu

Re: [Tutor] how to know if process is running?

2009-07-28 Thread Mac Ryan
I am not an expert, but if I got you correctly, what you want to achieve is a "singleton": http://en.wikipedia.org/wiki/Singleton_pattern if you watch at the sample implementation, there is a Python example too. Mac. On Tue, 2009-07-28 at 10:45 -0500, shawn bright wrote: > Hey all, > > I have an

Re: [Tutor] Need to be pointed in the right direction for file organisation.

2009-07-25 Thread Mac Ryan
Thank you Alan for the prompt reply, > - Put reusable components into modules. OK: the use of files as "libraries" is quite clear to me and indeed I am already doing that. What is not clear is if I should _only_ put in modules stuff that is reusable, or if there are other widely accepted

[Tutor] Need to be pointed in the right direction for file organisation.

2009-07-24 Thread Mac Ryan
Hello everybody, I am new to python programming, but - thanks to "dive into python" - I had no difficulties in picking up the basics of the language and experimenting on my own with PyGTK and STORM. While I am working my way up to a more pythonic and cleaner style in the code, one