Marc 'BlackJack' Rintsch:
> bearophile
> while xrange(n) is a bit less easy to
> > understand (a generator or generators).
I meant "a generator of generators", a typo, sorry. -.-
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
I'm not sure if our views are moving closer together or further apart,
but here goes...
On Thu, 02 Oct 2008 23:49:16 +, Marc 'BlackJack' Rintsch wrote:
> On Thu, 02 Oct 2008 14:51:29 +, Steven D'Aprano wrote:
>
>> On Wed, 01 Oct 2008 10:38:12 +, Marc 'BlackJack' Rintsch wrote:
>>
On Thu, 02 Oct 2008 18:15:59 -0700, bearophileHUGS wrote:
> What's a range(n)? A function that returns a list of n items, from 0 to
> n. This is easy to understand, while xrange(n) is a bit less easy to
> understand (a generator or generators).
`xrange()` doesn't return a generator or iterator
Steven D'Aprano:
> With Python 3.0, GvR had the
> opportunity to strip Python of all the features that makes Python easy to
> learn, and he didn't. Python still has features that are easy for
> newbies, and features that are powerful for experienced coders, and that
> friendliness for newbies isn't
On Thu, 02 Oct 2008 14:51:29 +, Steven D'Aprano wrote:
> On Wed, 01 Oct 2008 10:38:12 +, Marc 'BlackJack' Rintsch wrote:
>
>> Even if newbies don't understand all the details they should be
>> introduced to ``with`` right away IMHO. Because if you explain all the
>> details, even if they
On Wed, 01 Oct 2008 10:38:12 +, Marc 'BlackJack' Rintsch wrote:
>> The first problem with "with" is that it looks like the Pascal "with"
>> statement, but acts nothing like it. That may confuse anyone with
>> Pascal experience, and there are a lot of us out there.
>
> But Python is not Pascal
Grant Edwards wrote:
> On 2008-09-30, Peter Pearson <[EMAIL PROTECTED]> wrote:
>> On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote:
>>> 1. Multi dimensional arrays - how do you load them in python
>>> For example, if I had:
>>> ---
>>> 1 2 3
>>> 4 5 6
>>> 7 8 9
>>>
>>> 10 11 12
>>> 13 14 1
On Wed, 01 Oct 2008 09:35:03 +, Steven D'Aprano wrote:
> On Wed, 01 Oct 2008 06:58:11 +, Marc 'BlackJack' Rintsch wrote:
>
>>> I would weaken that claim a tad... I'd say it is "usual" to write
>>> something like this:
>>>
>>> alist = []
>>> for x in some_values:
>>> alist.append(some
On Wed, 01 Oct 2008 06:58:11 +, Marc 'BlackJack' Rintsch wrote:
>> I would weaken that claim a tad... I'd say it is "usual" to write
>> something like this:
>>
>> alist = []
>> for x in some_values:
>> alist.append(something_from_x)
>>
>>
>> but it is not uncommon (at least not in my c
On Tue, 30 Sep 2008 19:44:40 -0500, Grant Edwards wrote:
> On 2008-09-30, Steven D'Aprano <[EMAIL PROTECTED]>
> wrote:
>> On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote:
>>
> How would the python equivalent go ?
>>>
>>> You would drag yourself out of the 1960s, install numpy, and the
On Tue, 30 Sep 2008 23:40:22 +, Steven D'Aprano wrote:
> On Tue, 30 Sep 2008 14:34:31 +, Marc 'BlackJack' Rintsch wrote:
>
>> There is no array. The data type is called "list" in Python, so
>> `result` is a nested list. And in Python it quite unusual to build
>> lists by creating them w
On 2008-09-30, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote:
>
How would the python equivalent go ?
>>
>> You would drag yourself out of the 1960s, install numpy, and
>> then do something like this:
>
> I think that was thoughtlessly rud
En Mon, 29 Sep 2008 19:04:18 -0300, Ivan Reborin
<[EMAIL PROTECTED]> escribió:
1. Multi dimensional arrays - how do you load them in python
For example, if I had:
---
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
---
with "i" being the row number, "j" the column number, and "k" the ..
On Tue, 30 Sep 2008 14:34:31 +, Marc 'BlackJack' Rintsch wrote:
> On Tue, 30 Sep 2008 15:42:58 +0200, Ivan Reborin wrote:
>
>> On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>
>> wrote:
>>>=
>>>from __future__ import with_statement from functools import partial
>>
On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote:
>>> How would the python equivalent go ?
>
> You would drag yourself out of the 1960s, install numpy, and then do
> something like this:
I think that was thoughtlessly rude to somebody who is asking a perfectly
reasonable question.
--
On 2008-09-30, Ivan Reborin <[EMAIL PROTECTED]> wrote:
> But as I said, got a job that't got to be done, so I'm trying
> to figure out how to do array operations as easily as possible
> in python, which are necessary for all my calculations.
numpy
--
Grant Edwards grante
On 30 Sep 2008 15:31:59 GMT, Peter Pearson <[EMAIL PROTECTED]>
wrote:
>
>Since you're coming from the FORTRAN world (thank you for
>that stroll down Memory Lane), you might be doing scientific
>computations, and so might be interested in the SciPy
>package (Google scipy), which gives you arrays an
On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote:
> On 2008-09-30, Peter Pearson <[EMAIL PROTECTED]> wrote:
>> On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote:
>>>
>>> 1. Multi dimensional arrays - how do you load them in python For
>>> example, if I had:
>>> ---
>>> 1 2 3
>>> 4 5
On 2008-09-30, Peter Pearson <[EMAIL PROTECTED]> wrote:
> On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote:
>>
>> 1. Multi dimensional arrays - how do you load them in python
>> For example, if I had:
>> ---
>> 1 2 3
>> 4 5 6
>> 7 8 9
>>
>> 10 11 12
>> 13 14 15
>> 16 17 18
>> ---
>> wi
On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote:
>
> 1. Multi dimensional arrays - how do you load them in python
> For example, if I had:
> ---
> 1 2 3
> 4 5 6
> 7 8 9
>
> 10 11 12
> 13 14 15
> 16 17 18
> ---
> with "i" being the row number, "j" the column number, and "k" the ..
> uh
On Tue, 30 Sep 2008 15:42:58 +0200, Ivan Reborin wrote:
> On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>
> wrote:
>>=
>>from __future__ import with_statement from functools import partial
>>from itertools import islice
>>from pprint import pprint
>>
>>
>>def read_gro
On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>
wrote:
Hello Marc, thanks for answering (on both subjects). I understand now
the logic which lays behind what you were explaining in the other one.
It cleared things quite a bit.
>Well, I don't know if this qualifies as equ
Ivan Reborin wrote:
Hello everyone,
I was wondering if anyone here has a moment of time to help me with 2
things that have been bugging me.
1. Multi dimensional arrays - how do you load them in python
For example, if I had:
---
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
---
with "i"
On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Reborin wrote:
> 1. Multi dimensional arrays - how do you load them in python For
> example, if I had:
> ---
> 1 2 3
> 4 5 6
> 7 8 9
>
> 10 11 12
> 13 14 15
> 16 17 18
> ---
> with "i" being the row number, "j" the column number, and "k" the ..
> u
On Tue, 30 Sep 2008 03:56:03 +0200, Ivan Reborin wrote:
> a = 2.01
> b = 123456.789
> c = 1234.0001
> d = 98765.4321
> # same as above except for d
>
> print (3 * '%12.3f') % (a, b, c)
> #this works beautifully
>
> How to add d at the end but with a different format now, since I've
> "used"
On Mon, Sep 29, 2008 at 6:56 PM, Ivan Reborin
<[EMAIL PROTECTED]> wrote:
> On Mon, 29 Sep 2008 17:59:40 -0700 (PDT), [EMAIL PROTECTED]
> wrote:
>
> Hello bearophile, thank you for replying.
>
>>The Python genie grants you that wish. You were almost right:
> print (3 * '%12.3f') % (a, b, c)
>>
On Mon, 29 Sep 2008 17:59:40 -0700 (PDT), [EMAIL PROTECTED]
wrote:
Hello bearophile, thank you for replying.
>The Python genie grants you that wish. You were almost right:
print (3 * '%12.3f') % (a, b, c)
> 2.000 123456.7891234.000
print 3 * '%12.3f' % (a, b, c)
> 2.000
Ivan Reborin:
> Is there a way to just do something like this (not normal syntax, just
> my wishful thinking):
> print 3*'%12.3f' %a,b,c
> (meaning - use this format for the next 3 real numbers that come
> along)
The Python genie grants you that wish. You were almost right:
>>> a = 2.01
>>> b
On Mon, 29 Sep 2008 16:08:28 -0700 (PDT), Mensanator
<[EMAIL PROTECTED]> wrote:
>> 2. I've read the help on the next one but I just find it difficult
>> understanding it.
>> I have;
>> a=2.01
>> b=123456.789
>> c=1234.0001
>>
Hello Mensanator, thank you for answering in such a short time.
<
On Sep 29, 5:04 pm, Ivan Reborin <[EMAIL PROTECTED]>
wrote:
> Hello everyone,
>
> I was wondering if anyone here has a moment of time to help me with 2
> things that have been bugging me.
>
> 1. Multi dimensional arrays - how do you load them in python
> For example, if I had:
> ---
> 1 2 3
> 4
Hello everyone,
I was wondering if anyone here has a moment of time to help me with 2
things that have been bugging me.
1. Multi dimensional arrays - how do you load them in python
For example, if I had:
---
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
---
with "i" being the row number,
31 matches
Mail list logo