Re: [Tutor] list mail formatting

2011-12-27 Thread Alexander
On Fri, Dec 23, 2011 at 5:24 AM, Steven D'Aprano wrote:

> Alexander Etter wrote:
>
>  Ah I know of what you mentioned. On an GNU Emacs mailing list I was
>> advised to avoid anything but plaintext. It just seems so archaic. But I'm
>> a novice and will learn why eventually.
>>
>
> There's a number of reasons. In no particular order, and in all cases
> "you" is generic you, not you personally.
>
> * Mastery of your tools. Are you the master of your tools, or are they the
> master of you? If the writer can't turn off HTML mail in common mail
> clients, there is little hope that he can control a compiler, an editor,
> source control, etc. And if he *won't* turn it off, that shows laziness and
> carelessness to others that reflects badly. Especially in the open source
> coding community, including here, your reputation is worth more than gold.
>
> * Code is plain text. Editors sometimes use colour and formatting to
> highlight parts of the code, but fundamentally, programming is about
> reading and writing code. If you need fancy fonts and formatting and
> dancing paperclips to get your message across, chances are you will never
> be more than a mediocre programmer.
>
> * Mail client independence. The people you are writing to use a wide
> variety of mail clients, under many different circumstances. They might be
> logged into a Unix server with only a primitive command-line mail app; they
> might be using mutt, or Thunderbird, or Outlook, or possibly not even
> reading it via mail at all, but via a newsgroup on Usenet. All of these
> programs may display your message differently. You have no control over the
> presentation that the user will see -- best to make the fewest assumptions,
> namely, plain text, and not rely on features which may be missing.
>
> * Your readers may be colour blind, and your red and green lines may look
> identical. Or they may be completely blind, and using a screen reader. Or
> they might prefer to disable HTML emails, and avoid all the dangers and
> problems with it (security vulnerabilities, privacy breaches, and the
> rest). Or they might be sick and tired of straining to reading crappy
> emails with light blue text on a slightly darker blue background. Either
> way, your formatting is lost. Don't expect people to turn on HTML display
> just for you.
>
> * Layout of code (especially Python code) is special. Your mail client may
> mangle the layout. It is very common to see code posted where all
> indentation is lost, or even line breaks, so everything is squashed into a
> single line:
>
>def func(a, b): while b < 100: print b b += 1 print a-b
>
> Or every line is separated by a blank line, which makes it a PITA to paste
> into the interactive interpreter. Even if the reader can fix the mangling,
> they shouldn't have to.
>
>
> --
> Steven
>
> __**_
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor
>

Thanks for the clarity Steven.

-- 
Alexander
7D9C597B
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] help with script

2011-12-27 Thread nicktocco
hello, my name is nick. i got python for software design by Allen B. Downey as 
a gift for christmas. i am completely new to programming and i am having 
trouble figuring out how to do an exercise concerning script.. 
my problem 
5 
x=5 
x+1 
im ok when it comes to using python so far. but it has asked me to put the 
problem into a script and run it. my question is how do i put that problem into 
a script and then how do i run it in python. im learning by myself at home so 
im having trouble figuring this out on my own. my os is win 7 i have python 2.7 
sorry about punctuation! ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with script

2011-12-27 Thread James Reynolds
On Tue, Dec 27, 2011 at 8:31 PM,  wrote:

> hello, my name is nick. i got python for software design by Allen B.
> Downey as a gift for christmas. i am completely new to programming and i am
> having trouble figuring out how to do an exercise concerning script..
> my problem
> 5
> x=5
> x+1
> im ok when it comes to using python so far. but it has asked me to put the
> problem into a script and run it. my question is how do i put that problem
> into a script and then how do i run it in python. im learning by myself at
> home so im having trouble figuring this out on my own. my os is win 7 i
> have python 2.7
> sorry about punctuation!
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
Follow these steps:

1. Start
2. All Programs
3. Python > Python 2.7 This will open "Python Shell"
4. Go to File, New window
5. A new window (untitled) will open. Save this to your desktop. Call it
"test" or "box" or "cloud"
5. You can now write python to a file. Go ahead and try it. You will need
to save it before you run it.
6. Do this by pressing F5 or by going up to run (after you save)

For example, by running this:

x=5
print x
print x+1
print x


will print this in the shell:

>>>
5
6
5
>>>

You can also just run from the shell itself, but I mostly use this for
simple one liners and stuff (which is what you are doing above)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [Python-Help] What is lambdas in Python??

2011-12-27 Thread bob gailer

On 12/27/2011 8:36 PM, Hitesh Kumar wrote:
I really don't get it. What is lambda? I keep seeing it and I couldn't 
understand anything online about it.


lambda
   An anonymous inline function consisting of a single /expression/
   <#term-expression> which is evaluated when the function is called.
   The syntax to create a lambda function is lambda [arguments]: expression

It is a way to create a simple anonymous function.

func = lambda x, y : x + y

is the equivalent of

def func(x, y):
return x = y

Handy when the function returns an expression (no compound statements) 
and does not need a name, e.g.

map(lambda x, y : x + y,  (1,2,3), (4,5,6))

OK now you wonder what is map so:

map(/function/, /iterable/, /.../)
   Apply /function/ to every item of /iterable/ and return a list of
   the results. If additional /iterable/ arguments are passed,
   /function/ must take that many arguments and is applied to the items
   from all iterables in parallel. If one iterable is shorter than
   another it is assumed to be extended with None items. If /function/
   is None, the identity function is assumed; if there are multiple
   arguments, map() <#map> returns a list consisting of tuples
   containing the corresponding items from all iterables (a kind of
   transpose operation). The /iterable/ arguments may be a sequence or
   any iterable object; the result is always a list.

>>> print map(lambda x, y : x + y,  (1,2,3), (4,5,6))
[5, 7, 9]



--
Bob Gailer
919-636-4239
Chapel Hill NC

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


Re: [Tutor] [Python-Help] What is lambdas in Python??

2011-12-27 Thread R. Alan Monroe
> I really don't get it. What is lambda? I keep seeing   it and I
> couldn't understand anything online about it.

It took me a while to get it too. It's for those rare times when you
want a throwaway function. Like you want to do something kind of
functioney without going to the trouble of writing a whole def
statement for it. Personally, I usually use it when I need to do custom
sorts.

Alan

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