Re: python programming help

2013-12-08 Thread Chris Angelico
On Mon, Dec 9, 2013 at 4:07 PM, 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 easie

Re: interactive help on the base object

2013-12-08 Thread Alan Bawden
Steven D'Aprano writes: > - If all classes are part of a single hierarchy, it must logically end at > one (or more, if you support multiple inheritance, which Python does) > bases classes. (Unless there are loops, which are generally prohibited in > all OOP systems I know of). The simplest way

Re: interactive help on the base object

2013-12-08 Thread rusi
On Monday, December 9, 2013 10:56:28 AM UTC+5:30, ru...@yahoo.com wrote: > On 12/08/2013 09:46 PM, rusi wrote: > > On Monday, December 9, 2013 9:46:30 AM UTC+5:30, Steven D'Aprano wrote: > >> On Sun, 08 Dec 2013 18:58:09 -0800, rusi wrote: > >[...] > >> Does GG not give you some way of inspecting t

Re: interactive help on the base object

2013-12-08 Thread Steven D'Aprano
On Sun, 08 Dec 2013 18:41:47 -0800, Mark Janssen wrote: >>> What methods, if any does it provide? Are they all abstract? etc??? >> >> Pretty much nothing useful :-) >> >> py> dir(object) >> [...] >> >> > So (prodding the student), Why does everything inherit from Object if it > provides no functi

Re: interactive help on the base object

2013-12-08 Thread rurpy
On 12/08/2013 09:46 PM, rusi wrote: > On Monday, December 9, 2013 9:46:30 AM UTC+5:30, Steven D'Aprano wrote: >> On Sun, 08 Dec 2013 18:58:09 -0800, rusi wrote: >[...] >> Does GG not give you some way of inspecting the post's full headers? > > Well I spent half hour looking around -- both inside G

Re: python programming help

2013-12-08 Thread rusi
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

Re: python programming help

2013-12-08 Thread Joel Goldstick
"why can't we all just get along?" Rodney King, RIP -- https://mail.python.org/mailman/listinfo/python-list

Re: python programming help

2013-12-08 Thread rurpy
On 12/08/2013 08:05 PM, Chris Angelico wrote: > On Mon, Dec 9, 2013 at 11:08 AM, wrote: >> 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. > > Neith

Re: interactive help on the base object

2013-12-08 Thread Steven D'Aprano
On Sun, 08 Dec 2013 15:01:59 -0800, Mark Janssen wrote: > On Sun, Dec 8, 2013 at 2:33 AM, Steven D'Aprano > wrote: >> On Sat, 07 Dec 2013 20:21:06 -0800, Mark Janssen wrote: >> >> Is it just me, or is this basically useless? >> >> class object >> | The most *base* type > >>>

Re: python programming help

2013-12-08 Thread rurpy
On 12/08/2013 05:27 PM, Mark Lawrence wrote: > On 09/12/2013 00:08, ru...@yahoo.com wrote: >> On 12/08/2013 12:17 PM, Chris Angelico wrote: >>> On Mon, Dec 9, 2013 at 6:06 AM, wrote:>[...] >[...] > To the OP, please ignore the above, it's sheer, unadulterated rubbish. > Nobody has ever been bull

Re: interactive help on the base object

2013-12-08 Thread Terry Reedy
On 12/8/2013 8:43 PM, Mark Lawrence wrote: On 09/12/2013 00:45, Denis McMahon wrote: On Sun, 08 Dec 2013 23:48:57 +, Mark Lawrence wrote: >>> help(object) Help on class object in module builtins: class object | The most base type '''The default top superclass for all Python clas

Re: interactive help on the base object

2013-12-08 Thread rusi
Thanks for the info. On Monday, December 9, 2013 9:46:30 AM UTC+5:30, Steven D'Aprano wrote: > On Sun, 08 Dec 2013 18:58:09 -0800, rusi wrote: > > PS Can some kind soul inform me whether I could convince GG to unicode > > my post? > Does GG not give you some way of inspecting the post's full hea

Re: interactive help on the base object

2013-12-08 Thread Steven D'Aprano
On Sun, 08 Dec 2013 18:58:09 -0800, rusi wrote: > PS Can some kind soul inform me whether I could convince GG to unicode > my post? Does GG not give you some way of inspecting the post's full headers? Anyway, here you go: Content-Type: text/plain; charset=UTF-8 Your plan succeeded. Personal

Re: interactive help on the base object

2013-12-08 Thread Chris Angelico
On Mon, Dec 9, 2013 at 2:05 PM, Mark Janssen wrote: > But, in any case, if you don't have a way to map your abstract objects > into machine types, you're working on magic, not computer science. Maybe, but that mapping isn't always an inheritance relationship. Ultimately the computer can't work wi

Re: interactive help on the base object

2013-12-08 Thread Mark Janssen
On Sun, Dec 8, 2013 at 6:44 PM, Chris Angelico wrote: > On Mon, Dec 9, 2013 at 10:01 AM, Mark Janssen > wrote: >> (Note bene: as a comparison, C++ is very UNAMBIGUOUS about >> this fact -- all objects inherit from concrete machine types, which is >> why it remains important, *despite* being one

Re: python programming help

2013-12-08 Thread Chris Angelico
On Mon, Dec 9, 2013 at 11:08 AM, wrote: > 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. Neither. I don't at all hate Google (I quite like the company

Re: ASCII and Unicode

2013-12-08 Thread rusi
On Monday, December 9, 2013 1:41:41 AM UTC+5:30, giacomo boffi wrote: > the wrong one... i.e, the one JUST BEFORE your change of > subject --- if i look at the "ellipsis" post, i see the same encoding > that you have mentioned > sorry for the confusion And thank you for pointing the way to the c

Re: interactive help on the base object

2013-12-08 Thread rusi
On Monday, December 9, 2013 8:11:47 AM UTC+5:30, zipher wrote: > >> What methods, if any does it provide? Are they all abstract? etc??? > > Pretty much nothing useful :-) > > py> dir(object) > > [...] > So (prodding the student), Why does everything inherit from Object if > it provides no functio

Re: interactive help on the base object

2013-12-08 Thread Chris Angelico
On Mon, Dec 9, 2013 at 1:41 PM, Mark Janssen wrote: >>> What methods, if any does it provide? Are they all abstract? etc??? >> >> Pretty much nothing useful :-) >> >> py> dir(object) >> [...] >> > > So (prodding the student), Why does everything inherit from Object if > it provides no functionali

Re: interactive help on the base object

2013-12-08 Thread Chris Angelico
On Mon, Dec 9, 2013 at 10:01 AM, Mark Janssen wrote: > (Note bene: as a comparison, C++ is very UNAMBIGUOUS about > this fact -- all objects inherit from concrete machine types, which is > why it remains important, *despite* being one of the worst to do OOP > in. Its *type model* is probably the

Re: interactive help on the base object

2013-12-08 Thread Mark Janssen
>> What methods, if any does it provide? Are they all abstract? etc??? > > Pretty much nothing useful :-) > > py> dir(object) > [...] > So (prodding the student), Why does everything inherit from Object if it provides no functionality? Practicality-beats-purity-yours? -- MarkJ Tacoma, Washingt

Re: interactive help on the base object

2013-12-08 Thread Steven D'Aprano
On Mon, 09 Dec 2013 01:43:43 +, Mark Lawrence wrote about object: > What methods, if any does it provide? Are they all abstract? etc??? Pretty much nothing useful :-) py> dir(object) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '

Re: python programming help

2013-12-08 Thread YBM
Le 08.12.2013 19:32, rafaella...@gmail.com a écrit : On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote: On 12/8/2013 12:59 PM, rafaella...@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 o

Re: python programming help

2013-12-08 Thread YBM
Le 08.12.2013 20:06, rafaella...@gmail.com a écrit : 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) No it doesn't. You are printing things not returning something. and combine_list is the mos

Re: interactive help on the base object

2013-12-08 Thread Steven D'Aprano
On Sun, 08 Dec 2013 23:48:57 +, Mark Lawrence wrote: > Terry's suggestion above remains odds on favourite on the grounds that > there have been no other suggestions. I'll give it another day, then > raise a tracker issue, It's not merely the default superclass, it *is* the superclass to e

Re: python programming help

2013-12-08 Thread YBM
Le 09.12.2013 01:00, Gregory Ewing a écrit : rafaella...@gmail.com wrote: def people(age): people=lambda age: [name for name in dic if dic[name]==age] but i don't get the lambda age part. Just to explain: YBM has tried to sabotage you by posting a solution that uses a couple of advanced

Re: interactive help on the base object

2013-12-08 Thread Mark Lawrence
On 09/12/2013 00:45, Denis McMahon wrote: On Sun, 08 Dec 2013 23:48:57 +, Mark Lawrence wrote: >>> help(object) Help on class object in module builtins: class object | The most base type '''The default top superclass for all Python classes. Its methods are inherited by all classe

Re: interactive help on the base object

2013-12-08 Thread Mark Lawrence
On 09/12/2013 01:09, Mark Janssen wrote: >>> help(object) Help on class object in module builtins: class object | The most base type '''The default top superclass for all Python classes. Its methods are inherited by all classes unless overriden. ''' """ The root class for all Python c

Re: interactive help on the base object

2013-12-08 Thread Mark Janssen
>>> help(object) Help on class object in module builtins: class object | The most base type > >>> '''The default top superclass for all Python classes. >>> Its methods are inherited by all classes unless overriden. >>> ''' > > """ The root class for all Python classes.

Re: interactive help on the base object

2013-12-08 Thread Denis McMahon
On Sun, 08 Dec 2013 23:48:57 +, Mark Lawrence wrote: >>> >>> help(object) >>> Help on class object in module builtins: >>> >>> class object >>> | The most base type >> '''The default top superclass for all Python classes. >> Its methods are inherited by all classes unless overriden. >>

Re: python programming help

2013-12-08 Thread Mark Lawrence
On 09/12/2013 00:08, ru...@yahoo.com wrote: On 12/08/2013 12:17 PM, Chris Angelico wrote: On Mon, Dec 9, 2013 at 6:06 AM, 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 p

Re: python programming help

2013-12-08 Thread rurpy
On 12/08/2013 12:17 PM, Chris Angelico wrote: > On Mon, Dec 9, 2013 at 6:06 AM, 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 a

Re: python programming help

2013-12-08 Thread Gregory Ewing
rafaella...@gmail.com wrote: def people(age): people=lambda age: [name for name in dic if dic[name]==age] but i don't get the lambda age part. Just to explain: YBM has tried to sabotage you by posting a solution that uses a couple of advanced Python features (lambda and list comprehension

Re: interactive help on the base object

2013-12-08 Thread Mark Lawrence
On 07/12/2013 01:35, Terry Reedy wrote: On 12/6/2013 12:03 PM, Mark Lawrence wrote: Is it just me, or is this basically useless? >>> help(object) Help on class object in module builtins: class object | The most base type Given that this can be interpreted as 'least desirable', it could d

Re: interactive help on the base object

2013-12-08 Thread Gregory Ewing
Mark Janssen wrote: Mr. Ewing says "base" has to be interpreted as an *adjective* because otherwise it would mean the BOTTOM (like the BASE of the pyramid), Not exactly -- a native English speaker would say something like "the bottommost class" if that's what they meant. Or they would say "the

Re: interactive help on the base object

2013-12-08 Thread Mark Janssen
On Sun, Dec 8, 2013 at 2:33 AM, Steven D'Aprano wrote: > On Sat, 07 Dec 2013 20:21:06 -0800, Mark Janssen wrote: > > Is it just me, or is this basically useless? > > class object > | The most *base* type >> [[Terry Reedy:]] >>> How about something like. >>> The default top *

Re: Fwd: Eliminate "extra" variable

2013-12-08 Thread Dave Angel
On Sun, 8 Dec 2013 12:58:18 -0800, Igor Korot wrote: It's input is the query result, so there is no looping when the function is called. It is called only once. Then why save part of the result in an instance attribute? Just return all of the results as a tuple. -- DaveA -- https://mail.py

Re: Eliminate "extra" variable

2013-12-08 Thread Tim Chase
On 2013-12-08 12:58, Igor Korot wrote: > Also, the data comes from either SQLite or mySQL and so to eliminate > the difference between those engines dates are processed as strings > and converted to dates for the calculation purposes only. > Maybe I will need to refactor SQLite processing to get th

Fwd: Eliminate "extra" variable

2013-12-08 Thread Igor Korot
-- Forwarded message -- From: Igor Korot Date: Sun, Dec 8, 2013 at 12:57 PM Subject: Re: Eliminate "extra" variable To: Roy Smith Hi, guys, Thank you for all those valuable suggestions. 2Tim Chase: I guess you missed this: "My originalData comes from the database query" and so t

Re: django - adding a button with parallel functionality

2013-12-08 Thread Roy Smith
In article , chip9m...@gmail.com wrote: > Hi all! I'll try to be clear and brief. > > I have created a django project some months ago. It is an online survey. > Now I want to add a button that when pressed adds something to a database, > but does not change any existing functionalities. > > B

Re: python programming help

2013-12-08 Thread Terry Reedy
On 12/8/2013 2:06 PM, rafaella...@gmail.com wrote: Even when you do get what lambda means and how use it, name = lambda args: expression which is a carryover from other languages, is inferior to def name(args): return expression because the function object resulting from lambda does not have

django - adding a button with parallel functionality

2013-12-08 Thread chip9munk
Hi all! I'll try to be clear and brief. I have created a django project some months ago. It is an online survey. Now I want to add a button that when pressed adds something to a database, but does not change any existing functionalities. Brief explanation: button will always be present at the p

Re: ASCII and Unicode

2013-12-08 Thread giacomo boffi
Steven D'Aprano writes: > On Sat, 07 Dec 2013 17:05:34 +0100, giacomo boffi wrote: > >> Steven D'Aprano writes: >> >>> Ironically, your post was not Unicode. [...] Your post was sent using >>> a legacy encoding, Windows-1252, also known as CP-1252 >> >> i access rusi's post using a NNTP serve

Re: Eliminate "extra" variable

2013-12-08 Thread Roy Smith
In article , Mark Lawrence wrote: > On 08/12/2013 18:58, Tim Chase wrote: > > On 2013-12-07 23:14, Igor Korot wrote: > > [big snip] > > > > > Whenever I need date manipulations I always reach out to this > http://labix.org/python-dateutil The problem with dateutil is it's dog slow. Sure, I

Domino, a Python PaaS for data science

2013-12-08 Thread vasudevram
Hi list, This may be of interest: Domino, a Python PaaS for data science: http://jugad2.blogspot.in/2013/12/domino-paas-for-data-science.html - Vasudev Ram Software training and consulting Python, Linux, C, open source, databases ... www.dancingbison.com jugad2.blogspot.com -- https://mail.pyt

Re: Eliminate "extra" variable

2013-12-08 Thread Mark Lawrence
On 08/12/2013 19:23, Tim Chase wrote: On 2013-12-08 19:10, Mark Lawrence wrote: On 08/12/2013 18:58, Tim Chase wrote: On 2013-12-07 23:14, Igor Korot wrote: [big snip] Whenever I need date manipulations I always reach out to this http://labix.org/python-dateutil But based on the OP's repea

Re: python programming help

2013-12-08 Thread John Ladasky
On Sunday, December 8, 2013 10:32:31 AM UTC-8, rafae...@gmail.com wrote: [snip] > def people(age): > people=lambda age: [name for name in dic if dic[name]==age] > > people(20) [snip] > this is the code i have so far(with the help of the first post ;p). i > understand how a function and a d

Re: Eliminate "extra" variable

2013-12-08 Thread Tim Chase
On 2013-12-08 19:10, Mark Lawrence wrote: > On 08/12/2013 18:58, Tim Chase wrote: > > On 2013-12-07 23:14, Igor Korot wrote: > > [big snip] > > Whenever I need date manipulations I always reach out to this > http://labix.org/python-dateutil But based on the OP's repeated transformations from

Re: python programming help

2013-12-08 Thread Mark Lawrence
On 08/12/2013 19:06, rafaella...@gmail.com wrote: 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 li

Re: python programming help

2013-12-08 Thread Chris Angelico
On Mon, Dec 9, 2013 at 6:06 AM, 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 > print 'Dan' in people(18) and 'Cathy' in people(18) > TypeError: argument of type 'NoneType' is n

Re: Eliminate "extra" variable

2013-12-08 Thread Mark Lawrence
On 08/12/2013 18:58, Tim Chase wrote: On 2013-12-07 23:14, Igor Korot wrote: [big snip] Whenever I need date manipulations I always reach out to this http://labix.org/python-dateutil -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our languag

Re: python programming help

2013-12-08 Thread rafaellasav
On Sunday, December 8, 2013 6:52:12 PM UTC, Benjamin Kaplan wrote: > On Sun, Dec 8, 2013 at 10:32 AM, wrote: > > > > > > On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote: > > > > On 12/8/2013 12:59 PM, rafaella...@gmail.com wrote: > > > > > > > > > i have a dictionary with names a

Re: python programming help

2013-12-08 Thread Benjamin Kaplan
On Sun, Dec 8, 2013 at 10:32 AM, wrote: > > On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote: > > On 12/8/2013 12:59 PM, rafaella...@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

Re: Eliminate "extra" variable

2013-12-08 Thread Tim Chase
On 2013-12-07 23:14, Igor Korot wrote: > def MyFunc(self, originalData): > self.dates = [] > data = {} > dateStrs = [] > for i in xrange(0, len(originalData)): > dateStr, freq, source = originalData[i] > data[str(dateStr)] = {source: freq} >

Re: Eliminate "extra" variable

2013-12-08 Thread Tim Chase
On 2013-12-08 15:04, Peter Otten wrote: > > data = dict( > > (str(date), {source: freq}) > > for date, freq, source in original_data > > ) > > or even just > > data = {str(date): {source: freq} > for date, freq, source in original_data} I maintain enough pre-2.7 c

Re: python programming help

2013-12-08 Thread rafaellasav
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, rafaella...@gmail.com wrote: > > > > > > > i have a dictionary with names and ages for each name. I want to write a > > > function

Re: python programming help

2013-12-08 Thread rafaellasav
On Sunday, December 8, 2013 6:27:34 PM UTC, bob gailer wrote: > On 12/8/2013 12:59 PM, rafaella...@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. > >

Re: python programming help

2013-12-08 Thread Mark Lawrence
On 08/12/2013 18:14, rafaella...@gmail.com wrote: On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote: Le 08.12.2013 18:59, rafaella...@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

Re: python programming help

2013-12-08 Thread Gary Herron
On 12/08/2013 09:59 AM, rafaella...@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

Re: python programming help

2013-12-08 Thread bob gailer
On 12/8/2013 12:59 PM, rafaella...@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 we

Re: python programming help

2013-12-08 Thread Roy Smith
In article <264c1144-5d04-4ad0-aa32-f4e6770d2...@googlegroups.com>, rafaella...@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

Re: python programming help

2013-12-08 Thread YBM
Le 08.12.2013 19:14, rafaella...@gmail.com a écrit : On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote: Le 08.12.2013 18:59, rafaella...@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

Re: python programming help

2013-12-08 Thread rafaellasav
On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote: > Le 08.12.2013 18:59, rafaella...@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. > >

Re: python programming help

2013-12-08 Thread YBM
Le 08.12.2013 18:59, rafaella...@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

python programming help

2013-12-08 Thread rafaellasav
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 -- https://mail.python.org/mailman/listinfo/python-list

Re: ASCII and Unicode

2013-12-08 Thread rusi
On Sunday, December 8, 2013 10:52:34 PM UTC+5:30, Steven D'Aprano wrote: > On Sat, 07 Dec 2013 17:05:34 +0100, giacomo boffi wrote: > > Steven D'Aprano writes: > >> Ironically, your post was not Unicode. [...] Your post was sent using > >> a legacy encoding, Windows-1252, also known as CP-1252 >

Re: ASCII and Unicode

2013-12-08 Thread Steven D'Aprano
On Sat, 07 Dec 2013 17:05:34 +0100, giacomo boffi wrote: > Steven D'Aprano writes: > >> Ironically, your post was not Unicode. [...] Your post was sent using >> a legacy encoding, Windows-1252, also known as CP-1252 > > i access rusi's post using a NNTP server, and in his post i see > > Conte

Re: ASCII and Unicode

2013-12-08 Thread rusi
On Saturday, December 7, 2013 9:35:34 PM UTC+5:30, giacomo boffi wrote: > Steven D'Aprano writes: > > Ironically, your post was not Unicode. [...] Your post was sent > > using a legacy encoding, Windows-1252, also known as CP-1252 > i access rusi's post using a NNTP server, > and in his post i

Re: Origin of eval()-ing in separate namespace object

2013-12-08 Thread rusi
On Sunday, December 8, 2013 8:09:39 PM UTC+5:30, Jussi Piitulainen wrote: > rusi writes: > > On Sunday, December 8, 2013 4:05:54 PM UTC+5:30, Kalinni Gorzkis wrote: > > > By which languages(s) Python was inspired to support evaluating > > > expressions and executing statements in a separate "names

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Jean Dubois
Op zondag 8 december 2013 15:16:25 UTC+1 schreef Dave Angel: > On Sat, 7 Dec 2013 23:45:06 -0800 (PST), Jean Dubois > > wrote: > > > This is what I get: > > > Traceback (most recent call last): > > > File "./feet2meters.py", line 2, in > > > from tkinter import * > > > File "/home/

Re: Centring text in a rect in PyGame?

2013-12-08 Thread Tim Golden
On 07/12/2013 12:41, Eamonn Rea wrote: Anyway, I have a problem. In my game, I want to draw a button. I’ve gotten the button to draw fine, but I want some text on the button. I’ve gotten the text to draw, but I can’t get it to centre into the button. Here’s the code I’ve used: *self.surface.blit

Re: Centring text in a rect in PyGame?

2013-12-08 Thread rusi
On Sunday, December 8, 2013 7:36:04 PM UTC+5:30, Tim Golden wrote: > On 07/12/2013 12:41, Eamonn Rea wrote: > > First of all. Id like to say I have no idea how these mailing lists > > work, so I dont know if this'll come through right, but we'll see I > > guess :-) I'm coming from the Google Group

Re: Origin of eval()-ing in separate namespace object

2013-12-08 Thread Jussi Piitulainen
rusi writes: > On Sunday, December 8, 2013 4:05:54 PM UTC+5:30, Kalinni Gorzkis wrote: > > > By which languages(s) Python was inspired to support evaluating > > expressions and executing statements in a separate "namespace" > > object? > > > This syntax: > > eval(expression,globals) or exec(code,

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Cousin Stanley
> > This is what I get: > > Traceback (most recent call last): > File "./feet2meters.py", line 2, in > from tkinter import * > File "/home/jean/tkinter.py", line 2, in > import Tkinter as tk > ImportError: No module named Tkinter > From your original post I only changed the she-bang

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Dave Angel
On Sat, 7 Dec 2013 23:45:06 -0800 (PST), Jean Dubois wrote: This is what I get: Traceback (most recent call last): File "./feet2meters.py", line 2, in from tkinter import * File "/home/jean/tkinter.py", line 2, in import Tkinter as tk ImportError: No module named Tkinter Regardle

Re: Centring text in a rect in PyGame?

2013-12-08 Thread Tim Golden
On 07/12/2013 12:41, Eamonn Rea wrote: First of all. I’d like to say I have no idea how these ‘mailing lists’ work, so I don’t know if this’ll come through right, but we’ll see I guess :-) I’m coming from the Google Group comp.lang.python, and was suggested to use this instead. Assuming attachmen

Re: Eliminate "extra" variable

2013-12-08 Thread Peter Otten
Tim Chase wrote: > On 2013-12-06 11:37, Igor Korot wrote: >> def MyFunc(self, originalData): >> data = {} >> for i in xrange(0, len(originalData)): >>dateStr, freq, source = originalData[i] >>data[str(dateStr)] = {source: freq} > > this can be more cleanly/pytho

Re: Origin of eval()-ing in separate namespace object

2013-12-08 Thread rusi
On Sunday, December 8, 2013 4:05:54 PM UTC+5:30, Kalinni Gorzkis wrote: > By which languages(s) Python was inspired to support evaluating expressions > and executing statements in a separate “namespace” object? > This syntax: > eval(expression,globals) or exec(code,globals) > What is the origin o

Origin of eval()-ing in separate namespace object

2013-12-08 Thread Kalinni Gorzkis
By which languages(s) Python was inspired to support evaluating expressions and executing statements in a separate “namespace” object? This syntax: eval(expression,globals) or exec(code,globals) What is the origin of the functionality provided by the globals argument? -- https://mail.python.org/

Fwd: Eliminate "extra" variable

2013-12-08 Thread Igor Korot
OK, here is the complete function code that I'm trying to improve. def MyFunc(self, originalData): self.dates = [] data = {} dateStrs = [] for i in xrange(0, len(originalData)): dateStr, freq, source = originalData[i] data[str(dateStr)] = {source: fr

Re: interactive help on the base object

2013-12-08 Thread Ned Batchelder
On 12/7/13 11:21 PM, Mark Janssen wrote: Is it just me, or is this basically useless? class object | The most *base* type [[Terry Reedy:]] How about something like. The default top *superclass* for all Python classes. How 'bout you foos just admit that you didn't realize you've been con

Re: Is It Bug?

2013-12-08 Thread Peter Otten
Mahan Marwat wrote: > Why this is not working. > 'Hello, World'.replace('\\', '\\') > > To me, Python will interpret '' to '\\'. And the replace method will > replace '\\' with '\'. So, the result will be 'Hello, \World'. But it's > give me 'Hello, World'. > > The result I want

Re: interactive help on the base object

2013-12-08 Thread Steven D'Aprano
On Sat, 07 Dec 2013 20:21:06 -0800, Mark Janssen wrote: Is it just me, or is this basically useless? class object | The most *base* type >>> > [[Terry Reedy:]] >> How about something like. >> The default top *superclass* for all Python classes. > > How 'bout you foos just ad

Re: Is It Bug?

2013-12-08 Thread Chris Angelico
On Sun, Dec 8, 2013 at 9:01 PM, Chris “Kwpolska” Warrick wrote: > A raw string cannot end with a backslash. > r'a\a' > 'a\\a' r'a\' > File "", line 1 > r'a\' > ^ > SyntaxError: EOL while scanning string literal Incidentally, the solution to this would be to not use the bac

Re: Is It Bug?

2013-12-08 Thread Chris Angelico
On Sun, Dec 8, 2013 at 9:01 PM, Chris “Kwpolska” Warrick wrote: > On Sun, Dec 8, 2013 at 2:22 AM, Roy Smith wrote: >> There's nothing you can do with raw strings that you can't do with >> regular strings, but they're easier to read when you start to use >> backslashes. > > Unfortunately, there is

Re: Is It Bug?

2013-12-08 Thread Chris “Kwpolska” Warrick
On Sun, Dec 8, 2013 at 2:22 AM, Roy Smith wrote: > There's nothing you can do with raw strings that you can't do with > regular strings, but they're easier to read when you start to use > backslashes. Unfortunately, there is one. A raw string cannot end with a backslash. >>> r'a\a' 'a\\a' >>> r

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Jean Dubois
Op zondag 8 december 2013 08:49:22 UTC+1 schreef Chris Angelico: > On Sun, Dec 8, 2013 at 6:40 PM, Jean Dubois wrote: > > > coolens@antec2:~$ python3 feet2meters.py > > > ImportError: No module named Tkinter > > > > In Python 3, the module's named tkinter instead of Tkinter. You should > > b

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Jean Dubois
Op zondag 8 december 2013 09:10:28 UTC+1 schreef Christian Gollwitzer: > Am 07.12.13 17:52, schrieb Jean Dubois: > > > I'm trying to go through a tutorial on tkinter which has the code below as > > an example. The only thing I see when running it is a little popup with > > "Click mouse here to q

Re: [newbie] struggling wth tkinter

2013-12-08 Thread Christian Gollwitzer
Am 07.12.13 17:52, schrieb Jean Dubois: I'm trying to go through a tutorial on tkinter which has the code below as an example. The only thing I see when running it is a little popup with "Click mouse here to quit" which works as expected but always shows the following error-message. However the