Steven D'Aprano writes:
> Suppose you have an expensive calculation that gets used two or more times in
> a
> loop. The obvious way to avoid calculating it twice in an ordinary loop is
> with
> a temporary variable:
>
> result = []
> for x in data:
> tmp = expensive_calculation(x)
> r
Hello, how can I start programming?
--
https://mail.python.org/mailman/listinfo/python-list
On 6 Apr 2017, at 14:43, aldersilva...@gmail.com wrote:
> Hello, how can I start programming?
Let me google that for you => http://www.learnpython.org
--
https://mail.python.org/mailman/listinfo/python-list
Le 06/04/17 à 14:25, Piet van Oostrum a écrit :
Steven D'Aprano writes:
Suppose you have an expensive calculation that gets used two or more times in a
loop. The obvious way to avoid calculating it twice in an ordinary loop is with
a temporary variable:
result = []
for x in data:
tmp = e
Eryk,
Many thanks. I wasn't aware of the Path Editor,
Colin W.
On 2017-04-05 7:55 PM, eryk sun wrote:
On Wed, Apr 5, 2017 at 6:46 PM, Colin J. Williams [1] wrote:
Successful install reported, but:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporat
Vincent Vande Vyvre writes:
> Le 06/04/17 à 14:25, Piet van Oostrum a écrit :
>> Steven D'Aprano writes:
>>
>>> Suppose you have an expensive calculation that gets used two or more
>>> times in a loop. The obvious way to avoid calculating it twice in an
>>> ordinary loop is with a temporary varia
DFS writes:
> On 4/5/2017 10:52 PM, Dan Sommers wrote:
>> On Wed, 05 Apr 2017 22:00:46 -0400, DFS wrote:
>>
>>> I have a simple hard-coded check in place before even trying to connect:
>>>
>>> if dbtype not in ('sqlite postgres'):
>>>print "db type must be sqlite or postgres"
>>>exit()
>>
Le 06/04/2017 à 16:46, DFS a écrit :
On 4/5/2017 10:52 PM, Dan Sommers wrote:
On Wed, 05 Apr 2017 22:00:46 -0400, DFS wrote:
I have a simple hard-coded check in place before even trying to connect:
if dbtype not in ('sqlite postgres'):
print "db type must be sqlite or postgres"
exit()
Due to a new convention of my Internet provider, my current home page is
now:
http://mokkong-shen.homepage.t-online.de
M. K. Shen
--
https://mail.python.org/mailman/listinfo/python-list
Piet van Oostrum writes:
> It is a poor man's 'let'. It would be nice if python had a real 'let'
> construction. Or for example:
>
> [(tmp, tmp + 1) for x in data with tmp = expensive_calculation(x)]
>
> Alas!
It would be nice indeed!
Or even
[(tmp, tmp + 1) for x in data
with expensive_c
On 2017-04-06 14:56, Vincent Vande Vyvre wrote:
> With two passes
>
> e = [expensive_calculation(x) for x in data]
> final = [(x, y+1) for x, y in zip(e, e)]
Using a generator it can be done in one pass:
final = [
(value, tmp, tmp+1)
for value, tmp
in (
(x, expensive_calculation(x
DFS writes:
> On 4/6/2017 10:54 AM, Python wrote:
>> Le 06/04/2017 à 16:46, DFS a écrit :
>>> On 4/5/2017 10:52 PM, Dan Sommers wrote:
On Wed, 05 Apr 2017 22:00:46 -0400, DFS wrote:
> I have a simple hard-coded check in place before even trying to
> connect:
>
> if dbtyp
12 matches
Mail list logo