Re: Immediate Requirement: use the Python Job Board for recruitment (was:

2016-04-27 Thread Steven D'Aprano
On Wednesday 27 April 2016 16:36, Bob Martin wrote: > Recruiters post everywhere but seem not to read anywhere. > They have flooded the android developer lists to the point where > they are no longer worth reading. Wanted: Android developer. Must have five years experience with "Marshmellow" or

Re: how to create a dictionary from csv file?

2016-04-27 Thread Sibylle Koczian
Am 27.04.2016 um 04:42 schrieb jf...@ms4.hinet.net: Just curious:-) why everyone here open the csv file without using newline='' as suggested in Python 3.4.4 document section 14.1? And if the csv module is used anyway, why not simply read into a DictReader? -- https://mail.python.org/mailman

Basic Concepts

2016-04-27 Thread Smith
Fill in the blanks to declare a variable, add 5 to it and print its value: >>> x = 4 >>> x_ = 5 >>> print_ Any suggestion ? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: how to create a dictionary from csv file?

2016-04-27 Thread Peter Otten
Sibylle Koczian wrote: > Am 27.04.2016 um 04:42 schrieb jf...@ms4.hinet.net: >> Just curious:-) why everyone here open the csv file without using >> newline='' as suggested in Python 3.4.4 document section 14.1? Carelessness, lack of knowledge (I plead guilty), not on Windows and no embedded new

RE: Basic Concepts

2016-04-27 Thread Joaquin Alzola
>>> x = 4 >>> x + 5 9 -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of Smith Sent: 27 April 2016 10:29 To: python-list@python.org Subject: Basic Concepts Fill in the blanks to declare a variable, add 5 to it and print it

newsreader pan could not find my post

2016-04-27 Thread ldompeling
Hello, I post a message in comp.lang python, but with caching new articles in the newsreader pan I don't see my article. How can I contact the administrater or this group. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Basic Concepts

2016-04-27 Thread alister
On Wed, 27 Apr 2016 11:29:12 +0200, Smith wrote: > Fill in the blanks to declare a variable, add 5 to it and print its > value: > > >>> x = 4 x_ = 5 print_ > > > Any suggestion ? > > Thanks 2 suggestions:- 1) Stay awake during your class so that you can complete basic homework assignments.

Python(x,y) 64 bit

2016-04-27 Thread Pierre
Hello, I installed Python(x,y) 64 bit version and ran it using a library that requires Python 64 bit. I got an error which indicated that I am using Python 32 bit. So, is the python used by Python(x,y) 64 bit, using Python 64 or 32 bit? Thanks -- https://mail.python.org/mailman/listinfo/py

Re: Basic Concepts

2016-04-27 Thread Steven D'Aprano
On Wed, 27 Apr 2016 07:29 pm, Smith wrote: > Fill in the blanks to declare a variable, add 5 to it and print its value: > > >>> x = 4 > >>> x_ = 5 > >>> print_ > > > Any suggestion ? Okay, you have a variable x with the value of 4: x = 4 How do you think you would print the value of x?

Re: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-27 Thread Adam Davis
On Wednesday, 27 April 2016 07:37:42 UTC+1, Chris Angelico wrote: > On Wed, Apr 27, 2016 at 4:26 PM, Adam Davis wrote: > > I understand what you're saying! But where you say: " the_set = set()", > > what would go within the set brackets? > > Nothing. The empty parentheses mean "call this with n

Re: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-27 Thread Andrew Ongko
On Apr 27, 2016 7:25 PM, "Adam Davis" wrote: > > On Wednesday, 27 April 2016 07:37:42 UTC+1, Chris Angelico wrote: > > On Wed, Apr 27, 2016 at 4:26 PM, Adam Davis wrote: > > > I understand what you're saying! But where you say: " the_set = set()", what would go within the set brackets? > > > > N

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Ian Kelly
On Tue, Apr 26, 2016 at 11:31 PM, Ethan Furman wrote: > On 04/26/2016 08:43 PM, Christopher Reimer wrote: > >> If I'm using a dictionary to store variables for an object, and >> accessing the variable values from dictionary via property decorators, >> would it be better to derive the class from ob

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Ian Kelly
On Tue, Apr 26, 2016 at 9:43 PM, Christopher Reimer wrote: > class Test2(dict): > def __init__(self): > self.__dict__ = {'key', 'value'} This class definition looks muddled. Because Test2 inherits from dict, the object referred to by "self" will be a dict, and self.__d

Re: Python(x,y) 64 bit

2016-04-27 Thread Zachary Ware
Hi Pierre, On Wed, Apr 27, 2016 at 6:23 AM, Pierre wrote: > Hello, > > I installed Python(x,y) 64 bit version and ran it using a library that > requires Python 64 bit. > I got an error which indicated that I am using Python 32 bit. > > So, is the python used by Python(x,y) 64 bit, using Python 6

urgent requirement DB2 with AIX or LINUX@ Foster City,CA

2016-04-27 Thread durganaveen . usit
This is Naveen from SAGE IT INC. Hope you are doing great. Please send me your updated resume if you're interested for this position Title: DB2 with AIX or LINUX Location: Foster City, CA Duration: 12+ Months Job Description Strong DB2 LUW V10 (AIX/LINUX) expertise combined with sharp concep

Re: how to create a dictionary from csv file?

2016-04-27 Thread Sibylle Koczian
Am 27.04.2016 um 11:31 schrieb Peter Otten: Sibylle Koczian wrote: And if the csv module is used anyway, why not simply read into a DictReader? How would that help with looking up 3.5 by "apple" given the OP's sample data banana,4.0 apple,3.5 orange,3.0 Quite right, it wouldn't. Misread t

Re: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-27 Thread darnold via Python-list
potential_passengers = ['bob','john','sue','wendy','chris','bob','jen','wendy'] accepted_passengers = set() for name in potential_passengers: print('checking on {}...'.format(name)) if name not in accepted_passengers: accepted_passengers.add(name) print('welcome aboard, {}

Importerror: cannot import name httpshandler linux

2016-04-27 Thread bharadwajsrivatsa
I tried installing Python 2.7.11 on HP-UX which already has all the build and run time dependencies installed on it such as openssl, libffi, etc. But after installing python , I tried installing some open source packages using pip. But pip thows the error: Importerror: cannot import name httpsha

Re: Importerror: cannot import name httpshandler linux

2016-04-27 Thread Wildman via Python-list
On Wed, 27 Apr 2016 10:13:45 -0700, bharadwajsrivatsa wrote: > I tried installing Python 2.7.11 on HP-UX which already has all > the build and run time dependencies installed on it such as > openssl, libffi, etc. But after installing python , I tried > installing some open source packages using pi

Re: Python(x,y) 64 bit

2016-04-27 Thread Pierre
On Wednesday, April 27, 2016 at 11:17:32 AM UTC-4, Zachary Ware wrote: > Hi Pierre, > > On Wed, Apr 27, 2016 at 6:23 AM, Pierre wrote: > > Hello, > > > > I installed Python(x,y) 64 bit version and ran it using a library that > > requires Python 64 bit. > > I got an error which indicated that I a

Re: Python(x,y) 64 bit

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 04:25 PM, Pierre wrote: > I did check and it looks like the Python(x,y) 64 distribution I > downloaded uses a 32 bit Python. > The question is if there is ANY Python(x,y) 64 distribution that uses the > 64 bit python version. > I looked it up online and could not find anyth

Re: Python path and append

2016-04-27 Thread Stephen Hansen
On Tue, Apr 26, 2016, at 07:56 PM, Seymore4Head wrote: > On Tue, 26 Apr 2016 11:53:57 +1000, Steven D'Aprano > wrote: > > >On Tue, 26 Apr 2016 08:04 am, Seymore4Head wrote: > > > >> BTW I was trying to use a line like yours that used an output file > >> that didn't exist and was getting an error.

Big World, Big Data, Big Mind : Spark | Scala | Python

2016-04-27 Thread Apporva Jain
Become proficient in both Scala and python to implement programming skills on Apache spark and have independent understanding of all three platforms Objectives: Understand the difference between Apache Spark and Hadoop Learn Scala and its programming implementation Implement Spark on a cluster W

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/26/2016 8:56 PM, Random832 wrote: what exactly do you mean by property decorators? If you're just accessing them in a dictionary what's the benefit over having the values be simple attributes rather than properties? After considering the feedback I got for sanity checking my code, I've d

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:24 AM, Ian Kelly wrote: Some other great questions to ask yourself are "do I really want len(my_object) to return the number of items in this dict" and "do I really want list(my_object) to return all the keys in this dict"? If the answer to all those is yes, then it's probably fa

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:33 AM, Ian Kelly wrote: This class definition looks muddled. Because Test2 inherits from dict, the object referred to by "self" will be a dict, and self.__dict__ is actually a *different* dict, containing the attributes of self. The line: self.__dict__ = {'key', 'value'} is

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Michael Torrie
On 04/27/2016 07:12 PM, Christopher Reimer wrote: > class Piece(object): > def __init__(self, color, position, state=None): > if state is None: > self._state = { > 'class': self.__class__.__name__, > 'color': color, > 'fi

Pythonic style (was: Differences between Class(Object) and Class(Dict) for dictionary usage?)

2016-04-27 Thread Ben Finney
Christopher Reimer writes: > On 4/27/2016 7:33 AM, Ian Kelly wrote: > > > self.__dict__ = {'key', 'value'} > > > > self.key = value > > Which expression is Pythonic? (Note that assignment is not an expression in Python; assigment is a statement.) > I've seen both used in various examp

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer via Python-list
On 4/26/2016 8:56 PM, Random832 wrote: what exactly do you mean by property decorators? If you're just accessing them in a dictionary what's the benefit over having the values be simple attributes rather than properties? After considering the feedback I got for sanity checking my code, I've d

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:00 PM, Michael Torrie wrote: I am guessing that the reason you are storing state as it's own dictionary is so that you can pass the state itself to the constructor? Someone said it was bad to store the object itself to file (my original plan) and that I should use a dictionary

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Ethan Furman
On 04/27/2016 06:12 PM, Christopher Reimer wrote: After considering the feedback I got for sanity checking my code, I've decided to simplify the base class for the chess pieces (see code below). All the variables are stored inside a dictionary with most values accessible through properties. A cu

Re: Pythonic style (was: Differences between Class(Object) and Class(Dict) for dictionary usage?)

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:07 PM, Ben Finney wrote: I would say the latter is more Pythonic, because it: * Better conveys the intention (“set the value of the ‘self.key’ attribute”). * Uses the built-in mechanisms of Python (don't invoke magic attributes, instead use the system that makes use of them

Re: Pythonic style

2016-04-27 Thread Ben Finney
Christopher Reimer writes: > In short, my original code before I turned it into a separate > dictionary. *sigh* No, I think that misses the points that were being made. The discussion you're talking about was *not* to say “attribute access is better than dictionary access”, or vice versa. Each

Re: Pythonic style

2016-04-27 Thread Ethan Furman
On 04/27/2016 08:07 PM, Christopher Reimer wrote: On 4/27/2016 7:07 PM, Ben Finney wrote: >> Ian Kelly wrote: self.__dict__ = {'key', 'value'} is essentially equivalent to: self.key = value >> I would say the latter is more Pythonic, because it: >> >> [snip] >> * Uses the built

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Michael Torrie
On 04/27/2016 08:49 PM, Christopher Reimer wrote: > On 4/27/2016 7:00 PM, Michael Torrie wrote: >> I am guessing that the reason you are storing state as it's own >> dictionary is so that you can pass the state itself to the constructor? > > Someone said it was bad to store the object itself to

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:05 PM, Ethan Furman wrote: I ripped out the fetch_state because that will take more work -- you can't pass a Pawn's saved state in to Piece and get the results you want. pickle is worth looking at for saving/restoring. The original idea was to pass a Pawn dictionary to the cons

Re: Pythonic style

2016-04-27 Thread Chris Angelico
On Thu, Apr 28, 2016 at 1:52 PM, Ethan Furman wrote: > > The point Ben was trying to make is this: you should never* call __dunder__ > methods in normal code; there is no need to do so: > > - use len(), not __len__() > - use next(), not __next__() > - use some_instance.an_attribute, not some_inst

Re: Pythonic style

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:23 PM, Ben Finney wrote: If you want items in a mapping, explicitly use a Python ‘dict’ instance. If you want attributes that describe an object, explicitly use attributes of that object. Deliberately choose which one makes more sense. Okay, that makes sense. Thank you, Chris R

Re: Pythonic style

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:52 PM, Ethan Furman wrote: The point Ben was trying to make is this: you should never* call __dunder__ methods in normal code; there is no need to do so: - use len(), not __len__() - use next(), not __next__() - use some_instance.an_attribute, not some_instance.__dict__['an_a

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:52 PM, Michael Torrie wrote: In fact if it were me I would save game state to some kind of ini file, which would mean manually going through each object and writing out the relevant data to the ini file using the right syntax. And then reverse the process when restoring from a fi

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Michael Torrie
On 04/27/2016 10:06 PM, Christopher Reimer wrote: > On 4/27/2016 8:52 PM, Michael Torrie wrote: >> In fact if it were me I would save game state to some kind of ini file, >> which would mean manually going through each object and writing out the >> relevant data to the ini file using the right sy

Python Madlibs.py code and error message

2016-04-27 Thread Cai Gengyang
Python Madlibs.py code and error message --- Anyone can help? I keep getting stuck here ... # This program does the following ... writes a Mad Libs story # Author: Cai Gengyang print "Mad Libs is starting!" name = raw_input("Enter a name: ") adjective1 = raw_input("Enter an adjective: ")

Re: Python Madlibs.py code and error message

2016-04-27 Thread Gregory Ewing
Cai Gengyang wrote: adjective1 = raw_input("Enter an adjective: ") NameError: name 'Adjective1' is not defined Python is case-sensitive. You've spelled it "adjective1" in one place and "Adjective1" in another. You need to be consistent. -- Greg -- https://mail.python.org/mailman/listinfo/pyt

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 09:37 PM, Cai Gengyang wrote: > print STORY % (Adjective1, name, Verb1, Adjective2, Noun1, Noun2, animal, > food, Verb2, Noun3, fruit, Adjective3, name, Verb3, number, name , > superhero_name, superhero_name, name, country, name, dessert, name, year, > Noun4) Python is cas

Re: Python Madlibs.py code and error message

2016-04-27 Thread Cai Gengyang
I changed it to all lowercase, this time I get a different error message though (a TypeError message) # This program does the following ... writes a Mad Libs story # Author: Cai Gengyang print "Mad Libs is starting!" name = raw_input("Enter a name: ") adjective1 = raw_input("Enter an ad

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 10:01 PM, Cai Gengyang wrote: > I changed it to all lowercase, this time I get a different error message > though (a TypeError message) The error message means there's a mismatch between the number of formatting instructions (ie, %s) and arguments passed to formatting. I

Re: Pythonic style

2016-04-27 Thread Rustom Mody
On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote: > My rule of thumb is: Dunders are for defining, not for calling. It's > not a hard-and-fast rule, but it'll get you through 99%+ of > situations. Neat and clever. Should get in the docs somewhere -- https://mail.python.org

Re: Python Madlibs.py code and error message

2016-04-27 Thread Ben Finney
Stephen Hansen writes: > The error message means there's a mismatch between the number of > formatting instructions (ie, %s) and arguments passed to formatting. I > leave it to you to count and find what's missing or extra, because I'm > seriously not going to do that :) Better: when you have ma

Re: Pythonic style

2016-04-27 Thread Steven D'Aprano
On Thursday 28 April 2016 13:23, Ben Finney wrote: > Christopher Reimer writes: > >> In short, my original code before I turned it into a separate >> dictionary. *sigh* > > No, I think that misses the points that were being made. The discussion > you're talking about was *not* to say “attribut

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Ethan Furman
On 04/27/2016 09:06 PM, Christopher Reimer wrote: On 4/27/2016 8:52 PM, Michael Torrie wrote: In fact if it were me I would save game state to some kind of ini file, which would mean manually going through each object and writing out the relevant data to the ini file using the right syntax.

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > Stephen Hansen writes: > > > The error message means there's a mismatch between the number of > > formatting instructions (ie, %s) and arguments passed to formatting. I > > leave it to you to count and find what's missing or extra, because I'

Re: Python Madlibs.py code and error message

2016-04-27 Thread Ben Finney
Stephen Hansen writes: > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > > Better: when you have many semantically-different values, use named > > (not positional) parameters in the format string. […] > > > > https://docs.python.org/3/library/string.html#formatstrings> > > Except the