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


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

python programming help

Started byrafaellasav@gmail.com
First post2013-12-08 09:59 -0800
Last post2013-12-09 03:31 +0100
Articles 20 on this page of 40 — 16 participants

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


Contents

  python programming help rafaellasav@gmail.com - 2013-12-08 09:59 -0800
    Re: python programming help YBM <ybmess@nooos.fr.invalid> - 2013-12-08 19:07 +0100
      Re: python programming help rafaellasav@gmail.com - 2013-12-08 10:14 -0800
        Re: python programming help YBM <ybmess@nooos.fr.invalid> - 2013-12-08 19:18 +0100
        Re: python programming help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-08 18:25 +0000
        Re: python programming help Christopher Welborn <cjwelborn@live.com> - 2013-12-09 17:34 -0600
    Re: python programming help Roy Smith <roy@panix.com> - 2013-12-08 13:23 -0500
    Re: python programming help Gary Herron <gary.herron@islandtraining.com> - 2013-12-08 10:20 -0800
    Re: python programming help bob gailer <bgailer@gmail.com> - 2013-12-08 13:27 -0500
      Re: python programming help rafaellasav@gmail.com - 2013-12-08 10:32 -0800
        Re: python programming help rafaellasav@gmail.com - 2013-12-08 10:42 -0800
        Re: python programming help Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-12-08 10:52 -0800
          Re: python programming help rafaellasav@gmail.com - 2013-12-08 11:06 -0800
            Re: python programming help Chris Angelico <rosuav@gmail.com> - 2013-12-09 06:17 +1100
              Re: python programming help rurpy@yahoo.com - 2013-12-08 16:08 -0800
                Re: python programming help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-09 00:27 +0000
                  Re: python programming help rurpy@yahoo.com - 2013-12-08 21:07 -0800
                    Re: python programming help rusi <rustompmody@gmail.com> - 2013-12-08 21:20 -0800
                      Re: python programming help rurpy@yahoo.com - 2013-12-09 21:15 -0800
                    Re: python programming help Chris Angelico <rosuav@gmail.com> - 2013-12-09 18:57 +1100
                      Re: python programming help rurpy@yahoo.com - 2013-12-09 21:07 -0800
                    Re: python programming help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-09 09:34 +0000
                    Meta Fight About Posting (was: python programming help) Travis Griggs <travisgriggs@gmail.com> - 2013-12-09 07:44 -0800
                      Re: Meta Fight About Posting (was: python programming help) rusi <rustompmody@gmail.com> - 2013-12-09 08:25 -0800
                        Re: Meta Fight About Posting (was: python programming help) rusi <rustompmody@gmail.com> - 2013-12-09 08:47 -0800
                        Re: Meta Fight About Posting (was: python programming help) Roy Smith <roy@panix.com> - 2013-12-09 13:48 -0500
                      Re: Meta Fight About Posting (was: python programming help) Roy Smith <roy@panix.com> - 2013-12-09 13:45 -0500
                Re: python programming help Chris Angelico <rosuav@gmail.com> - 2013-12-09 14:05 +1100
                  Re: python programming help rurpy@yahoo.com - 2013-12-08 21:10 -0800
                    Re: python programming help Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-09 00:22 -0500
                    Re: python programming help Chris Angelico <rosuav@gmail.com> - 2013-12-09 19:15 +1100
                      Re: python programming help rurpy@yahoo.com - 2013-12-09 21:10 -0800
                        Re: python programming help Chris Angelico <rosuav@gmail.com> - 2013-12-10 16:29 +1100
            Re: python programming help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-08 19:21 +0000
            Re: python programming help Terry Reedy <tjreedy@udel.edu> - 2013-12-08 16:17 -0500
            Re: python programming help YBM <ybmess@nooos.fr.invalid> - 2013-12-09 03:02 +0100
        Re: python programming help John Ladasky <john_ladasky@sbcglobal.net> - 2013-12-08 11:21 -0800
        Re: python programming help Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-12-09 13:00 +1300
          Re: python programming help YBM <ybmess@nooos.fr.invalid> - 2013-12-09 02:51 +0100
        Re: python programming help YBM <ybmess@nooos.fr.invalid> - 2013-12-09 03:31 +0100

Page 1 of 2  [1] 2  Next page →


#61303 — python programming help

Fromrafaellasav@gmail.com
Date2013-12-08 09:59 -0800
Subjectpython programming help
Message-ID<264c1144-5d04-4ad0-aa32-f4e6770d210c@googlegroups.com>
i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
please help

[toc] | [next] | [standalone]


#61304

FromYBM <ybmess@nooos.fr.invalid>
Date2013-12-08 19:07 +0100
Message-ID<52a4b574$0$2116$426a74cc@news.free.fr>
In reply to#61303
Le 08.12.2013 18:59, rafaellasav@gmail.com a écrit :
> i have a dictionary with names and ages for each name.
> I want to write a function that takes in an age and returns
> the names of all the people who are that age.
> please help

ageDict = { 'john':42, 'jane':36, 'paul':42 }
peopleWithAge = lambda age: [ name for name in ageDict if
			      ageDict[name]==age]

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


#61305

Fromrafaellasav@gmail.com
Date2013-12-08 10:14 -0800
Message-ID<780a4832-411d-499e-96a1-3321d123b82b@googlegroups.com>
In reply to#61304
On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote:
> Le 08.12.2013 18:59, rafaellasav@gmail.com a �crit :
> 
> > i have a dictionary with names and ages for each name.
> 
> > I want to write a function that takes in an age and returns
> 
> > the names of all the people who are that age.
> 
> > please help
> 
> 
> 
> ageDict = { 'john':42, 'jane':36, 'paul':42 }
> 
> peopleWithAge = lambda age: [ name for name in ageDict if
> 
> 			      ageDict[name]==age]


sorry but i'm new to python ;p
1. it has to be in a form of a function called people and
2. how this code takes in an age and returns the names?

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


#61306

FromYBM <ybmess@nooos.fr.invalid>
Date2013-12-08 19:18 +0100
Message-ID<52a4b7d8$0$2146$426a34cc@news.free.fr>
In reply to#61305
Le 08.12.2013 19:14, rafaellasav@gmail.com a écrit :
> On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote:
>> Le 08.12.2013 18:59, rafaellasav@gmail.com a �crit :
>>
>>> i have a dictionary with names and ages for each name.
>>
>>> I want to write a function that takes in an age and returns
>>
>>> the names of all the people who are that age.
>>
>>> please help
>>
>>
>>
>> ageDict = { 'john':42, 'jane':36, 'paul':42 }
>>
>> peopleWithAge = lambda age: [ name for name in ageDict if
>>
>> 			      ageDict[name]==age]
>
>
> sorry but i'm new to python ;p
> 1. it has to be in a form of a function called people and
> 2. how this code takes in an age and returns the names?

  >>> ageDict = { 'john':42, 'jane':36, 'paul':42 }
  >>> people = lambda age: [ name for name in ageDict if
  ...                           ageDict[name]==age]
  >>> people(42)
  ['paul', 'john']


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


#61310

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-12-08 18:25 +0000
Message-ID<mailman.3734.1386527407.18130.python-list@python.org>
In reply to#61305
On 08/12/2013 18:14, rafaellasav@gmail.com wrote:
> On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote:
>> Le 08.12.2013 18:59, rafaellasav@gmail.com a �crit :
>>
>>> i have a dictionary with names and ages for each name.
>>
>>> I want to write a function that takes in an age and returns
>>
>>> the names of all the people who are that age.
>>
>>> please help
>>
>>
>>
>> ageDict = { 'john':42, 'jane':36, 'paul':42 }
>>
>> peopleWithAge = lambda age: [ name for name in ageDict if
>>
>> 			      ageDict[name]==age]
>
>
> sorry but i'm new to python ;p
> 1. it has to be in a form of a function called people and
> 2. how this code takes in an age and returns the names?
>

I'm awfully sorry but I'm not doing your homework for you :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

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


#61421

FromChristopher Welborn <cjwelborn@live.com>
Date2013-12-09 17:34 -0600
Message-ID<mailman.3801.1386632110.18130.python-list@python.org>
In reply to#61305
> On 08/12/2013 18:14, rafaellasav@gmail.com wrote:
>> sorry but i'm new to python ;p
>> 1. it has to be in a form of a function called people and
>> 2. how this code takes in an age and returns the names?
>>


"it has to be in the form of a function called people", that made me 
laugh. Too bad he got an answer, even worse he doesn't know what to do 
with it.
-- 

- Christopher Welborn <cjwelborn@live.com>
   http://welbornprod.com

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


#61307

FromRoy Smith <roy@panix.com>
Date2013-12-08 13:23 -0500
Message-ID<roy-B808B3.13233808122013@news.panix.com>
In reply to#61303
In article <264c1144-5d04-4ad0-aa32-f4e6770d210c@googlegroups.com>,
 rafaellasav@gmail.com wrote:

> i have a dictionary with names and ages for each name. I want to write a 
> function that takes in an age and returns the names of all the people who are 
> that age.
> please help

Homework problem?

In any case, this is a classic example of a real-life problem, and thus 
worth exploring.  The general case is you have a many-to-one mapping and 
you want to find the inverse one-to-many map.

I'm assuming when you say, "a dictionary with names and ages for each 
name", you mean the names are the keys and the ages are the values.  
That would also imply that the names are unique; that's a poor 
assumption for real data sets, but let's assume that's the case here.

So, we're going to take your original dictionary and create a new one 
where the keys are the ages, and the values are lists of names.  That's 
pretty straight forward.  Here's the most brute-force way (which is a 
good place to start):

d2 = {}
for name, age in d1.items():
   if age not in d2:
      d2[age] = []
   d2[age].append(name)

Work through that code in your head to convince yourself that you 
understand what's going on.

This is such a common pattern, Python has a neat tool to make this 
easier.  It's called a defaultdict.  Bascially, this is a dictionary 
which has built into it the "if key doesn't exist, initialize something" 
logic.  It works like this:

from collections import defaultdict

d2 = defaultdict(list)
for name, age in d1.items():
   d2[age].append(name)

The "defaultdict(list)" creates one of these and tells it that the 
"initialize something" part should be "create an empty list".  It's 
hugely convenient and used all the time.

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


#61308

FromGary Herron <gary.herron@islandtraining.com>
Date2013-12-08 10:20 -0800
Message-ID<mailman.3732.1386527201.18130.python-list@python.org>
In reply to#61303
On 12/08/2013 09:59 AM, rafaellasav@gmail.com wrote:
> i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
> please help

This looks like homework for a beginning programming class. Correct?

We like helping people use Python, and we like helping people learn 
Python, but neither of those purposes are served by us *doing* your 
homework for you.

Please, you try to solve the problem, and when you get stuck, show us 
your code, and ask a specific question.

Hint:  You will almost certainly need a loop (through the dictionary 
entries), an 'if' conditional to test for the age matching the given 
age, and a print,

Gary Herron

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


#61309

Frombob gailer <bgailer@gmail.com>
Date2013-12-08 13:27 -0500
Message-ID<mailman.3733.1386527267.18130.python-list@python.org>
In reply to#61303
On 12/8/2013 12:59 PM, rafaellasav@gmail.com wrote:
> i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
> please help
Welcome to the python list. Thanks for posting a question.

If you were hoping for one of us to write the program for you ... well 
that's not what we do on this list.

Please post the code you have so far and tell us exactly where you need 
help.

Also tell us what version of Python, what OS, and what you use to write 
and run Python programs.

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


#61311

Fromrafaellasav@gmail.com
Date2013-12-08 10:32 -0800
Message-ID<2243d31b-f2cb-484a-b6a3-f9f265aa8fd6@googlegroups.com>
In reply to#61309
On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote:
> On 12/8/2013 12:59 PM, rafaellasav@gmail.com wrote:
> 
> > i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
> 
> > please help
> 
> Welcome to the python list. Thanks for posting a question.
> 
> 
> 
> If you were hoping for one of us to write the program for you ... well 
> 
> that's not what we do on this list.
> 
> 
> 
> Please post the code you have so far and tell us exactly where you need 
> 
> help.
> 
> 
> 
> Also tell us what version of Python, what OS, and what you use to write 
> 
> and run Python programs.

name = ['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank', 'Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry']
age = [20, 21, 18, 18, 19, 20, 20, 19, 19, 19, 22, 19]
dic={}
def combine_lists(name,age):
    for i in range(len(name)):
        dic[name[i]]= age[i]
combine_lists(name,age)
print dic

def people(age):
    people=lambda age: [name for name in dic if dic[name]==age]

people(20)




this is the code i have so far(with the help of the first post ;p). i understand how a function and a dictionary works and what I'm asked to find. but i don't get the lambda age part. and this code doesn't give me any result 

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


#61312

Fromrafaellasav@gmail.com
Date2013-12-08 10:42 -0800
Message-ID<97634c6d-9ac5-4e2d-8616-426a59c6b439@googlegroups.com>
In reply to#61311
On Sunday, December 8, 2013 6:32:31 PM UTC, rafae...@gmail.com wrote:
> On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote:
> 
> > On 12/8/2013 12:59 PM, rafaellasav@gmail.com wrote:
> 
> > 
> 
> > > i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
> 
> > 
> 
> > > please help
> 
> > 
> 
> > Welcome to the python list. Thanks for posting a question.
> 
> > 
> 
> > 
> 
> > 
> 
> > If you were hoping for one of us to write the program for you ... well 
> 
> > 
> 
> > that's not what we do on this list.
> 
> > 
> 
> > 
> 
> > 
> 
> > Please post the code you have so far and tell us exactly where you need 
> 
> > 
> 
> > help.
> 
> > 
> 
> > 
> 
> > 
> 
> > Also tell us what version of Python, what OS, and what you use to write 
> 
> > 
> 
> > and run Python programs.
> 
> 
> 
> name = ['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank', 'Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry']
> 
> age = [20, 21, 18, 18, 19, 20, 20, 19, 19, 19, 22, 19]
> 
> dic={}
> 
> def combine_lists(name,age):
> 
>     for i in range(len(name)):
> 
>         dic[name[i]]= age[i]
> 
> combine_lists(name,age)
> 
> print dic
> 
> 
> 
> def people(age):
> 
>     people=lambda age: [name for name in dic if dic[name]==age]
> 
> 
> 
> people(20)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> this is the code i have so far(with the help of the first post ;p). i understand how a function and a dictionary works and what I'm asked to find. but i don't get the lambda age part. and this code doesn't give me any result

and I'm sorry but this is the first time i ask for help in a forum and i just didn't know how it works. I'm not looking for someone to do my homework i just need someone to help me with my code :)

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


#61315

FromBenjamin Kaplan <benjamin.kaplan@case.edu>
Date2013-12-08 10:52 -0800
Message-ID<mailman.3737.1386529135.18130.python-list@python.org>
In reply to#61311
On Sun, Dec 8, 2013 at 10:32 AM, <rafaellasav@gmail.com> wrote:
>
> On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote:
> > On 12/8/2013 12:59 PM, rafaellasav@gmail.com wrote:
> >
> > > i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
> >
> > > please help
> >
> > Welcome to the python list. Thanks for posting a question.
> >
> >
> >
> > If you were hoping for one of us to write the program for you ... well
> >
> > that's not what we do on this list.
> >
> >
> >
> > Please post the code you have so far and tell us exactly where you need
> >
> > help.
> >
> >
> >
> > Also tell us what version of Python, what OS, and what you use to write
> >
> > and run Python programs.
>
> name = ['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank', 'Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry']
> age = [20, 21, 18, 18, 19, 20, 20, 19, 19, 19, 22, 19]
> dic={}
> def combine_lists(name,age):
>     for i in range(len(name)):
>         dic[name[i]]= age[i]
> combine_lists(name,age)
> print dic
>
> def people(age):
>     people=lambda age: [name for name in dic if dic[name]==age]
>
> people(20)
>
>
>
>
> this is the code i have so far(with the help of the first post ;p). i understand how a function and a dictionary works and what I'm asked to find. but i don't get the lambda age part. and this code doesn't give me any result
>
>

To return a value from a function, you need to use the "return"
statement with the value you want to pass back out. You're not doing
that here. Also, you're using a lot of shorthand stuff that you should
probably avoid until you're more comfortable with the language

* Lambda is shorthand for a function. foo = lambda bar : bar + 2 is
the same thing as the function
def foo(bar) :
    return bar + 2

* a list comprehension is short-hand for a loop. spam = [foo for foo
in bar if baz(foo)]  is the same thing as
spam = []
for foo in bar :
    if baz(foo) :
        spam.append(foo)

You don't need a lambda here- just call the code that you need to call directly.

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


#61316

Fromrafaellasav@gmail.com
Date2013-12-08 11:06 -0800
Message-ID<78e2bedb-edcb-47ab-a89d-b62d60611481@googlegroups.com>
In reply to#61315
On Sunday, December 8, 2013 6:52:12 PM UTC, Benjamin Kaplan wrote:
> On Sun, Dec 8, 2013 at 10:32 AM, <rafaellasav@gmail.com> wrote:
> 
> >
> 
> > On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote:
> 
> > > On 12/8/2013 12:59 PM, rafaellasav@gmail.com wrote:
> 
> > >
> 
> > > > i have a dictionary with names and ages for each name. I want to write a function that takes in an age and returns the names of all the people who are that age.
> 
> > >
> 
> > > > please help
> 
> > >
> 
> > > Welcome to the python list. Thanks for posting a question.
> 
> > >
> 
> > >
> 
> > >
> 
> > > If you were hoping for one of us to write the program for you ... well
> 
> > >
> 
> > > that's not what we do on this list.
> 
> > >
> 
> > >
> 
> > >
> 
> > > Please post the code you have so far and tell us exactly where you need
> 
> > >
> 
> > > help.
> 
> > >
> 
> > >
> 
> > >
> 
> > > Also tell us what version of Python, what OS, and what you use to write
> 
> > >
> 
> > > and run Python programs.
> 
> >
> 
> > name = ['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank', 'Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry']
> 
> > age = [20, 21, 18, 18, 19, 20, 20, 19, 19, 19, 22, 19]
> 
> > dic={}
> 
> > def combine_lists(name,age):
> 
> >     for i in range(len(name)):
> 
> >         dic[name[i]]= age[i]
> 
> > combine_lists(name,age)
> 
> > print dic
> 
> >
> 
> > def people(age):
> 
> >     people=lambda age: [name for name in dic if dic[name]==age]
> 
> >
> 
> > people(20)
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > this is the code i have so far(with the help of the first post ;p). i understand how a function and a dictionary works and what I'm asked to find. but i don't get the lambda age part. and this code doesn't give me any result
> 
> >
> 
> >
> 
> 
> 
> To return a value from a function, you need to use the "return"
> 
> statement with the value you want to pass back out. You're not doing
> 
> that here. Also, you're using a lot of shorthand stuff that you should
> 
> probably avoid until you're more comfortable with the language
> 
> 
> 
> * Lambda is shorthand for a function. foo = lambda bar : bar + 2 is
> 
> the same thing as the function
> 
> def foo(bar) :
> 
>     return bar + 2
> 
> 
> 
> * a list comprehension is short-hand for a loop. spam = [foo for foo
> 
> in bar if baz(foo)]  is the same thing as
> 
> spam = []
> 
> for foo in bar :
> 
>     if baz(foo) :
> 
>         spam.append(foo)
> 
> 
> 
> You don't need a lambda here- just call the code that you need to call directly.

i get it, thanks a lot i wrote a different one and it works

def people(age):
    people=[name for name in dic if dic[name]==age]
    print(people)

people(20)

i have one last question

it asks me to test my program function by running these lines:
print ’Dan’ in people(18) and ’Cathy’ in people(18)
print ’Ed’ in people(19) and ’Helen’ in people(19) and\
’Irene’ in people(19) and ’Jack’ in people(19) and ’Larry’in
people(19)
print ’Alice’ in people(20) and ’Frank’ in people(20) and ’Gary’ in
people(20)
print people(21) == [’Bob’]
print people(22) == [’Kelly’]
print people(23) == []

but when i wrote these lines it returns me an error 
Traceback (most recent call last):
  File "/Users/rafaellasavva/Desktop/people.py", line 19, in <module>
    print 'Dan' in people(18) and 'Cathy' in people(18)
TypeError: argument of type 'NoneType' is not utterable

do you know what it might be wrong?

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


#61318

FromChris Angelico <rosuav@gmail.com>
Date2013-12-09 06:17 +1100
Message-ID<mailman.3739.1386530226.18130.python-list@python.org>
In reply to#61316
On Mon, Dec 9, 2013 at 6:06 AM,  <rafaellasav@gmail.com> wrote:
> but when i wrote these lines it returns me an error
> Traceback (most recent call last):
>   File "/Users/rafaellasavva/Desktop/people.py", line 19, in <module>
>     print 'Dan' in people(18) and 'Cathy' in people(18)
> TypeError: argument of type 'NoneType' is not utterable
>
> do you know what it might be wrong?

Hehe. The first thing that's wrong is that you're retyping the error
instead of copying and pasting it. The problem is actually that it's
not *iterable* here. And the reason for that is that you're printing
the result instead of returning it, as has been mentioned by a few
people.

Also, your posts are acquiring the slimy stain of Google Groups, which
makes them rather distasteful. All your replies are getting
double-spaced, among other problems. Please consider switching to an
alternative newsgroup reader, or subscribing to the mailing list:

https://mail.python.org/mailman/listinfo/python-list

The content is the same, but it comes by email instead of netnews.

ChrisA

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


#61336

Fromrurpy@yahoo.com
Date2013-12-08 16:08 -0800
Message-ID<95f70ade-57a5-4537-85ba-1b612812212f@googlegroups.com>
In reply to#61318
On 12/08/2013 12:17 PM, Chris Angelico wrote:
> On Mon, Dec 9, 2013 at 6:06 AM,  <rafaellasav@gmail.com> wrote:>[...]
> Also, your posts are acquiring the slimy stain of Google Groups, which
> makes them rather distasteful. All your replies are getting
> double-spaced, among other problems. Please consider switching to an
> alternative newsgroup reader, or subscribing to the mailing list:
> https://mail.python.org/mailman/listinfo/python-list

To the OP:

First, my apologies if my reply ends up trashing your 
discussion here, but you should know what is behind Mr.
Angelico's response.

For some time now the Google Group Wars are being fought
in this group.

There is a (probably very small) clique of Google haters 
who try present themselves as "the community" and who try
to intimidate anyone posting from Google Groups into using
some other means of posting, completely disregarding the
fact that for many new people or occasional posters, Google 
Groups is an order of magnitude easier to use.  These people
are extremely noisy and obnoxious but *do not* represent 
"the community" except in their own minds.  I suspect many 
of them are motivated by political dislike of Google as 
a corporation, or want to stay with the 1990's technology 
they invested time in learning and don't want see change.

I and many other people post here from Google Groups and 
you should feel free to too if it is more convenient for 
you.  (Of course you can also use the maillist or usenet 
if you find them a good solution for *you* but please don't 
feel compelled to by some loud obnoxious bullies.)

As another poster pointed out, if you are able to follow 
some of the advice at,

  https://wiki.python.org/moin/GoogleGroupsPython

it will help quiet down the anti-Google crowd a little but
even if you don't, those without a Google chip on their shoulder 
will simply skip your posts if they find the Google formatting
too annoying.  Most of us though will deal with it as adults 
and try our best to answer your questions.

I just thought you should have both sides of the story so
to won't take the anti-Google crowd here as gospel.

Addressing you last question, I presume you understood the
other responses about replacing the "print (people)" 
statement in your people() function with "return people".

The only additional thing I wanted to add is that, 

  people=[name for name in dic if dic[name]==age] 

is (I would guess) a rather advanced way of doing what 
you are doing, given where you seem to be in learning
about python (but maybe not, in which case ignore the 
following).

The [....] thing is called as "list comprehension and 
in described here
  http://docs.python.org/3/tutorial/datastructures.html#list-comprehensions

However, it is just a more concise way of writing:

  people = []
  for n, a in dic.items():
    if a == age: people.append (n)
  return people

To understand the above (if you don't already) you'll want 
to read about the the items() method of dicts:
  http://docs.python.org/3/tutorial/datastructures.html#looping-techniques
  http://docs.python.org/3/library/stdtypes.html#mapping-types-dict
the append() method of lists, 
  http://docs.python.org/3/tutorial/controlflow.html#for-statements
  http://docs.python.org/3/library/stdtypes.html#mutable-sequence-types
and of course "for" loops;
  http://docs.python.org/3/tutorial/controlflow.html#for-statements

Hope this helps.

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


#61337

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-12-09 00:27 +0000
Message-ID<mailman.3749.1386548889.18130.python-list@python.org>
In reply to#61336
On 09/12/2013 00:08, rurpy@yahoo.com wrote:
> On 12/08/2013 12:17 PM, Chris Angelico wrote:
>> On Mon, Dec 9, 2013 at 6:06 AM,  <rafaellasav@gmail.com> wrote:>[...]
>> Also, your posts are acquiring the slimy stain of Google Groups, which
>> makes them rather distasteful. All your replies are getting
>> double-spaced, among other problems. Please consider switching to an
>> alternative newsgroup reader, or subscribing to the mailing list:
>> https://mail.python.org/mailman/listinfo/python-list
>
> To the OP:
>
> First, my apologies if my reply ends up trashing your
> discussion here, but you should know what is behind Mr.
> Angelico's response.
>
> For some time now the Google Group Wars are being fought
> in this group.
>
> There is a (probably very small) clique of Google haters
> who try present themselves as "the community" and who try
> to intimidate anyone posting from Google Groups into using
> some other means of posting, completely disregarding the
> fact that for many new people or occasional posters, Google
> Groups is an order of magnitude easier to use.  These people
> are extremely noisy and obnoxious but *do not* represent
> "the community" except in their own minds.  I suspect many
> of them are motivated by political dislike of Google as
> a corporation, or want to stay with the 1990's technology
> they invested time in learning and don't want see change.
>
> I and many other people post here from Google Groups and
> you should feel free to too if it is more convenient for
> you.  (Of course you can also use the maillist or usenet
> if you find them a good solution for *you* but please don't
> feel compelled to by some loud obnoxious bullies.)
>
> As another poster pointed out, if you are able to follow
> some of the advice at,
>
>    https://wiki.python.org/moin/GoogleGroupsPython
>
> it will help quiet down the anti-Google crowd a little but
> even if you don't, those without a Google chip on their shoulder
> will simply skip your posts if they find the Google formatting
> too annoying.  Most of us though will deal with it as adults
> and try our best to answer your questions.
>
> I just thought you should have both sides of the story so
> to won't take the anti-Google crowd here as gospel.
>

To the OP, please ignore the above, it's sheer, unadulterated rubbish. 
Nobody has ever been bullied into doing anything.  People have however 
been asked repeatedly to either A) use the link referenced above to 
avoid sending double spaced crap here from the inferior google groups 
product or B) use an alternative technology that doesn't send double 
spaced crap.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

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


#61358

Fromrurpy@yahoo.com
Date2013-12-08 21:07 -0800
Message-ID<8ed4b168-7a45-4476-9078-080c43f4c1f1@googlegroups.com>
In reply to#61337
On 12/08/2013 05:27 PM, Mark Lawrence wrote:
> On 09/12/2013 00:08, rurpy@yahoo.com wrote:
>> On 12/08/2013 12:17 PM, Chris Angelico wrote:
>>> On Mon, Dec 9, 2013 at 6:06 AM,  <rafaellasav@gmail.com> wrote:>[...]
>[...]
> To the OP, please ignore the above, it's sheer, unadulterated rubbish. 
> Nobody has ever been bullied into doing anything.  People have however 
> been asked repeatedly to either A) use the link referenced above to 
> avoid sending double spaced crap here from the inferior google groups 
> product or B) use an alternative technology that doesn't send double 
> spaced crap.

Mark, I appreciate your calm and reasonable requests for people
to checkout the page you gave a link to, that's why I repeated
your advice.  It is also why I responded to Chris and not to you.

However it does not change the fact that people here have responded 
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than 
to subscribe to a usenet provider or to a mailing list.  One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts 
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have 
had no complaints about in other places.

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


#61361

Fromrusi <rustompmody@gmail.com>
Date2013-12-08 21:20 -0800
Message-ID<b8285377-6acb-4d5c-81c6-65d9abcc1ffb@googlegroups.com>
In reply to#61358
On Monday, December 9, 2013 10:37:38 AM UTC+5:30, ru...@yahoo.com wrote:
> On 12/08/2013 05:27 PM, Mark Lawrence wrote:
> > On 09/12/2013 00:08,  wrote:
> >> On 12/08/2013 12:17 PM, Chris Angelico wrote:
> >>> On Mon, Dec 9, 2013 at 6:06 AM,  rafaell wrote:
> >[...]
> > To the OP, please ignore the above, it's sheer, unadulterated rubbish. 
> > Nobody has ever been bullied into doing anything.  People have however 
> > been asked repeatedly to either A) use the link referenced above to 
> > avoid sending double spaced crap here from the inferior google groups 
> > product or B) use an alternative technology that doesn't send double 
> > spaced crap.

> Mark, I appreciate your calm and reasonable requests for people
> to checkout the page you gave a link to, that's why I repeated
> your advice.  It is also why I responded to Chris and not to you.

Yes agreed.

> However it does not change the fact that people here have responded 
> in rather extreme way to GG posts including calling GG users "twits"
> and claiming GG posts damage their eyesight, as well as repeatedly
> denying the obvious fact that GG is much easier to use for many than 
> to subscribe to a usenet provider or to a mailing list.  One frequently
> sees words like "crap", "slimy", "rubbish" etc to describe GG posts 
> which is pretty intimating to people who just want some help with a
> python question using a tool they already know how to use and have 
> had no complaints about in other places.

About the last -- no complaints about (that) in other places -- Ive recently
seen that on the html/stylesheets/javascript lists (not sure which)
there are also annoyed complaints about GG.

About the rest -- when people get annoyed they say and do things they
would not otherwise do. The sensible not-yet-annoyed-enough-to-lose-the-head folks should try to cure the annoyance rather than get
annoyed with it -- dont you think?

In short if we are programmers we should be thinking bug-fixes when we
are bugged :-) And what is put up here 
https://wiki.python.org/moin/GoogleGroupsPython
(only yesterday BTW) is a dynamically loadable GG-bugfix.

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


#61439

Fromrurpy@yahoo.com
Date2013-12-09 21:15 -0800
Message-ID<f186f487-ef93-42e7-86c8-5bb9026fdde0@googlegroups.com>
In reply to#61361
On 12/08/2013 10:20 PM, rusi wrote:
> On Monday, December 9, 2013 10:37:38 AM UTC+5:30, ru...@yahoo.com wrote:
>[...]
>> However it does not change the fact that people here have responded 
>> in rather extreme way to GG posts including calling GG users "twits"
>> and claiming GG posts damage their eyesight, as well as repeatedly
>> denying the obvious fact that GG is much easier to use for many than 
>> to subscribe to a usenet provider or to a mailing list.  One frequently
>> sees words like "crap", "slimy", "rubbish" etc to describe GG posts 
>> which is pretty intimating to people who just want some help with a
>> python question using a tool they already know how to use and have 
>> had no complaints about in other places.
> 
> About the last -- no complaints about (that) in other places -- Ive recently
> seen that on the html/stylesheets/javascript lists (not sure which)
> there are also annoyed complaints about GG.

I am sure that there are other usenet groups that get Google 
Groups posts and find them irritating for the same reason 
that some here do.  But usenet is nearly all the way in death's 
door (at least text groups; binaries groups may be still be 
growing.)  The only usenet groups I know of with any vitality 
left at all are ones like the Python list that are backed by an 
active maillist.  (Curiously, it seems to me the dramatic decline
in usenet occurred around 2008-2010, about the same time as
the dramatic rise of social networking sites.)

As for pure mailing lists, I am not sure how many are gatewayed 
to GG -- I subscribe to several because they are not available
through GG -- so they don't get GG posts.  

There are however a large number of mailing lists that are 
hosted solely on GG by various projects.  It is participants 
in these lists that I was thinking of by "other places".  
Such people are likely very surprised by the hostility they 
meet when they simply change to the python list (or one of 
the other usenet-gatewayed groups) which looks very much 
like any another GG group from their perspective.

For all the GG hostility on the python list, many python 
project lists are hosted on GG (Sqlalchemy, Webpy, GvR's 
own Tulip project, etc) 

> About the rest -- when people get annoyed they say and do things they
> would not otherwise do. 

Humans have big cortexes so that they don't need to act out
based on their feelings of the moment -- like a dog humping
the boy next door or trying to bite off the arm of the 
postal delivery person.

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


#61367

FromChris Angelico <rosuav@gmail.com>
Date2013-12-09 18:57 +1100
Message-ID<mailman.3762.1386575861.18130.python-list@python.org>
In reply to#61358
On Mon, Dec 9, 2013 at 4:07 PM,  <rurpy@yahoo.com> wrote:
> However it does not change the fact that people here have responded
> in rather extreme way to GG posts including calling GG users "twits"
> and claiming GG posts damage their eyesight, as well as repeatedly
> denying the obvious fact that GG is much easier to use for many than
> to subscribe to a usenet provider or to a mailing list.  One frequently
> sees words like "crap", "slimy", "rubbish" etc to describe GG posts
> which is pretty intimating to people who just want some help with a
> python question using a tool they already know how to use and have
> had no complaints about in other places.

Please note though that there is a difference between describing the
users as twits and describing the posts as slimy. Suppose you write a
letter (the sort that goes on a slab of dead tree) and, instead of
placing it in an envelope and putting a stamp on it, you hand it to
the Arac News Insertion Device[1] to do the enveloping for you. He
does a reasonable job of it, but he uses cobwebs instead of paper for
the envelope. Sure, it's still readable... but your readers now have
to rub off a whole lot of cobwebs before they can read what you said.
That makes your post distasteful, without it being at all your fault -
other than choosing to use Arac's service. That's how I see Google
Groups posts. Someone's gone looking for help about Python and has
found that. It's not their fault that they don't know about
alternatives; so I point out the alternatives.

ChrisA

[1] http://math.boisestate.edu/gas/princess_ida/webop/pi_04.html
On the whole we are
Not intelligent...

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


Page 1 of 2  [1] 2  Next page →

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


csiph-web