Re: [Tutor] Output 'Strings' to directory

2014-09-08 Thread Danny Yoo
On Mon, Sep 8, 2014 at 12:17 PM, Felisha Lawrence wrote: > Is it possible to output strings created from a print statement into a > directory locally? Hi Felisha, Yes. This can be done from the level of your operating system shell, rather than Python, through "output redirection". http://

[Tutor] Output 'Strings' to directory

2014-09-08 Thread Felisha Lawrence
Is it possible to output strings created from a print statement into a directory locally? If so, would you use sysstdout module? Thanks, Felisha -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fell

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Peter Otten
Juan Christian wrote: >> >> > On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote: >> >> In that spirit here's an alternative implementation of the User class: >> >> from collections import namedtuple >> User = namedtuple( >> "User", >> "steamid personaname lastlogoff prof

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Juan Christian
> > > On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote: > > In that spirit here's an alternative implementation of the User class: > > from collections import namedtuple > User = namedtuple( > "User", > "steamid personaname lastlogoff profileurl " > "avatar timecreat

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Alan Gauld
On 08/09/14 15:17, Juan Christian wrote: Why normal attributes? Isn't it better to make these read-only as I won't ever need to modify them? And even if I modify them, it won't change in the Steam servers, only in my program, and I don't see any use for that, I need the 'real' values always, the

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Alan Gauld
On 08/09/14 15:17, Juan Christian wrote: One tiny tweak... class User(): You don't need the parens after User. You don;t have any superclasses so they do nothing. Python convention for an empty parent list is just to leave the parens off: class User: -- Alan G Author of the Learn to Prog

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Peter Otten
Juan Christian wrote: > On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote: >> Personally I'd use normal attributes, though. >> > > Why normal attributes? Isn't it better to make these read-only as I won't > ever need to modify them? And even if I modify them, it won't change i

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Juan Christian
On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote: > > > Personally I'd use normal attributes, though. > Why normal attributes? Isn't it better to make these read-only as I won't ever need to modify them? And even if I modify them, it won't change in the Steam servers, only in m

[Tutor] Use of "getter" and "setter" attributes

2014-09-08 Thread Sydney Shall
On 08/09/2014 06:01, Danny Yoo wrote: @property def _avatar(self): return self._avatar Hi Joel, The above code looks strange to me. The method and the field name should not use the same name. ah! good catch Danny. I didn't write it, I was commenting on the OP code. But (and maybe this was d

Re: [Tutor] Good approach regarding classes attributes

2014-09-08 Thread Peter Otten
Juan Christian wrote: > I'll definitely use the '@property' decoration. Thanks for the tip, Personally I'd use normal attributes, though. > so, a > different module to accommodate all the API requests and one for the > logic/code itself is a better approach, right? A separate function or meth