Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Steven D'Aprano
On Wed, Jul 06, 2016 at 03:35:16PM -0400, bruce wrote: > Hi. > > Saw the decorator thread earlier.. didn't want to pollute it. I know, > I could google! > > But, what are decorators, why are decorators? who decided you needed > them! Sometimes you find yourself writing many functions (or metho

Re: [Tutor] error

2016-07-06 Thread Danny Yoo
> > Have you checked that you have the requisite permissions? That the > socket you are connecting to exists? If its a system call error the > problem is most likely in your environment rather than your code. > That particular error is from Windows. One common cause for it is a network firewall,

Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Danny Yoo
> As to who suggested them you'd need to go back through the > PEPs to see who first suggested it, and then maybe more to see > who's idea finally got accepted. I think it was in Python 2.5. Hi Bruce, Yes, it happened back around 2003: https://www.python.org/dev/peps/pep-0318/ Decorators

Re: [Tutor] OS and Windows version

2016-07-06 Thread Alan Gauld via Tutor
On 06/07/16 19:34, Moses, Samuel wrote: > Mine > > OS: Windows > Windows version: 8.1 > > Python 3.2 > Wing IDE: 15.1 Thanks for the extra info but it doesn't help much with your problem since we still don't know what your code does nor how your environment is set up. BTW Can you connect to you

Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Alan Gauld via Tutor
On 06/07/16 20:35, bruce wrote: > Saw the decorator thread earlier.. didn't want to pollute it. I know, I > could google! > > But, what are decorators, why are decorators? who decided you needed them! decorators are things that modify functions in standard ways. Specifically they are functions t

Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Alex Hall
On Wed, Jul 6, 2016 at 4:56 PM, Alex Hall wrote: > > > On Wed, Jul 6, 2016 at 3:35 PM, bruce wrote: > >> Hi. >> >> Saw the decorator thread earlier.. didn't want to pollute it. I know, I >> could google! >> >> But, what are decorators, why are decorators? who decided you needed them! >> > > I th

[Tutor] OS and Windows version

2016-07-06 Thread Moses, Samuel
Mine OS: Windows Windows version: 8.1 Python 3.2 Wing IDE: 15.1 Sam ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Alex Hall
On Wed, Jul 6, 2016 at 3:35 PM, bruce wrote: > Hi. > > Saw the decorator thread earlier.. didn't want to pollute it. I know, I > could google! > > But, what are decorators, why are decorators? who decided you needed them! > They're functions that modify the decorated function. If I make a functi

[Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread bruce
Hi. Saw the decorator thread earlier.. didn't want to pollute it. I know, I could google! But, what are decorators, why are decorators? who decided you needed them! Thanks! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription o

Re: [Tutor] error

2016-07-06 Thread Alan Gauld via Tutor
On 06/07/16 18:27, Moses, Samuel wrote: > I am getting an error. I tired to run the script in wing IDE. > Without the accompanying code we can only guess. > I am getting this error, > > "Traceback (most recent call last): > File "C:\Program Files (x86)\Wing IDE 5.1\bin\wingdb.py", line 822,

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-06 Thread Alan Gauld via Tutor
On 06/07/16 15:04, loh...@tuta.io wrote: > script, filename = argv > txt = open (filename) > > print "Here's your file %r: " % filename > print txt.read() > > print "Type the filename again: " > file_again = raw_input("> ") > > txt_again = open(file_again) > print txt_again.read() > why do I

Re: [Tutor] Subclassing logging.Handler?

2016-07-06 Thread Alex Hall
On Wed, Jul 6, 2016 at 1:01 PM, Alex Hall wrote: > Regarding this project: I've gone ahead and tried a variant of it. I > wanted to log to an HTML file, since those are much easier to look at with > a screen reader and so I could get used to the concepts involved. Here's > what I've come up with

[Tutor] error

2016-07-06 Thread Moses, Samuel
I am getting an error. I tired to run the script in wing IDE. I am getting this error, "Traceback (most recent call last): File "C:\Program Files (x86)\Wing IDE 5.1\bin\wingdb.py", line 822, in main args['firststop'], err, netserver, pwfile_path) File "C:\Program Files (x86)\Wing IDE 5.1

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-06 Thread Michael Selik
On Wed, Jul 6, 2016 at 10:59 AM wrote: > why do I have to create a variable txt_again to assign it to the open > function and them print the file? > why is it that I can't only write something like open(file_again).read()? > Good insight. In fact you don't need to create the variable. The code `

Re: [Tutor] Subclassing logging.Handler?

2016-07-06 Thread Alex Hall
Regarding this project: I've gone ahead and tried a variant of it. I wanted to log to an HTML file, since those are much easier to look at with a screen reader and so I could get used to the concepts involved. Here's what I've come up with so far. I'll ask the question, then paste the code. I'm get

[Tutor] Subclassing logging.Handler?

2016-07-06 Thread Alex Hall
Hey list, Another day, another Python experiment. I'm wondering what methods I'd have to implement in a custom subclass of logger.Handler. Currently, the recurring jobs I have written log their events to a file each time they run. That's fine, but it doesn't let me keep easily-sorted/searched reco

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-06 Thread lohecn
first, sorry everyone for having attached the file instead of just typing it here. second, thanks a lot for the replies; even though I gave you no code it was quite helpful! the code was this: from sys import argv script, filename = argv txt = open (filename) print "Here's your file %r: " % fi

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-06 Thread Peter Otten
loh...@tuta.io wrote: > hey everyone. this is my first time trying this -- actually, I've been > studying python only for some days now, and I'm afraid my questions are > going to be rally simple, but I can't seem to understand this piece of > code and thus can't move on. You seem to be talki

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-06 Thread Alan Gauld via Tutor
On 06/07/16 00:56, loh...@tuta.io wrote: > hey everyone. this is my first time trying this Welcome, but... > you probably know the book, Sorry, I don't and I suspect I'm not alone. It's probably a fine book, but we don't all know it. > so you know that zed always makes us write code > so tha

Re: [Tutor] dont understand part of a code

2016-07-06 Thread Michael Selik
On Tue, Jul 5, 2016 at 5:36 PM Michael Selik wrote: > On Sat, Jul 2, 2016 at 8:29 AM Alan Gauld via Tutor > wrote: > >> There are arguably easier ways of doing this >> > > I think you'll find that for-loops are preferable to while-loops. Here's > an alternative implementation. > > https://gist.g

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-06 Thread Michael Selik
On Tue, Jul 5, 2016 at 8:24 PM wrote: > I'm having trouble with most of the lines here. > It looks like you tried to attach a file. This mailing list does not allow attachments. Instead, could you paste the code into your email? > things that I don't understand: > 1. the need to put script int

Re: [Tutor] isinstance versus 'is'?

2016-07-06 Thread Alex Hall
Thanks everyone, that all makes more sense. I think I was indeed thinking of "is None", which is essentially the same as "== None" (I know there's a subtile difference, but they do the same thing). Of course, "is None" fits with this usage, as you're asking if the value is the literal None objec