In article <[EMAIL PROTECTED]>,
Steve Howell <[EMAIL PROTECTED]> wrote:
>I've always thought that the best way to introduce new
>programmers to Python is to show them small code
>examples.
Something like this:
http://www.lava.se/sam/
Jacob Hallén
--
--
http://mail.python.org/mailman/listi
>
>> Secondly, Python is nowadays not only used by
>> programmers,
>> but also by e.g. Scientific users (former MatLab
>> users),
>> who are not interested in the code itself,
>> but just in the results of that particular code.
>> For these people a lot of example programs,
>> for which they ca
--- Stef Mientki <[EMAIL PROTECTED]> > >
> I don't know MoinMoin,
> but the answer is Yes (although maybe not for your
> ten snippets).
> First of all I think all programmers keep there own
> collection of code snippets,
> which much more valuable then "all the code code
> snippets from everyone"
Steve Howell wrote:
> --- Stef Mientki <[EMAIL PROTECTED]>
> wrote:
It would even be nicer, if everybody could drop
her/his examples
in a standard way, so they would be automatically
incorporated in
something like the wxPython interactive demo.
>>> Can you elaborate?
>
--- Stef Mientki <[EMAIL PROTECTED]>
wrote:
> >
> >> It would even be nicer, if everybody could drop
> >> her/his examples
> >> in a standard way, so they would be automatically
> >> incorporated in
> >> something like the wxPython interactive demo.
> >>
> >
> > Can you elaborate?
>
> Well if y
>
>> The wxPython demo program is written as an
>> interactive tutorial,
>> with a few hundred examples, nicely ordered in
>> groups.
>> The user can view the demo, the code and the help
>> text.
>> The user can also change the code and see the
>> results right away.
>>
>
> Do you have a link?
w
--- Stef Mientki <[EMAIL PROTECTED]>
wrote:
> Steve Howell wrote:
> > I've always thought that the best way to introduce
> new
> > programmers to Python is to show them small code
> > examples.
> >
> This is really a nice piece of missing Python.
>
Thanks.
> The wxPython demo program is wr
Just for the amusement of the audience. The following is a reusable
testscript:
>>> def add_money(amounts):
... pennies = sum([round(int(amount * 100)) for amount in amounts])
... return float(pennies / 100.0)
...
>>> add_money([0.13, 0.02]) == 0.15
0.14999
>>> add_money([0.13,
Steve Howell wrote:
> I've always thought that the best way to introduce new
> programmers to Python is to show them small code
> examples.
>
This is really a nice piece of missing Python.
Sorry I didn't follow this thread accurately,
but have you considered to produce an example environment li
>
> You could try this wiki page:
>
> http://rosettacode.org/wiki/Main_Page
>
> It has a fair amount of Python examples as well as many more other
> languages (doing the same algorithm).
>
> Hope this helps.
>
> Adonis
THIS IS GREAT :) Thanx!
--
http://mail.python.org/mailman/listinfo/python-l
Steve Howell wrote:
> I've always thought that the best way to introduce new
> programmers to Python is to show them small code
> examples.
You could try this wiki page:
http://rosettacode.org/wiki/Main_Page
It has a fair amount of Python examples as well as many more other
languages (doing
Steven Bethard <[EMAIL PROTECTED]> writes:
> I think I would rewrite the current unit-testing example to use the
> standard library unittest module::
I think these days we're supposed to like doctest better than unittest.
--
http://mail.python.org/mailman/listinfo/python-list
--- Steven Bethard <[EMAIL PROTECTED]> wrote:
> >
> > Maybe this is the first good example that
> motivates a
> > hyperlink to alternatives. Would you accept the
> idea
> > that we keep my original example on the
> SimplePrograms
> > page, but we link to a UnitTestingPhilosophies
> page,
> > and
Steve Howell wrote:
> --- Steven Bethard <[EMAIL PROTECTED]> wrote:
>
>> Steve Howell wrote:
>>> --- Steven Bethard <[EMAIL PROTECTED]>
>> wrote:
I think I would rewrite the current unit-testing
example to use the
standard library unittest module::
# Let's write reus
--- Steven Bethard <[EMAIL PROTECTED]> wrote:
> Steve Howell wrote:
> > --- Steven Bethard <[EMAIL PROTECTED]>
> wrote:
> >> I think I would rewrite the current unit-testing
> >> example to use the
> >> standard library unittest module::
> >>
> >> # Let's write reusable code, and unit test
Steve Howell wrote:
> --- Steven Bethard <[EMAIL PROTECTED]> wrote:
>
>> I think I would rewrite the current unit-testing
>> example to use the
>> standard library unittest module::
>>
>> # Let's write reusable code, and unit test it.
>> def add_money(amounts):
>> # do arithmet
Steve Howell wrote:
> --- Steven Bethard <[EMAIL PROTECTED]> wrote:
>> I think I would rewrite the current unit-testing
>> example to use the
>> standard library unittest module::
>>
>> # Let's write reusable code, and unit test it.
>> def add_money(amounts):
>> # do arithmetic
--- Steven Bethard <[EMAIL PROTECTED]> wrote:
>
> I think I would rewrite the current unit-testing
> example to use the
> standard library unittest module::
>
> # Let's write reusable code, and unit test it.
> def add_money(amounts):
> # do arithmetic in pennies so as not to
--- Steven Bethard <[EMAIL PROTECTED]> wrote:
> I think I would rewrite the current unit-testing
> example to use the
> standard library unittest module::
>
> # Let's write reusable code, and unit test it.
> def add_money(amounts):
> # do arithmetic in pennies so as not to
>
Steve Howell wrote:
> --- Steven Bethard <[EMAIL PROTECTED]> wrote:
>> Very cool! Do you mind putting this up on the Wiki
>> somewhere so that we
>> can link to it more easily? Maybe something like:
>>
>> http://wiki.python.org/moin/SimplePrograms
>>
>
> Done.
I think I would rewrite the cu
--- Wildemar Wildenburger <[EMAIL PROTECTED]>
wrote:
> Steve Howell wrote:
> > # def defines a method in Python
> > def say_hello(name):
> > print 'hello', name
> > say_hello('Jack')
> > say_hello('Jill')
> >
> Doesn't def define methods *xor* functions,
> depending on
Steve Howell wrote:
> # def defines a method in Python
> def say_hello(name):
> print 'hello', name
> say_hello('Jack')
> say_hello('Jill')
>
Doesn't def define methods *xor* functions, depending on the context?
And in this example, say_hello (*yuck*, underscores ...) is
--- BartlebyScrivener <[EMAIL PROTECTED]> wrote:
>
> For the person new to programming (doesn't come from
> C or other
> languages), I think you need to add a separate
> explanation of string
> formatting and how it works, or at least add a
> comment that tells them
> you are using string format
--- BartlebyScrivener <[EMAIL PROTECTED]> wrote:
> On May 26, 1:43 pm, Steve Howell
> <[EMAIL PROTECTED]> wrote:
> > --
> > # def defines a method in Python
> > def tax(itemCharge, taxRate = 0.05):
> > return itemCharge * taxRate
> > print '%.2f' % tax(11.35)
> > p
On May 26, 1:43 pm, Steve Howell <[EMAIL PROTECTED]> wrote:
> --
> parentRabbits, babyRabbits = (1, 1)
> while babyRabbits < 100:
> print 'This generation has %d rabbits' %
> babyRabbits
> parentRabbits, babyRabbits = (babyRabbits,
> parentRabbits + babyRabbits)
>
>
--- Steven D'Aprano wrote:
> On Sat, 26 May 2007 18:48:45 -0700, Steve Howell
> wrote:
>
> > It also has a ComplexNumber class, but I don't
> want to
> > scare away mathphobes.
>
>
> Is it as short as this one-liner?
>
> ComplexNumber = complex
>
Along the idea of not reinventing a class fr
--- Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sat, 26 May 2007 18:48:45 -0700, Steve Howell
> wrote:
>
> > It also has a ComplexNumber class, but I don't
> want to
> > scare away mathphobes.
>
> Is it as short as this one-liner?
>
> ComplexNumber = complex
>
The "It" above refers to *t
On Sat, 26 May 2007 18:48:45 -0700, Steve Howell wrote:
> It also has a ComplexNumber class, but I don't want to
> scare away mathphobes.
Is it as short as this one-liner?
ComplexNumber = complex
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list
On May 26, 9:58 pm, Paul McGuire <[EMAIL PROTECTED]> wrote:
> Out of curiosity, how does this style jibe with the latest embracing
> of Unicode identifiers? Ever tried to type an underscore on a non-US
> keyboard? I have a heck of a time finding/typing the '_' character
> when I visit our clients
Out of curiosity, how does this style jibe with the latest embracing
of Unicode identifiers? Ever tried to type an underscore on a non-US
keyboard? I have a heck of a time finding/typing the '_' character
when I visit our clients in Germany, but this may just be my own
personal Amerocentric issue
--- Paul McGuire <[EMAIL PROTECTED]> wrote:
> On May 26, 8:48 pm, Steve Howell
> <[EMAIL PROTECTED]> wrote:
> >
> > I'm thinking you could actually have a progression
> > from a 1 line program up to a 50-line program.
> The
> > number 50 is kind of arbitrary, but my gut says
> that
> > by a 50-l
Paul McGuire wrote:
> I ***love*** this "10 Little Programs" idea! As soon as I get a
> breathing space, I'm going to add a "10 Little Parsers" page to the
> pyparsing wiki!
>
> On May 26, 2:38 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
>>
>> Though the code should probably follow PEP 8 guide
On May 26, 8:48 pm, Steve Howell <[EMAIL PROTECTED]> wrote:
>
> I'm thinking you could actually have a progression
> from a 1 line program up to a 50-line program. The
> number 50 is kind of arbitrary, but my gut says that
> by a 50-line program, you will have demonstrated
> almost every useful co
--- Paul McGuire <[EMAIL PROTECTED]> wrote:
> I ***love*** this "10 Little Programs" idea! As
> soon as I get a
> breathing space, I'm going to add a "10 Little
> Parsers" page to the
> pyparsing wiki!
>
Thanks. :)
I'm thinking you could actually have a progression
from a 1 line program up to
Paul McGuire wrote:
[...].
>
> I guess pyparsing with its mixedCase functions and attributes is
> doomed for the Dunce Corner. Too bad for BeautifulSoup, cElementTree,
> and wxPython that are also at variance with this canon of Python
> coding style. ("Modules should have short, all-lowercase nam
I ***love*** this "10 Little Programs" idea! As soon as I get a
breathing space, I'm going to add a "10 Little Parsers" page to the
pyparsing wiki!
On May 26, 2:38 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
>
> Though the code should probably follow PEP 8 guidelines, e.g.
> under_scores inste
--- Steven Bethard <[EMAIL PROTECTED]> wrote:
> Very cool! Do you mind putting this up on the Wiki
> somewhere so that we
> can link to it more easily? Maybe something like:
>
> http://wiki.python.org/moin/SimplePrograms
>
Done.
>
> Though the code should probably follow PEP 8
> guideli
Steve Howell wrote:
> I've always thought that the best way to introduce new
> programmers to Python is to show them small code
> examples.
>
> When you go to the tutorial, though, you have to wade
> through quite a bit of English before seeing any
> Python examples.
>
> Below is my attempt at
On 11:43 Sat 26 May , Steve Howell wrote:
> I've always thought that the best way to introduce new
> programmers to Python is to show them small code
> examples.
>
> When you go to the tutorial, though, you have to wade
> through quite a bit of English before seeing any
> Python examples.
>
39 matches
Mail list logo