Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Doubt
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ജഗന്നാഥ്  
View profile  
 More options Jul 23 2008, 10:51 am
Newsgroups: comp.lang.python
From: ജഗന്നാഥ് <jagana...@gmail.com>
Date: Wed, 23 Jul 2008 07:51:17 -0700 (PDT)
Local: Wed, Jul 23 2008 10:51 am
Subject: Doubt
Friends

I am a Perl programmer new to Python. I have a small doubt.
How to convert the perl notation
$a = ""; expression in Python ?

How to represent the loop
for ($a = $b; $a<=$c;$a++){

} in Python

Jagan
Linguist

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guilherme Polo  
View profile  
 More options Jul 23 2008, 11:07 am
Newsgroups: comp.lang.python
From: "Guilherme Polo" <ggp...@gmail.com>
Date: Wed, 23 Jul 2008 12:07:33 -0300
Local: Wed, Jul 23 2008 11:07 am
Subject: Re: Doubt

On Wed, Jul 23, 2008 at 11:51 AM, ജഗന്നാഥ് <jagana...@gmail.com> wrote:
> Friends

> I am a Perl programmer new to Python. I have a small doubt.
> How to convert the perl notation
> $a = ""; expression in Python ?

a = ""

> How to represent the loop
> for ($a = $b; $a<=$c;$a++){
> } in Python

for a in range(b, c + 1): pass

--
-- Guilherme H. Polo Goncalves

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean DiZazzo  
View profile  
 More options Jul 23 2008, 3:22 pm
Newsgroups: comp.lang.python
From: Sean DiZazzo <half.ital...@gmail.com>
Date: Wed, 23 Jul 2008 12:22:42 -0700 (PDT)
Local: Wed, Jul 23 2008 3:22 pm
Subject: Re: Doubt
On Jul 23, 7:51 am, ജഗന്നാഥ് <jagana...@gmail.com> wrote:

> Friends

> I am a Perl programmer new to Python. I have a small doubt.
> How to convert the perl notation
> $a = ""; expression in Python ?

> How to represent the loop
> for ($a = $b; $a<=$c;$a++){

> } in Python

> Jagan
> Linguist

On most occasions you don't need to use the incrementing loop
behavior.  Lists are the main data structure comparable to an array,
and you can iterate over them without using a counter.  If you have:

aList = [1, 2, 3]

you can do

for item in aList:
    print item

Hope this helps.

~Sean


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paddy  
View profile  
 More options Jul 23 2008, 3:56 pm
Newsgroups: comp.lang.python
From: Paddy <paddy3...@googlemail.com>
Date: Wed, 23 Jul 2008 12:56:35 -0700 (PDT)
Local: Wed, Jul 23 2008 3:56 pm
Subject: Re: Doubt
On Jul 23, 3:51 pm, ജഗന്നാഥ് <jagana...@gmail.com> wrote:

> Friends

> I am a Perl programmer new to Python. I have a small doubt.
> How to convert the perl notation
> $a = ""; expression in Python ?

> How to represent the loop
> for ($a = $b; $a<=$c;$a++){

> } in Python

> Jagan
> Linguist

This might help you generally:
  http://wiki.python.org/moin/PerlPhrasebook

- Paddy.


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fredrik Lundh  
View profile  
 More options Jul 23 2008, 4:13 pm
Newsgroups: comp.lang.python
From: Fredrik Lundh <fred...@pythonware.com>
Date: Wed, 23 Jul 2008 22:13:32 +0200
Local: Wed, Jul 23 2008 4:13 pm
Subject: Re: Doubt

ജഗന്നാഥ് wrote:
> I am a Perl programmer new to Python. I have a small doubt.

I suspect you mean "question", not "doubt".  It's not quite the same thing.

> How to convert the perl notation
> $a = ""; expression in Python ?

> How to represent the loop
> for ($a = $b; $a<=$c;$a++){
> } in Python

Start here:

     http://www.lucasmanual.com/mywiki/PerlPythonPhrasebook

and then read either of these (preferably both):

     http://www.swaroopch.com/byteofpython/
     http://docs.python.org/tut/

</F>


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ജഗന്നാഥ്  
View profile  
 More options Jul 24 2008, 1:57 am
Newsgroups: comp.lang.python
From: ജഗന്നാഥ് <jagana...@gmail.com>
Date: Wed, 23 Jul 2008 22:57:51 -0700 (PDT)
Local: Thurs, Jul 24 2008 1:57 am
Subject: Re: Doubt
On Jul 24, 1:13 am, Fredrik Lundh <fred...@pythonware.com> wrote:
> ജഗന്നാഥ് wrote:
> > I am a Perl programmer new to Python. I have a small doubt.

> I suspect you mean "question", not "doubt".  It's not quite the same thing.

> > How to convert the perl notation
> > $a = ""; expression in Python ?

Thank you for all to giving suggestions .

With regards

Jaganadh G


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile  
 More options Jul 24 2008, 9:19 am
Newsgroups: comp.lang.python
From: "Diez B. Roggisch" <de...@nospam.web.de>
Date: Thu, 24 Jul 2008 15:19:09 +0200
Local: Thurs, Jul 24 2008 9:19 am
Subject: Re: Doubt

Fredrik Lundh wrote:
> ജഗന്നാഥ് wrote:

>> I am a Perl programmer new to Python. I have a small doubt.

> I suspect you mean "question", not "doubt".  It's not quite the same
> thing.

It seems to be an Indian/Asian thing. By now, I tuned myself to read "doubt"
as "question/problem"...

Diez


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobiah  
View profile  
 More options Jul 24 2008, 2:46 pm
Newsgroups: comp.lang.python
From: Tobiah <t...@tobiah.org>
Date: Thu, 24 Jul 2008 11:46:49 -0700
Local: Thurs, Jul 24 2008 2:46 pm
Subject: Re: Doubt

>> How to convert the perl notation
>> $a = ""; expression in Python ?

a = ""

>> How to represent the loop
>> for ($a = $b; $a<=$c;$a++){

>> } in Python

for a in range(b, c + 1):
        do_something()
** Posted from http://www.teranews.com **

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Torrie  
View profile  
 More options Jul 25 2008, 1:37 am
Newsgroups: comp.lang.python
From: Michael Torrie <torr...@gmail.com>
Date: Thu, 24 Jul 2008 23:37:50 -0600
Local: Fri, Jul 25 2008 1:37 am
Subject: Re: Doubt

You wrote:
> How to represent the loop
> for ($a = $b; $a<=$c;$a++){
> } in Python

As other pointed out, iterating through a list or range is often a far
more elegant way to do a loop than a C-style loop.  But the C-style for
loop is just syntactic sugar for a while loop.  In some cases, C-style
for loops can have an initializer, a set of conditions, and incrementer
parts that are all based on different variables.  For example:

for (a=begin_func() ; x < 3 and sometest(b) ; i=somefunc() )

This highly illogical and contrived function could not be represented in
python with a simple "for x in blah" statement.  Rather you have to
represent it in its true form, which is a while loop:

a=begin_func()
while x < 3 and sometest(b):
        #do stuff
        #loop body
        i=somefunc()

In fact, the perl/c for loop of the form:

for (<initializer>;<condition>;<incrementer>)

always translates directly to:

<initializer>
while <condition>:
        #loop body

        <incrementer>


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google