Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Jussi Piitulainen
MRAB writes: > On 2016-08-18 10:46, Jussi Piitulainen wrote: >> Marko Rauhamaa writes: >> >>> Jussi Piitulainen wrote: >>> That looks a bit funny if the "keyword" does not look like a word, but then programming languages do look funny, so why not: (c ? t : e) # ?-expression

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Chris Angelico
On Fri, Aug 19, 2016 at 3:00 AM, Terry Reedy wrote: > On 8/18/2016 5:32 AM, Steven D'Aprano wrote: > >>> Beginners often do not understand that the body of a lambda expression >>> is evaluated in a new local namespace, and only when the resulting >>> function is called, the same as with a def stat

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Terry Reedy
On 8/18/2016 5:32 AM, Steven D'Aprano wrote: Beginners often do not understand that the body of a lambda expression is evaluated in a new local namespace, and only when the resulting function is called, the same as with a def statement. They then neglect to capture current values when writing l

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread MRAB
On 2016-08-18 10:46, Jussi Piitulainen wrote: Marko Rauhamaa writes: Jussi Piitulainen wrote: That looks a bit funny if the "keyword" does not look like a word, but then programming languages do look funny, so why not: (c ? t : e) # ?-expression (c -> t, e) # ->-expression That sh

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Marko Rauhamaa
Chris Angelico : > Folks, read the whole thread before posting :) Corollary: Folks, start a new thread before posting :) Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Chris Angelico
On Thu, Aug 18, 2016 at 7:32 PM, Steven D'Aprano wrote: > So I don't see any > benefit over this: > > for section_name, line_number in text.parser.toc: > drop.add_command(label=section_name, command=lambda > line=line_number: text.yview(line)) >

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Peter Otten
Steven D'Aprano wrote: > On Thursday 18 August 2016 06:25, Terry Reedy wrote: > Sure. But since the behaviour of def functions and lambda functions are > identical, writing a named def won't solve that problem. > > >> for section_name, line_number in text.parser.toc: >> de

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Jussi Piitulainen
Marko Rauhamaa writes: > Jussi Piitulainen wrote: > >> That looks a bit funny if the "keyword" does not look like a word, >> but then programming languages do look funny, so why not: >> >>(c ? t : e) # ?-expression >> >>(c -> t, e) # ->-expression > > That ship has already sailed. Sorry

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Steven D'Aprano
On Thursday 18 August 2016 06:25, Terry Reedy wrote: > On 8/17/2016 2:07 AM, Steven D'Aprano wrote: > >> I realise that there are occasions where we might deliberate choose to >> assign an intermediate value to its own variable, but all else being equal, >> which would you prefer? >> >> #A >> ali

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Marko Rauhamaa
Jussi Piitulainen : > That looks a bit funny if the "keyword" does not look like a word, but > then programming languages do look funny, so why not: > >(c ? t : e) # ?-expression > >(c -> t, e) # ->-expression That ship has already sailed. Marko -- https://mail.python.org/mailman/lis

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Jussi Piitulainen
Lawrence D’Oliveiro writes: > On Thursday, August 18, 2016 at 7:22:50 PM UTC+12, Jussi Piitulainen wrote: >> But please consider calling them conditional expressions. > > And don’t forget switch-expressions, or case-expressions, as some > other advanced languages have had. Which my article showed

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 7:22:50 PM UTC+12, Jussi Piitulainen wrote: > But please consider calling them conditional expressions. And don’t forget switch-expressions, or case-expressions, as some other advanced languages have had. Which my article showed how to do in Python. -- https://mai

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Jussi Piitulainen
Terry Reedy writes: > On 8/17/2016 2:39 AM, Steven D'Aprano wrote: [- -] >> Because the C syntax is horrifically ugly, whereas the Python syntax >> is very close to real English syntax. >> >> "What will you do tonight?" >> >> "Go to the movies, if I finish work on time, otherwise just go home." >

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Gregory Ewing
Terry Reedy wrote: One of the ironies (or puzzles) of Guido's choice is that he once condemned Perl's 'value if cond' as wretched. I don't think that's the same thing. Perl allows 'statement if cond' as an alternative way of writing "if (cond) statement'. Nobody has ever seriously considered al

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Jussi Piitulainen
Ben Bacarisse writes: > Jussi Piitulainen writes: > >> BartC writes: >> >>> On 17/08/2016 07:39, Steven D'Aprano wrote: Rather than ask why Python uses `trueval if cond else falseval`, you should ask why C uses `cond ? trueval : falseval`. Is that documented anywhere? >>> >>> I'm no

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Gregory Ewing
Terry Reedy wrote: What the *current* version removed from an earlier version is that there was a clear community consensus against the condition-in-the-middle syntax Guido proposed The way I remember it, condition-in-the-middle was first suggested by others, and Guido expressed dislike for it

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 12:55:33 PM UTC+12, Terry Reedy wrote: > > On 8/17/2016 7:13 PM, Lawrence D’Oliveiro wrote: > >> On Thursday, August 18, 2016 at 8:25:37 AM UTC+12, Terry Reedy wrote: >>> >>> for section_name, line_number in text.parser.toc: >>> def goto(line=li

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Larry Hudson via Python-list
On 08/17/2016 04:24 AM, Jussi Piitulainen wrote: ... http://www-formal.stanford.edu/jmc/recursive/node2.html (the paper famously titled "Part I" without any Part II, unless I mistake much.) Totally OT here, but... This reminds me of a old record I have with the (deliberately tongue-in-cheek)

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 7:13 PM, Lawrence D’Oliveiro wrote: On Thursday, August 18, 2016 at 8:25:37 AM UTC+12, Terry Reedy wrote: for section_name, line_number in text.parser.toc: def goto(line=line_number): text.yview(line) drop.add_command(label=sectio

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Chris Angelico
On Thu, Aug 18, 2016 at 9:13 AM, Dennis Lee Bieber wrote: > On Wed, 17 Aug 2016 18:52:22 +0100, MRAB > declaimed the following: > > >> >>If "p" points to a struct (record), then "*p" is that struct, and if >>that struct has a member (field) "m", then that member can be accessed >>by "(*p)->m" (th

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 8:25:37 AM UTC+12, Terry Reedy wrote: > > for section_name, line_number in text.parser.toc: > def goto(line=line_number): > text.yview(line) > drop.add_command(label=section_name, command=goto) You don’t think of t

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 6:28:06 AM UTC+12, Terry Reedy wrote: >> https://www.python.org/dev/peps/pep-0308/ > > What the *current* version removed from an earlier version is that there > was a clear community consensus against the condition-in-the-middle > syntax Guido proposed and for so

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 5:53:14 AM UTC+12, MRAB wrote: > C uses "->" for dereferencing a pointer to the member of a struct. The only reason why “s->f” was added was because “(*s).f” was considered an unwieldy thing to have to write all the time. And the only thing that made that unwield

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 6:28:06 AM UTC+12, Terry Reedy wrote: > >> Why couldn’t they have adopted the standard C >> syntax, as used in a whole bunch of other C-derivative languages? >> cond ? trueval : falseval > > That particular syntax was not really considered. At least 10

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:39 PM, Random832 wrote: On Wed, Aug 17, 2016, at 14:27, Terry Reedy wrote: That particular syntax was not really considered. At least 10 versions using 'if', 'then', 'else', and other tokens were. They all had the problem of requiring a new keyword such as 'then' or some other i

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:43 PM, Marko Rauhamaa wrote: Terry Reedy : On 8/17/2016 2:39 AM, Steven D'Aprano wrote: "If I finish work on on time, go to the movies, otherwise just go home." is also real English syntax, and to me, more graceful. It is certainly more neutral among the alternatives. The inver

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Ben Bacarisse
Jussi Piitulainen writes: > BartC writes: > >> On 17/08/2016 07:39, Steven D'Aprano wrote: >>> Rather than ask why Python uses `trueval if cond else falseval`, you >>> should ask why C uses `cond ? trueval : falseval`. Is that documented >>> anywhere? >> >> I'm not fond of C's a ? b : c but the p

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Ben Bacarisse
MRAB writes: > On 2016-08-17 18:19, Jussi Piitulainen wrote: >> MRAB writes: >> >>> On 2016-08-17 12:24, Jussi Piitulainen wrote: BartC writes: > On 17/08/2016 07:39, Steven D'Aprano wrote: >> Rather than ask why Python uses `trueval if cond else falseval`, you >> should ask

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:07 AM, Steven D'Aprano wrote: I realise that there are occasions where we might deliberate choose to assign an intermediate value to its own variable, but all else being equal, which would you prefer? #A alist = [] alist.append(2) alist.append(4) alist.append(8) process(alist) #

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Marko Rauhamaa
MRAB : > On 2016-08-17 19:39, Random832 wrote: >> Why not just if(cond, trueval, falseval), a la Visual Basic? > > Well, it looks too much like a function call, which don't > short-circuit. Well, in Scheme, everything looks like a function call: (define (deflate x) (if (> 0 x)

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread MRAB
On 2016-08-17 19:39, Random832 wrote: On Wed, Aug 17, 2016, at 14:27, Terry Reedy wrote: That particular syntax was not really considered. At least 10 versions using 'if', 'then', 'else', and other tokens were. They all had the problem of requiring a new keyword such as 'then' or some other in

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread MRAB
On 2016-08-17 19:00, Grant Edwards wrote: On 2016-08-17, MRAB wrote: C uses "->" for dereferencing a pointer to the member of a struct. If "p" points to a struct (record), then "*p" is that struct, and if that struct has a member (field) "m", then that member can be accessed by "(*p)->m" (the

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread MRAB
On 2016-08-17 18:58, Marko Rauhamaa wrote: MRAB : C uses "->" for dereferencing a pointer to the member of a struct. What "->" is for C, "." is Python and Java. Python doesn't have C's ".". C has both stacked-allocated and heap-allocated records. That's not the case with Python or Java.

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Marko Rauhamaa
Terry Reedy : > On 8/17/2016 2:39 AM, Steven D'Aprano wrote: > "If I finish work on on time, go to the movies, otherwise just go home." > is also real English syntax, and to me, more graceful. It is certainly > more neutral among the alternatives. The inverted version implies a > clear preferenc

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Random832
On Wed, Aug 17, 2016, at 14:27, Terry Reedy wrote: > That particular syntax was not really considered. At least 10 versions > using 'if', 'then', 'else', and other tokens were. > > They all had the problem of requiring a new keyword such as 'then' or > some other innovation. Why not just if(co

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:39 AM, Steven D'Aprano wrote: On Wednesday 17 August 2016 06:59, Lawrence D’Oliveiro wrote: Here are some examples of that varying mileage. Quote: The Python syntax for conditional expressions (i

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Grant Edwards
On 2016-08-17, MRAB wrote: > C uses "->" for dereferencing a pointer to the member of a struct. > > If "p" points to a struct (record), then "*p" is that struct, and if > that struct has a member (field) "m", then that member can be accessed > by "(*p)->m" (the parens are necessary because of t

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Marko Rauhamaa
MRAB : > C uses "->" for dereferencing a pointer to the member of a struct. What "->" is for C, "." is Python and Java. Python doesn't have C's ".". Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread MRAB
On 2016-08-17 18:19, Jussi Piitulainen wrote: MRAB writes: On 2016-08-17 12:24, Jussi Piitulainen wrote: BartC writes: On 17/08/2016 07:39, Steven D'Aprano wrote: Rather than ask why Python uses `trueval if cond else falseval`, you should ask why C uses `cond ? trueval : falseval`. Is that

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Jussi Piitulainen
MRAB writes: > On 2016-08-17 12:24, Jussi Piitulainen wrote: >> BartC writes: >> >>> On 17/08/2016 07:39, Steven D'Aprano wrote: Rather than ask why Python uses `trueval if cond else falseval`, you should ask why C uses `cond ? trueval : falseval`. Is that documented anywhere? >>> >

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread MRAB
On 2016-08-17 12:24, Jussi Piitulainen wrote: BartC writes: On 17/08/2016 07:39, Steven D'Aprano wrote: Rather than ask why Python uses `trueval if cond else falseval`, you should ask why C uses `cond ? trueval : falseval`. Is that documented anywhere? I'm not fond of C's a ? b : c but the p

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Marko Rauhamaa
Grant Edwards : > On 2016-08-17, Marko Rauhamaa wrote: > >> Somewhat analogously, I remember how confusing it was to learn formal >> logic in college. I was having a hard time getting the point of >> definitions like: >> >>(x ∧ y) is true iff x is true and y is true >> >> That's because I had

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Grant Edwards
On 2016-08-17, Marko Rauhamaa wrote: > Somewhat analogously, I remember how confusing it was to learn formal > logic in college. I was having a hard time getting the point of > definitions like: > >(x ∧ y) is true iff x is true and y is true > > That's because I had learned in highschool that

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Marko Rauhamaa
"D'Arcy J.M. Cain" : > On Wed, 17 Aug 2016 16:39:30 +1000 > Steven D'Aprano wrote: >> cond ? trueval : falseval >> >> Because the C syntax is horrifically ugly, whereas the Python syntax >> is very close to real English syntax. > > Or, put another way, Python prefers English over line n

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread D'Arcy J.M. Cain
On Wed, 17 Aug 2016 16:39:30 +1000 Steven D'Aprano wrote: > cond ? trueval : falseval > > Because the C syntax is horrifically ugly, whereas the Python syntax > is very close to real English syntax. Or, put another way, Python prefers English over line noise. -- D'Arcy J.M. Cain Syste

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Sivan Greenberg
My first attempt at a large code base was with an Ubuntu project, the reason I learned Python was Ubuntu's sabdfl insisting on it be used throughout the OS (back in 2004 I was an Ubuntu developer contributing packages to main) . It was easy to get a job , but I started very early when there were n

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Jussi Piitulainen
BartC writes: > On 17/08/2016 07:39, Steven D'Aprano wrote: >> Rather than ask why Python uses `trueval if cond else falseval`, you >> should ask why C uses `cond ? trueval : falseval`. Is that documented >> anywhere? > > I'm not fond of C's a ? b : c but the principle is sound. I generally [- -]

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread BartC
On 17/08/2016 07:39, Steven D'Aprano wrote: On Wednesday 17 August 2016 06:59, Lawrence D’Oliveiro wrote: [Quote] trueval if cond else falseval "Go to the movies, if I finish work on time, otherwise just go home." Is there /any/ programming language that uses a similar form? Apar

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Christian Gollwitzer
Am 17.08.16 um 08:39 schrieb Steven D'Aprano: Quote: The Python syntax for conditional expressions (introduced in Python 2.5) is trueval if cond else falseval I think this is bloody awful. Why couldn’t they have adopted the standard C syntax, as used in a whole bunch of oth

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Steven D'Aprano
On Wednesday 17 August 2016 06:59, Lawrence D’Oliveiro wrote: > On Wednesday, August 17, 2016 at 6:46:22 AM UTC+12, alister wrote: >> I don't think I am missing anything by not bothering with them YMMV > > Here > > are s

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Steven D'Aprano
On Wednesday 17 August 2016 04:46, alister wrote: > > squared_plus_one_list = map(lambda x: x**2 + 1, some_list) > > probably the cleanest example I have seen so far, & I still cant see the > point Hmmm. Well, let's have a look at some analogies with other kinds of values. Out of each pair of e

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Wednesday, August 17, 2016 at 6:46:22 AM UTC+12, alister wrote: > I don't think I am missing anything by not bothering with them YMMV Here are some examples of that varying mileage. -- https://mail.python.org/mailma

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread alister
On Mon, 15 Aug 2016 11:35:07 -0700, sohcahtoa82 wrote: > On Monday, August 15, 2016 at 8:07:32 AM UTC-7, alister wrote: >> On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: >> >> > 1. How long did it take you guys to master the language or, let me >> > put it this way to completely get the han

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Paul Rudin
Lawrence D’Oliveiro writes: > On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: >> sohcahtoa82 writes: >>> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) >> >> I realise that this is about understanding lambda, but it's worth noting >> in passing that we tend to wri

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Marko Rauhamaa
Chris Angelico : > most of the point of map() is to make use of an existing function: > > # Instead of > lengths = (len(x) for x in items) > # Use > lengths = map(len, items) Both methods are available and I have used each of them, but the former is probably always preferable. Marko -- https:/

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Chris Angelico
On Tue, Aug 16, 2016 at 5:18 PM, Ian Kelly wrote: > Also, unless the mapped function is already defined (and preferably > built-in), a generator expression or list comprehension is usually more > readable and avoids the significant overhead of repeatedly calling a Python > function. Don't know wh

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Jussi Piitulainen
Lawrence D’Oliveiro writes: > On Tuesday, August 16, 2016 at 6:53:24 PM UTC+12, Jussi Piitulainen wrote: >> Lawrence D’Oliveiro writes: >> >>> Why could this difference be important? >> >> Different comprehensions (pun!) and performance characteristics. > > A potential difference in memory usage

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Christian Gollwitzer
Am 15.08.16 um 16:00 schrieb Sickfit92: 1. How long did it take you guys to master the language or, let me put it this way to completely get the hang and start writing code? You never learn a language completely. I'm using Python for 3 years, getting started was a matter of one or two days. Bu

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 7:19:01 PM UTC+12, Ian wrote: > On Aug 16, 2016 12:36 AM, "Lawrence D’Oliveiro" wrote: > > The difference being that the “map” function takes an iterable and returns > an iterator. > > In Python 3, yes. However, assigning the result to the name > "squared_plus_one_li

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:53:24 PM UTC+12, Jussi Piitulainen wrote: > Lawrence D’Oliveiro writes: > >> Why could this difference be important? > > Different comprehensions (pun!) and performance characteristics. A potential difference in memory usage. When could this be important? Conside

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 7:22:42 PM UTC+12, Ian wrote: > On Aug 16, 2016 12:57 AM, "Lawrence D’Oliveiro" wrote: > > But perhaps this limitation wasn’t intentional, just an inherent > consequence of the fact that Python’s significant-whitespace rules only > apply to statements, not expression

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Marko Rauhamaa
Steven D'Aprano : > E.g. out of the following: > > [len(x)+1 for x in sequence] > > list(map(lambda x: len(x) + 1, sequence)) > > the first will probably be faster as well as easier to read and write. It's mostly about idioms. Comprehensions belong to Python's core idioms, lambdas don't.

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Ian Kelly
On Aug 16, 2016 12:57 AM, "Lawrence D’Oliveiro" wrote: I see. I thought I saw a mention somewhere else that Python lambdas were designed to be less functional than full def-style functions. But perhaps this limitation wasn’t intentional, just an inherent consequence of the fact that Python’s si

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Ian Kelly
On Aug 16, 2016 12:36 AM, "Lawrence D’Oliveiro" wrote: On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: > sohcahtoa82 writes: >> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) > > I realise that this is about understanding lambda, but it's worth noting > in passing

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Steven D'Aprano
On Tuesday 16 August 2016 16:28, Lawrence D’Oliveiro wrote: > On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: >> sohcahtoa82 writes: >>> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) >> >> I realise that this is about understanding lambda, but it's worth noting >>

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Jussi Piitulainen
Lawrence D’Oliveiro writes: > On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: >> sohcahtoa82 writes: >>> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) >> >> I realise that this is about understanding lambda, but it's worth noting >> in passing that we tend to writ

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:34:53 PM UTC+12, Ian wrote: > On Aug 15, 2016 6:57 PM, "Lawrence D’Oliveiro" wrote: > > Python, on the other hand, introduces the special word “lambda” for this > purpose, eschewing its usual “def”. > > Why? Something to do with GvR’s allergy to anonymous function

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Ian Kelly
On Aug 15, 2016 6:57 PM, "Lawrence D’Oliveiro" wrote: Python, on the other hand, introduces the special word “lambda” for this purpose, eschewing its usual “def”. Why? Something to do with GvR’s allergy to anonymous functions... Actually, GvR is on record stating that he's never much cared fo

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: > sohcahtoa82 writes: >> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) > > I realise that this is about understanding lambda, but it's worth noting > in passing that we tend to write this sort of thing as: > > square

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Paul Rudin
sohcahto...@gmail.com writes: > On Monday, August 15, 2016 at 8:07:32 AM UTC-7, alister wrote: >> On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: >> >> > 1. How long did it take you guys to master the language or, let me put >> > it this way to completely get the hang and start writing code?

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Lawrence D’Oliveiro
On Tuesday, August 16, 2016 at 6:36:41 AM UTC+12, sohca...@gmail.com wrote: > What helped me understand Lambdas is figuring out that they're really just > a $1,000 term for a $5 concept. The excuse for the “$1,000 term” is that it came from Alonzo Church’s λ-calculus, which was an alternative for

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread sohcahtoa82
On Monday, August 15, 2016 at 8:07:32 AM UTC-7, alister wrote: > On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: > > > 1. How long did it take you guys to master the language or, let me put > > it this way to completely get the hang and start writing code? > > > Some concepts took more time

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Paul Rubin
Sickfit92 writes: > 1. How long did it take you guys to master the language or, let me put > it this way to completely get the hang and start writing code? Just a day or two, but I was already experienced with several similar languages. It would take longer for a beginning programmer. > 2. What

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Grant Edwards
On 2016-08-15, Sickfit92 wrote: > 1. How long did it take you guys to master the language or, let me >put it this way to completely get the hang and start writing code? A few hours. The core language is pretty simple. [I was already fluent in a number of other programming languages -- if y

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Jan Erik Moström
On 15 Aug 2016, at 16:00, Sickfit92 wrote: 1. How long did it take you guys to master the language or, let me put it this way to completely get the hang and start writing code? I'm probably not representative since I had used about 10-15 different language before looking at Python. To learn t

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Chris Angelico
On Tue, Aug 16, 2016 at 12:00 AM, Sickfit92 wrote: > 1. How long did it take you guys to master the language or, let me put it > this way to completely get the hang and start writing code? Python wasn't my first language, so it was a lot easier for me to learn one more language than to learn pro

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread alister
On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: > 1. How long did it take you guys to master the language or, let me put > it this way to completely get the hang and start writing code? > > 2. What made you want to learn python? > > 3. Was it difficult to learn the language? > > 4. Have yo

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Uri Even-Chen
1. After one/two months I knew the language, but after a year really knew it well. 2. I love Python but at first I didn't understand indentation in Python and it was confusing. 3. No. Except indentation. 4. Yes, I got 2 jobs in Python. But I also had to know JavaScript and jQuery. Uri. *Uri E

I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Sickfit92
1. How long did it take you guys to master the language or, let me put it this way to completely get the hang and start writing code? 2. What made you want to learn python? 3. Was it difficult to learn the language? 4. Have you been able to get a job out of your new skill? Thank you guys! I'm

a few questions about scrapy

2012-09-18 Thread Nomen Nescio
I've installed scrapy and gotten a basic set-up working, and I have a few odd questions that I haven't been able to find in the documentation. I plan to run it occasionally from the command line or as a cron job, to scrape new content from a few sites. To avoid duplication, I have in memory two s

Re: a few questions.

2007-10-31 Thread Paul Hankin
On Oct 31, 10:10 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > for i in xrange(0,5): > hundreds, remainder=divmod(stores[i], 100) > print "Store: %i %s" % (i+1, hundreds*"*") Yes, or since you don't need 'remainder'... for i in range(5): hundreds = stores[i] // 100 print "Sto

Re: a few questions.

2007-10-31 Thread Larry Bates
Shawn Minisall wrote: > 1. whats the best way to round a result to 4 decimal places? > > I tried round, but then read that it only works with exponents of 10. > > I'm trying to do it on this piece of code. > > time = (distance / 4900) > > 2. What direction would I go in if I'm getting 5 inputs

a few questions.

2007-10-31 Thread Shawn Minisall
1. whats the best way to round a result to 4 decimal places? I tried round, but then read that it only works with exponents of 10. I'm trying to do it on this piece of code. time = (distance / 4900) 2. What direction would I go in if I'm getting 5 inputs from the user and want to make a bar t

Re: A few questions

2007-05-24 Thread scott
[EMAIL PROTECTED] wrote: > Just wanted to send a quick "Thank You!" to everyone who helped answer my > questions. This > list is awesome!! I'm finding the same, this list is amazing. There is a more welcome feeling than the C or C++ list I have seen. > I'm currently reading "How to Think Like

Re: A few questions

2007-05-22 Thread Urban, Gabor
Jay wrote: " 1. What are your views about Python vs Perl? Do you see one as better than the other?" They are different languages. Perl is very powerfull if you use it knowing potential problems. Python is definitely much easier to learn and use. "2. Is there a good book to start with while learni

Re: A few questions

2007-05-22 Thread Dave Baum
In article <[EMAIL PROTECTED]>, jay <[EMAIL PROTECTED]> wrote: > Hi, > > I'm totally new to Python and was hoping someone might be able to > answer a few questions for me: > > 1. What are your views about Python vs Perl? Do you see one as > bette

Re: A few questions

2007-05-21 Thread Kevin Walzer
jay wrote: > > Anyway, I had one more quick question... in order to run wxPython apps, > do I have to have MacPython, etc. loaded on each Mac (or PC) in order > for it to run any apps I write? Or is there a way to compile the code > to where I can distribute an app I write and the other user

Re: A few questions

2007-05-21 Thread Basilisk96
> After this I went to the tutorial and started trying out some of the > examples. I pasted the code to separate text files and then ran them > through a Terminal window. This stuff is freaking cool!!! Now I > just have to figure out how this all works! > "wxPython in Action" is a decent book fo

Re: A few questions

2007-05-21 Thread jay
Wow!! Thanks so much for your quick and helpful replies! I really appreciate it!! :-) I tried installing off 'wxPython2.8-osx-ansi-2.8.4.0-universal10.4- py2.5.dmg' on my OS 10.4.9 system which wouldn't install. So I installed off 'python-2.5-macosx.dmg' and then installed off 'wxPython

Re: A few questions

2007-05-21 Thread Basilisk96
> 2. Is there a good book to start with while learning Python? I'm > currently reading 'Python Essential Reference' by David M. Beazley. > So far it looks like a pretty good book, but would like more > tutorials to work with (I've also been reading through the tutorials > at 'python.org' which ha

Re: A few questions

2007-05-21 Thread Josiah Carlson
Christopher Arndt wrote: > I have a few quibles with your summary of Python's properties: > On 21 Mai, 08:16, John Nagle <[EMAIL PROTECTED]> wrote: >> Memory management >> is safe and managed by reference counts backed by a garbage collector. >> Weak references are supported. Built in data types a

Re: A few questions

2007-05-21 Thread Kevin Walzer
jay wrote: > 3. Currently, I write most of my code with Xcode (on the Mac platform) > using Applescript. This gives me GUI capabilities. Is there anything > you'd recommend that I could use for Python that would give me a GUI > interface? PyObjC allows you to write Cocoa GUI's from Python

Re: A few questions

2007-05-21 Thread Christopher Arndt
I have a few quibles with your summary of Python's properties: On 21 Mai, 08:16, John Nagle <[EMAIL PROTECTED]> wrote: > If you have a computer science background, here's all you need > to know: Python is a byte-code interpreted untyped Python is strongly but dynamically typed. The fact that

Re: A few questions

2007-05-21 Thread brad
Alex Martelli wrote: > Most popular, however, is no doubt wxWindows -- > mostly because you can freely use it to develop SW which you plan to > distribute under closed-source licenses, while Qt &c force you to choose > -- either pay, or, if you even distribute your code, it will have to be > under

Re: A few questions

2007-05-20 Thread John Nagle
jay wrote: > Hi, > > I'm totally new to Python and was hoping someone might be able to > answer a few questions for me: > > 1. What are your views about Python vs Perl? Do you see one as better > than the other? Python is a much cleaner language than Perl, b

Re: A few questions

2007-05-20 Thread Alex Martelli
jay <[EMAIL PROTECTED]> wrote: > Hi, > > I'm totally new to Python and was hoping someone might be able to > answer a few questions for me: > > 1. What are your views about Python vs Perl? Do you see one as > better than the other? Yep: if I didn't fi

Re: A few questions

2007-05-20 Thread Anthony Irwin
jay wrote: > Hi, > > I'm totally new to Python and was hoping someone might be able to answer > a few questions for me: > > 1. What are your views about Python vs Perl? Do you see one as better > than the other? I have written some scripts in both perl and pyth

A few questions

2007-05-20 Thread jay
Hi, I'm totally new to Python and was hoping someone might be able to answer a few questions for me: 1. What are your views about Python vs Perl? Do you see one as better than the other? 2. Is there a good book to start with while learning Python? I'm currently readi

Idle 1.1.3 class browser + a few questions

2006-09-13 Thread hg
Hi, Is there a way to: 1) open the class browser automatically on the file opening 2) have the class browser updated when functions/classes ... are added to the file 3) have a vertical scroll bar 4) have line numbers Thanks, Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: Considering python - have a few questions.

2005-02-21 Thread Simon John
I'd go with a MySQL / Python / Apache route, but if it's Windows, maybe not. Also, you shouldn't store images in a database - images should be on the filesystem with their paths stored in the database. I'd definitely say going the web application route would be easier (and more portable) than the

  1   2   >