Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29822 > unrolled thread

For Counter Variable

Started byjimbo1qaz <jimmyli1528@gmail.com>
First post2012-09-23 09:36 -0700
Last post2012-09-25 12:20 +0100
Articles 20 on this page of 44 — 17 participants

Back to article view | Back to comp.lang.python


Contents

  For Counter Variable jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 09:36 -0700
    Re: For Counter Variable Rodrick Brown <rodrick.brown@gmail.com> - 2012-09-23 12:45 -0400
    Re: For Counter Variable Chris Angelico <rosuav@gmail.com> - 2012-09-24 02:52 +1000
    Re: For Counter Variable jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 10:45 -0700
      Re: For Counter Variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-23 22:54 +0000
        Re: For Counter Variable Tim Chase <python.list@tim.thechases.com> - 2012-09-23 18:29 -0500
        Re: For Counter Variable Tim Chase <python.list@tim.thechases.com> - 2012-09-23 19:05 -0500
        Re: For Counter Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-24 02:03 +0100
        RE: For Counter Variable "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-09-27 17:34 +0000
      Re: For Counter Variable Ethan Furman <ethan@stoneleaf.us> - 2012-09-24 15:09 -0700
      Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 18:26 -0400
      Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 18:58 -0400
        Re: For Counter Variable alex23 <wuwei23@gmail.com> - 2012-09-24 16:33 -0700
          Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 19:49 -0400
            Re: For Counter Variable alex23 <wuwei23@gmail.com> - 2012-09-24 16:58 -0700
              Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 20:17 -0400
                Re: For Counter Variable alex23 <wuwei23@gmail.com> - 2012-09-24 17:19 -0700
                  Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 20:25 -0400
                  Re: For Counter Variable "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-09-24 18:32 -0600
                  Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 20:45 -0400
                  Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 20:50 -0400
                  Re: For Counter Variable Paul Rubin <no.email@nospam.invalid> - 2012-09-24 18:10 -0700
                    Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 21:32 -0400
                    Re: For Counter Variable Chris Angelico <rosuav@gmail.com> - 2012-09-25 17:55 +1000
                  Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 21:13 -0400
                Re: For Counter Variable Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 06:41 -0700
                Re: For Counter Variable Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 06:41 -0700
          Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 19:50 -0400
      Re: For Counter Variable Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 19:39 -0400
        Re: For Counter Variable alex23 <wuwei23@gmail.com> - 2012-09-24 16:48 -0700
        Re: For Counter Variable Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:53 +0200
          Re: For Counter Variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 07:46 +0000
            Re: For Counter Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 08:59 +0100
              Re: For Counter Variable wxjmfauth@gmail.com - 2012-09-25 02:32 -0700
                Re: For Counter Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 10:46 +0100
                Re: For Counter Variable Chris Rebert <clp2@rebertia.com> - 2012-09-25 02:53 -0700
                Re: For Counter Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 11:16 +0100
                  Re: For Counter Variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 14:19 +0000
                    Re: For Counter Variable Chris Angelico <rosuav@gmail.com> - 2012-09-26 00:38 +1000
                Re: For Counter Variable Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 11:54 -0400
              Re: For Counter Variable wxjmfauth@gmail.com - 2012-09-25 02:32 -0700
            (non sequitur) Re: For Counter Variable Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 11:51 -0400
          Re: For Counter Variable Tim Chase <python.list@tim.thechases.com> - 2012-09-25 05:57 -0500
          Re: For Counter Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 12:20 +0100

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#29982

FromDwight Hutto <dwightdhutto@gmail.com>
Date2012-09-24 20:50 -0400
Message-ID<mailman.1256.1348534231.27098.python-list@python.org>
In reply to#29976
On Mon, Sep 24, 2012 at 8:32 PM, Littlefield, Tyler <tyler@tysdomain.com> wrote:
> On 9/24/2012 6:25 PM, Dwight Hutto wrote:
>>>
>>> To highlight the vast gulf between what you think you are and what you
>>> actually produce.
>>
>> I produce working code, and if it works, then I don't just think...I know.
>>
>> Working code != good code. Just an observation. Also, I've noticed a vast
>> differences between someone who can explain their answers as Alix has done
>> on multiple threads you've replied to in the last 5 minutes, and someone who
>> cobbles something together with "your variable isn't being shown right
I might have mispoke, forgive me for knowing several languages,and
getting a little class syntax wrong,. It's called computer science and
interdisciplinary study you dumb fucking double digit IQ'd twit.


>> because there's no self.a," which actually really makes no sense at all.

That was in a class scenario

>> Just my $0.02.
>
>
> --
> Take care,
> Ty
> http://tds-solutions.net
> The aspen project: a barebones light-weight mud engine:
> http://code.google.com/p/aspenmud
> He that will not reason is a bigot; he that cannot reason is a fool; he that
> dares not reason is a slave.
>
> --
> http://mail.python.org/mailman/listinfo/python-list



-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

[toc] | [prev] | [next] | [standalone]


#29983

FromPaul Rubin <no.email@nospam.invalid>
Date2012-09-24 18:10 -0700
Message-ID<7xtxumhpqm.fsf@ruckus.brouhaha.com>
In reply to#29976
alex23 <wuwei23@gmail.com> writes:
> To highlight the vast gulf between what you think you are and what you
> actually produce.

By now I think we're in the DNFTT zone.

[toc] | [prev] | [next] | [standalone]


#30034

FromDwight Hutto <dwightdhutto@gmail.com>
Date2012-09-24 21:32 -0400
Message-ID<mailman.1288.1348558622.27098.python-list@python.org>
In reply to#29983
> By now I think we're in the DNFTT zone.
> --
Taking a bite yourself there buddy. Hop under the bridge, and
comment...it make you a troll, and you're trying to feed yourself with
pile on comment from the rest of the under bridge dwellers.

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

[toc] | [prev] | [next] | [standalone]


#30039

FromChris Angelico <rosuav@gmail.com>
Date2012-09-25 17:55 +1000
Message-ID<mailman.1291.1348559732.27098.python-list@python.org>
In reply to#29983
On Tue, Sep 25, 2012 at 11:32 AM, Dwight Hutto <dwightdhutto@gmail.com> wrote:
>> By now I think we're in the DNFTT zone.
>> --
> Taking a bite yourself there buddy. Hop under the bridge, and
> comment...it make you a troll, and you're trying to feed yourself with
> pile on comment from the rest of the under bridge dwellers.

Dwight/David, may I courteously recommend and request that you refrain
from posting until you've calmed down a little? You're really not
doing your reputation much good. Unfortunately you're also impacting
the reputation of the list/newsgroup. People will come here looking
for help, and will see that people are biting and scratching at one
another[1], and will turn away. And that, in turn, reflects badly on
the language.

It's fine to disagree with someone - that's one of the best ways to
explore a problem space and turn up more information. What's not fine
is the bad language and vitriol.

To Paul Rubin (whose name and citation were omitted from Dwight's
quoted text): My apologies, I fear I am feeding a troll here. But
something needed to be said.

[1] Galations 5:15, eg http://bible.cc/galatians/5-15.htm - come to
think of it, the whole chapter applies fairly well here.
http://www.biblegateway.com/passage/?search=Galatians+5

ChrisA

[toc] | [prev] | [next] | [standalone]


#29984

FromDwight Hutto <dwightdhutto@gmail.com>
Date2012-09-24 21:13 -0400
Message-ID<mailman.1257.1348535589.27098.python-list@python.org>
In reply to#29976
Anything else bitch?

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

[toc] | [prev] | [next] | [standalone]


#30491

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-09-29 06:41 -0700
Message-ID<0bed7b23-856c-41d0-b5ed-98ab4108cec1@googlegroups.com>
In reply to#29975
On Tuesday, 25 September 2012 05:48:22 UTC+5:30, David Hutto  wrote:
> > Is the animated GIF on your website under 60MB yet?
> 
> yeah a command line called convert, and taking out a few jpegs used to
> 
> convert, and I can reduce it to any size, what's the fucking point of
> 
> that question other than ignorant rhetoric, that you know is easily
> 
> fixable?
> 
> 
> 
> 
> 
> -- 
> 
> Best Regards,
> 
> David Hutto
> 
> CEO: http://www.hitwebdevelopment.com

There are children (such as me) here!

[toc] | [prev] | [next] | [standalone]


#30492

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-09-29 06:41 -0700
Message-ID<mailman.1624.1348926110.27098.python-list@python.org>
In reply to#29975
On Tuesday, 25 September 2012 05:48:22 UTC+5:30, David Hutto  wrote:
> > Is the animated GIF on your website under 60MB yet?
> 
> yeah a command line called convert, and taking out a few jpegs used to
> 
> convert, and I can reduce it to any size, what's the fucking point of
> 
> that question other than ignorant rhetoric, that you know is easily
> 
> fixable?
> 
> 
> 
> 
> 
> -- 
> 
> Best Regards,
> 
> David Hutto
> 
> CEO: http://www.hitwebdevelopment.com

There are children (such as me) here!

[toc] | [prev] | [next] | [standalone]


#29967

FromDwight Hutto <dwightdhutto@gmail.com>
Date2012-09-24 19:50 -0400
Message-ID<mailman.1245.1348530607.27098.python-list@python.org>
In reply to#29960
Propaganda over...

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

[toc] | [prev] | [next] | [standalone]


#29962

FromDwight Hutto <dwightdhutto@gmail.com>
Date2012-09-24 19:39 -0400
Message-ID<mailman.1242.1348529944.27098.python-list@python.org>
In reply to#29832
On Sep 25, 8:26 am, Dwight Hutto <dwightdhu...@gmail.com> wrote:
> It's a function usage. Not to be too serious, there are usually
> simpler solutions, and built in functions.

`enumerate` _is_ a built-in function. Please provide an example of a
"simpler solution".

It's not the simpler solution I'm referring to, it's the fact that if
you're learning, then you should be able to design the built-in, not
just use it.

You don't always know all the built-ins, so the builtin is simpler,
but knowing how to code it yourself is the priority of learning to
code in a higher level language, which should be simpler to the user
of python.

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

[toc] | [prev] | [next] | [standalone]


#29965

Fromalex23 <wuwei23@gmail.com>
Date2012-09-24 16:48 -0700
Message-ID<9ae3a20f-9ec1-4ab9-b54f-99cb9ca0139b@c6g2000pba.googlegroups.com>
In reply to#29962
On Sep 25, 9:39 am, Dwight Hutto <dwightdhu...@gmail.com> wrote:
> It's not the simpler solution I'm referring to, it's the fact that if
> you're learning, then you should be able to design the built-in, not
> just use it.

Garbage. I don't need to be able to build a SQLAlchemy to use it. I
don't need to be able to build an XML parser to use one. The whole
goddamn point of abstractions is to _ease the cognitive load_ in
building a complex system.

> You don't always know all the built-ins, so the builtin is simpler,
> but knowing how to code it yourself is the priority of learning to
> code in a higher level language, which should be simpler to the user
> of python.

"Higher level" means, in part, not _having to give a shit_ about the
sort of low level coding you're obsessed with. If it rocks your world
to declare your own index pointer and increment it on each pass of a
loop, knock yourself out. Just accept that others will criticise your
code for being "unpythonic". Why even use the language if you're not
prepared to _use_ the language...and that means _more than the
syntax_. It extends to the standard library and through to the entire
ecosystem that has developed around it.

People are drawn to Python to get shit done, not to spend pointless
time in recreating every wheel.

[toc] | [prev] | [next] | [standalone]


#30028

FromThomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Date2012-09-25 07:53 +0200
Message-ID<k3rgtq$qtn$1@r03.glglgl.gl>
In reply to#29962
Am 25.09.2012 01:39 schrieb Dwight Hutto:

> It's not the simpler solution I'm referring to, it's the fact that if
> you're learning, then you should be able to design the built-in, not
> just use it.

In some simpler cases you are right here. But the fact that you are able 
to design it doesn't necessarily mean that you should actually use your 
self-designed version.

But what you post suggests is important as well: if using the neat fancy 
built-in simplifications, you should always be aware what overhead they 
imply.

An example:

     Let l be a big, big list.

     for i in <some source>:
         if i in l: <do something>

This looks neat and simple and doesn't look as expensive as it really is.

If l is converted to a set beforehand, it nearly looks the same, but it 
is simpler.

So even if you use builtins, be aware what they do.


> You don't always know all the built-ins, so the builtin is simpler,
> but knowing how to code it yourself is the priority of learning to
> code in a higher level language, which should be simpler to the user
> of python.

When learning Python, it often happend me to re-inven the wheel. But as 
soon as I saw the presence of something I re-wrote, I skipped my 
re-written version and used the built-in.


Thomas

[toc] | [prev] | [next] | [standalone]


#30037

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-09-25 07:46 +0000
Message-ID<50616157$0$29997$c3e8da3$5496439d@news.astraweb.com>
In reply to#30028
On Tue, 25 Sep 2012 07:53:55 +0200, Thomas Rachel wrote:

> When learning Python, it often happend me to re-inven the wheel. But as
> soon as I saw the presence of something I re-wrote, I skipped my
> re-written version and used the built-in.

And me.

Not just Python either. The very first piece of code I wrote on a Linux 
machine was a shell script that (very badly, and even more very slowly) 
counted the number of files in a directory. 20 lines (if I remember 
correctly) to duplicate a simple:

ls | wc -l


It was a humbling lesson to always check what features a programming 
environment or language offers before reinventing the wheel with four 
sides.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#30040

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-09-25 08:59 +0100
Message-ID<mailman.1292.1348559933.27098.python-list@python.org>
In reply to#30037
On 25/09/2012 08:46, Steven D'Aprano wrote:
> On Tue, 25 Sep 2012 07:53:55 +0200, Thomas Rachel wrote:
>
>> When learning Python, it often happend me to re-inven the wheel. But as
>> soon as I saw the presence of something I re-wrote, I skipped my
>> re-written version and used the built-in.
>
> And me.
>
> Not just Python either. The very first piece of code I wrote on a Linux
> machine was a shell script that (very badly, and even more very slowly)
> counted the number of files in a directory. 20 lines (if I remember
> correctly) to duplicate a simple:
>
> ls | wc -l
>
>
> It was a humbling lesson to always check what features a programming
> environment or language offers before reinventing the wheel with four
> sides.
>
>
>

Thankfully easier in a relatively concise language like Python as 
opposed to (say) Java.  Which reminds me, in what version of Python are 
we getting the singletonMap? :)

-- 
Cheers.

Mark Lawrence.

[toc] | [prev] | [next] | [standalone]


#30051

Fromwxjmfauth@gmail.com
Date2012-09-25 02:32 -0700
Message-ID<46c1b87a-7407-4c7e-9aee-0fe44ae3b07a@googlegroups.com>
In reply to#30040
I wrote my first program on a PDP-8. I discovered Python
at release 1.5.?

Now years later... I find Python more and more unusable.

As an exemple related to this topic, which summarizes a
little bit the situation. I just opened my interactive
interpreter and produced this:

>>> for i in range(len(s)-1, -1,-1):
...     '{} {}'.format(i, s[i])
...     
'2 c'
'1 b'
'0 a'

I did it so many times with a reverse/enumerate combination,
I'm unable to do it again, I simply do not remember!


One another really annoying aspect of Python, illustrated
in my previous code: ''.format() .
Was it not supposed to be *the* new formating scheme?

I'm toying more and more with the go language. I really
appreciate and rediscover the strictness I learned with
Pascal.

jmf

[toc] | [prev] | [next] | [standalone]


#30054

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-09-25 10:46 +0100
Message-ID<mailman.1303.1348566306.27098.python-list@python.org>
In reply to#30051
On 25/09/2012 10:32, wxjmfauth@gmail.com wrote:
> I wrote my first program on a PDP-8. I discovered Python
> at release 1.5.?
>
> Now years later... I find Python more and more unusable.

Dementia is a growing problem for us older people :)

>
> As an exemple related to this topic, which summarizes a
> little bit the situation. I just opened my interactive
> interpreter and produced this:
>
>>>> for i in range(len(s)-1, -1,-1):
> ...     '{} {}'.format(i, s[i])
> ...
> '2 c'
> '1 b'
> '0 a'
>
> I did it so many times with a reverse/enumerate combination,
> I'm unable to do it again, I simply do not remember!

Based on things I've read as I've never used it myself try using Perl as 
that should simplify things for you.

>
>
> One another really annoying aspect of Python, illustrated
> in my previous code: ''.format() .
> Was it not supposed to be *the* new formating scheme?

That might have been the original intention but it's not going to take 
over the world as there's too much legacy code using the C style % 
formatters.  IIRC isn't there also something about string templates???

>
> I'm toying more and more with the go language. I really
> appreciate and rediscover the strictness I learned with
> Pascal.

So go and use go as nobody here is stopping you.

>
> jmf
>

-- 
Cheers.

Mark Lawrence.

[toc] | [prev] | [next] | [standalone]


#30055

FromChris Rebert <clp2@rebertia.com>
Date2012-09-25 02:53 -0700
Message-ID<mailman.1304.1348566794.27098.python-list@python.org>
In reply to#30051
On Tue, Sep 25, 2012 at 2:46 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 25/09/2012 10:32, wxjmfauth@gmail.com wrote:
>>
>> I wrote my first program on a PDP-8. I discovered Python
>> at release 1.5.?
>>
>> Now years later... I find Python more and more unusable.
<snip>
>> I'm toying more and more with the go language. I really
>> appreciate and rediscover the strictness I learned with
>> Pascal.
>
> So go and use go as nobody here is stopping you.

Well, the PSU might, except they emphatically do not exist...

Cheers,
Chris
--
PEP-401 compliant

[toc] | [prev] | [next] | [standalone]


#30057

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-09-25 11:16 +0100
Message-ID<mailman.1307.1348568168.27098.python-list@python.org>
In reply to#30051
On 25/09/2012 10:53, Chris Rebert wrote:

[snip]

>
> Well, the PSU might, except they emphatically do not exist...

I know that they exist but if I admit to it I'd have to shoot myself. 
If I can get the bra off of the debutante that is.

>
> Cheers,
> Chris
> --
> PEP-401 compliant
>

-- 
Cheers.

Mark Lawrence.

[toc] | [prev] | [next] | [standalone]


#30089

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-09-25 14:19 +0000
Message-ID<5061bd75$0$29981$c3e8da3$5496439d@news.astraweb.com>
In reply to#30057
On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence wrote:

> On 25/09/2012 10:53, Chris Rebert wrote:
> 
> [snip]
> 
>> Well, the PSU might, except they emphatically do not exist...
> 
> I know that they exist 

You are delusional. The PSU certainly do not exist and it is a myth that 
they 

[toc] | [prev] | [next] | [standalone]


#30092

FromChris Angelico <rosuav@gmail.com>
Date2012-09-26 00:38 +1000
Message-ID<mailman.1340.1348583913.27098.python-list@python.org>
In reply to#30089
On Wed, Sep 26, 2012 at 12:19 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence wrote:
>
>> On 25/09/2012 10:53, Chris Rebert wrote:
>>
>> [snip]
>>
>>> Well, the PSU might, except they emphatically do not exist...
>>
>> I know that they exist
>
> You are delusional. The PSU certainly do not exist and it is a myth that
> they

Something got cut off. I wonder if Steven's computer's Power Supply
Unit just let off its magic smoke...

ChrisA

[toc] | [prev] | [next] | [standalone]


#30104

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-09-25 11:54 -0400
Message-ID<mailman.1348.1348588505.27098.python-list@python.org>
In reply to#30051
On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence
<breamoreboy@yahoo.co.uk> declaimed the following in
gmane.comp.python.general:

> I know that they exist but if I admit to it I'd have to shoot myself. 
> If I can get the bra off of the debutante that is.
>
	At least it isn't a chupacabra you need to get off...


	{silliness seems to abound today -- maybe I got out of bed too
early}
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | comp.lang.python


csiph-web