Re: [Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread Cameron Simpson
On 24Jan2015 00:47, Alan Gauld wrote: On 24/01/15 00:37, Cameron Simpson wrote: By contrast, I use it a far bit (though still far less than non-property methods). Generally for derived properties which are: - cheap to compute i.e. O(1) - which I want to abstract - usually represent some pro

Re: [Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread Danny Yoo
> > But why a property rather than a simple method? > Why is > > k = url.key > > better than > > k = url.key() > > for meeting those criteria? My understanding is this is very much a Python-specific problem. Python style encourages raw access to the attributes of an object via direct lookup and a

Re: [Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread Alan Gauld
On 24/01/15 00:37, Cameron Simpson wrote: By contrast, I use it a far bit (though still far less than non-property methods). Generally for derived properties which are: - cheap to compute i.e. O(1) - which I want to abstract - usually represent some property which is stable, such as a

Re: [Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread Cameron Simpson
On 23Jan2015 20:37, Alan Gauld wrote: On 23/01/15 11:47, jarod...@libero.it wrote: Thanks so much for clear explanation!!! So in this way work . In [38]: Test().x.__name__ Out[38]: 'x' The decoratory proprerty dosen't help to create the class in fast way.. When it is advisable use @property?

Re: [Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread Alan Gauld
On 23/01/15 11:47, jarod...@libero.it wrote: Thanks so much for clear explanation!!! So in this way work . In [38]: Test().x.__name__ Out[38]: 'x' The decoratory proprerty dosen't help to create the class in fast way.. When it is advisable use @property? Very rarely, and mainly when you need to

Re: [Tutor] Initiating an external email transmission

2015-01-23 Thread Alan Gauld
On 23/01/15 03:09, dw wrote: I have a python script that I've created. The issue is, I made it for someone else to use in his PC. And its not working for him. The first thing to do when creating a program for use on another computer is to make everything that could be machine specific conf

Re: [Tutor] Class learning

2015-01-23 Thread Alan Gauld
On 23/01/15 01:44, jarod...@libero.it wrote: How can gave the attributes __name__ to a function? You don't Python does it for you. class Foo(object): def __init__(self): steps = {} tmp = open("rnaseq.base.ini","rb") config.readfp(tmp) readsets = pa

Re: [Tutor] Installing psutil 2.2.0-1 on Canopy Enthought

2015-01-23 Thread Sydney Shall
On 22/01/2015 22:53, Alan Gauld wrote: On 22/01/15 12:56, Sydney Shall wrote: I use MAC OSX 10.9.5 Canopy Enthought python 2.7.6 I also use the Enthought Package Manager to keep my installation up-todate. Canopy and Enthoughts paqckage management are well beyond the bounds of standard Python

[Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread jarod...@libero.it
Thanks so much for clear explanation!!! So in this way work . In [38]: Test().x.__name__ Out[38]: 'x' The decoratory proprerty dosen't help to create the class in fast way.. When it is advisable use @property? ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] Class learning

2015-01-23 Thread Danny Yoo
You are trying to use advanced features of Python, and they are not the right tool for what you're trying to do. Specifically, you're trying two things at the same time: 1. Properties, which allows method calls to look like simple variable access. 2. The __name__ special attribute on methods (

Re: [Tutor] Testing a string to see if it contains a substring (dw)

2015-01-23 Thread Mark Lawrence
On 22/01/2015 15:40, dw wrote: Thanks for your good comments. I do think I found a work around body = "" for x in range(0,len(line_array)): test_line = len(re.findall(r'[0-9]{2}/[0-9]{2}/[0-9]{4}', line_array[x])) if test_line > 0: body = body + line_array[x]+"\n" Using

Re: [Tutor] Testing a string to see if it contains a substring (Steve and Mark)

2015-01-23 Thread Mark Lawrence
On 22/01/2015 16:15, dw wrote: Thanks so much Steve and Mark! You've given me a lot to chew on. :-D I'll pursue! More Python FUN!! Thanks for the thanks, but please don't change the subject as it breaks threading, making it more

[Tutor] R: Re: Re: Class learning

2015-01-23 Thread jarod...@libero.it
This is the all code: http://pastebin.com/nYGEiXY4 I don't know well which i meas . I suppose it is the name of the class (self. __name__). So the name it is present. it is correct? thanks for the patience! M. >Messaggio originale >Da: danny@gmail.com >Data: 23/01/2015 11.08 >A:

Re: [Tutor] Class learning

2015-01-23 Thread Danny Yoo
On Fri, Jan 23, 2015 at 12:37 AM, jarod...@libero.it wrote: > Thanks for the help and patience! > It is a function on the class so I suppose for read that function list I > need self.steps Where I'm wrong? > @property > def steps(self): > return [ > >

Re: [Tutor] Does the Python way of doing things have a definite preference for the structure and content of program file header comments?

2015-01-23 Thread Alan Gauld
On 23/01/15 06:10, boB Stepp wrote: As far as version control, I consider it *absolutely essential* for anyone who is serious about programming professionalism. stated direction, but finding time to become proficient in such a tool in the midst of all the other things I am trying to absorb is

[Tutor] R: Re: Class learning

2015-01-23 Thread jarod...@libero.it
Thanks for the help and patience! It is a function on the class so I suppose for read that function list I need self.steps Where I'm wrong? @propertydef steps(self):return [ self.trimmomatic, self.merg

Re: [Tutor] Does the Python way of doing things have a definite preference for the structure and content of program file header comments?

2015-01-23 Thread Alan Gauld
On 23/01/15 07:02, Ben Finney wrote: An example:: # -*- coding: utf-8 -*- # foo/frob.py # Part of FooBar, a garden gnome decoration library. # # Copyright © 2011–2015 Ben Finney # # This is free software: you may copy, modify, and/or distribute this work

[Tutor] Initiating an external email transmission

2015-01-23 Thread dw
I have a python script that I've created. It logs into an online email service and sends out an email. It works in my Linux box, and it works in my Windows 7 box. I've also converted it with Py2EXE and it works as an executable in my Win-7 box. The issue is, I made it for someone else to use in hi

Re: [Tutor] Class learning

2015-01-23 Thread Danny Yoo
> #@property > def show(self): > ftp="\n".join([str(idx + 1) + "- " + step.__name__ for idx, step in enumerate(self.steps)]) > Questions you should be asking yourself: What is self.steps? What type is it? In the case where this breaks with an error, what is self.steps t

Re: [Tutor] Class errors

2015-01-23 Thread Patrick Thunstrom
If the code I'm seeing is correct, the problem is the class is Jobs, and you instantiated a Job, which doesn't exit. Replace one with the other in either case should fix it. On Thu, Jan 22, 2015 at 11:11 AM, jarod...@libero.it wrote: > Dear All, > > I created a class that invoke from another fi

Re: [Tutor] Testing a string to see if it contains a substring (dw)

2015-01-23 Thread dw
Thanks for your good comments. I do think I found a work around body = "" for x in range(0,len(line_array)): test_line = len(re.findall(r'[0-9]{2}/[0-9]{2}/[0-9]{4}', line_array[x])) if test_line > 0: body = body + line_array[x]+"\n" For each iteration re.findall returns a lis

Re: [Tutor] Testing a string to see if it contains a substring (Steve and Mark)

2015-01-23 Thread dw
Thanks so much Steve and Mark! You've given me a lot to chew on. :-D I'll pursue! More Python FUN!! Based on your description, I think the best way to do this is: # remove blank lines line_array = [line for line in line_array if l