Re: mapping objects

2014-02-01 Thread Cameron Simpson
On 01Feb2014 20:46, Rita wrote: > I want to learn more about ORMs so I stumbled upon, SqlAlchemy. > > If i had a JSON document (or XML, CSV, etc.._) is it possible to convert it > to a SQLAlchemy objects? I like the ability to query/filter ( > http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.ht

Re: Help with some python homework...

2014-02-01 Thread Scott W Dunning
Yeah you’re right I didn’t even notice that. For some reason I just added the 60 instead of using quantity which had been defined. On Feb 1, 2014, at 8:50 AM, Dennis Lee Bieber wrote: > On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning > declaimed the following: > >> Any chance you guys

Re: __init__ is the initialiser

2014-02-01 Thread Ben Finney
Ned Batchelder writes: > My summary of our two views is this: I am trying to look at things > from a typical programmer's point of view. Do you think the typical programmer will be looking in the language reference? I don't. > The existence of __new__ is an advanced topic that many programmers

Re: C++ to python for LED Matrix

2014-02-01 Thread Michael Torrie
Yes you could use Python for this sort of thing. The link you posted is just using a kernel spi driver that Python can write to just as well as C++ can (via it's /dev/spidev0.0 file). There is a python library that can talk to SPI in Python on the pi: http://www.100randomtasks.com/simple-spi-on-

mapping objects

2014-02-01 Thread Rita
Hello, I want to learn more about ORMs so I stumbled upon, SqlAlchemy. If i had a JSON document (or XML, CSV, etc.._) is it possible to convert it to a SQLAlchemy objects? I like the ability to query/filter ( http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html#common-filter-operators) the da

Re: __init__ is the initialiser

2014-02-01 Thread Steven D'Aprano
On Sun, 02 Feb 2014 07:09:14 +1100, Tim Delaney wrote: > On 1 February 2014 23:28, Ned Batchelder wrote: >> >> You are looking at things from an accurate-down-to-the-last-footnote >> detailed point of view (and have provided some footnotes!). That's a >> very valuable and important point of view

Re: Tkinter widgets into classes.

2014-02-01 Thread Terry Reedy
Idle, which used tkinter, runs multiple windows in one process with one event loop. There is no reason I know of to run multiple event loops in one process, and if you do, the results will not be documented and might vary between runs or between different systems. Idle can also be run multiple

Re: generator slides review

2014-02-01 Thread Terry Reedy
On 2/1/2014 9:12 AM, andrea crotti wrote: I'm giving a talk tomorrow @Fosdem about generators/iterators/iterables.. The slides are here (forgive the strange Chinese characters): https://dl.dropboxusercontent.com/u/3183120/talks/generators/index.html#3 and the code I'm using is: https://github.c

Re: Tkinter widgets into classes.

2014-02-01 Thread albert visser
On Sun, 02 Feb 2014 00:07:00 +0100, Lewis Wood wrote: On Saturday, 1 February 2014 22:26:17 UTC, Dave Angel wrote: Lewis Wood Wrote in message: (snip) DaveA It does, this is the whole code: from tkinter import * root=Tk() root.title("Second Root Testing") def secondwindow():

Re: Python prime numbers

2014-02-01 Thread Wiktor
On Sat, 1 Feb 2014 07:33:47 -0800 (PST), Panagiotis Anastasiou wrote: > Hi i'm new in programming and in python and i have an assignment that > i cant complete. I have to Write a Python program to compute and print the > first 200 prime numbers. The output must be formatted with a title and the

Re: Tkinter widgets into classes.

2014-02-01 Thread Lewis Wood
On Saturday, 1 February 2014 22:26:17 UTC, Dave Angel wrote: > Lewis Wood Wrote in message: > > > > > >> > > (deleting doublespaced googlegroups trash) > > >> > > >> > > >> To put it another way, you only want one mainloop in your code. > > >> > > >> -- > > >> > > >> DaveA > > >

Re: Tkinter widgets into classes.

2014-02-01 Thread Dave Angel
Lewis Wood Wrote in message: > >> (deleting doublespaced googlegroups trash) >> >> >> To put it another way, you only want one mainloop in your code. >> >> -- >> >> DaveA > > But I can click the button Multiple times and it will create multiple windows? > Not using the function you show

Re: Tkinter widgets into classes.

2014-02-01 Thread Lewis Wood
On Saturday, 1 February 2014 21:52:51 UTC, Dave Angel wrote: > Lewis Wood Wrote in message: > > > Oh and another question, say I make another window in the program itself > > using this: > > > > > > def secondwindow(): > > > root2=Tk() > > > root2.mainloop() > > > > > > Would it

Re:Python prime numbers

2014-02-01 Thread Dave Angel
Panagiotis Anastasiou Wrote in message: > Hi i'm new in programming and in python and i have an assignment that i cant > complete. I have to Write a Python program to compute and print the first 200 > prime numbers. The output must be formatted with a title and the prime > numbers must be prin

Re:Python prime numbers

2014-02-01 Thread Dave Angel
Panagiotis Anastasiou Wrote in message: > Hi i'm new in programming and in python and i have an assignment that i cant > complete. I have to Write a Python program to compute and print the first 200 > prime numbers. The output must be formatted with a title and the prime > numbers must be prin

Re: Tkinter widgets into classes.

2014-02-01 Thread Dave Angel
Lewis Wood Wrote in message: > Oh and another question, say I make another window in the program itself > using this: > > def secondwindow(): > root2=Tk() > root2.mainloop() > > Would it be possible for me to use some code which would return True if one > of these windows is currently

Re: Tkinter widgets into classes.

2014-02-01 Thread Lewis Wood
Oh and another question, say I make another window in the program itself using this: def secondwindow(): root2=Tk() root2.mainloop() Would it be possible for me to use some code which would return True if one of these windows is currently up, or return False if the window is not up? --

Re: __init__ is the initialiser

2014-02-01 Thread Tim Delaney
On 1 February 2014 23:28, Ned Batchelder wrote: > > You are looking at things from an accurate-down-to-the-last-footnote > detailed point of view (and have provided some footnotes!). That's a very > valuable and important point of view. It's just not how most programmers > approach the language.

Re: Tkinter widgets into classes.

2014-02-01 Thread archie65
You become less of a a faget and stop sucking granni tranni pussi dis shud help u lewl -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter widgets into classes.

2014-02-01 Thread archie65
On Saturday, 1 February 2014 19:43:18 UTC, Lewis Wood wrote: > I was wandering if I could dynamically change my GUI and after a few searches > on Google found the grid_remove() function. What I'm wandering now is if > there is a way to group a lot of widgets up into one, and then use the one >

Re: Help with some python homework...

2014-02-01 Thread Denis McMahon
On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning wrote: > Any chance you guys could help with another question I have? Below is a > code to a different problem. The only thing I don’t understand is why > when calculating the 'discounted price’ you have to subtract 1? Thanks > again guys! pr

Tkinter widgets into classes.

2014-02-01 Thread Lewis Wood
I was wandering if I could dynamically change my GUI and after a few searches on Google found the grid_remove() function. What I'm wandering now is if there is a way to group a lot of widgets up into one, and then use the one grid_remove function which will remove them all. Is it possible to do

Re: Help with some python homework...

2014-02-01 Thread Denis McMahon
On Fri, 31 Jan 2014 18:14:31 -0700, Scott W Dunning wrote: > little different from a few things you guys had mentioned. For one, I > got the correct time by calculating the number of time run and > converting that into seconds then back out to hr:mn:sc. I didn’t > calculate from midnight. > SEC

Chris Miles? TGBooleanFormWidget?

2014-02-01 Thread Len Conrad
trying to install zoner. Needs http://www.psychofx.com/TGBooleanFormWidget/ but that's giving "502 Bad Gateway" can't find TGBooleanFormWidget anywhere else. Suggestions? Thanks Len -- https://mail.python.org/mailman/listinfo/python-list

Re: piping with subprocess

2014-02-01 Thread Peter Otten
Rick Dooling wrote: > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: >> Try to convert the example from the above page >> >> """ >> output=`dmesg | grep hda` >> # becomes >> p1 = Popen(["dmesg"], stdout=PIPE) >> p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) >> p1.

Re: generator slides review

2014-02-01 Thread Miki Tebeka
On Saturday, February 1, 2014 6:12:28 AM UTC-8, andrea crotti wrote: > I'm giving a talk tomorrow @Fosdem about generators/iterators/iterables.. > > > > The slides are here (forgive the strange Chinese characters): > > https://dl.dropboxusercontent.com/u/3183120/talks/generators/index.html#3 >

Re: __init__ is the initialiser

2014-02-01 Thread Roy Smith
> On 01/02/2014 14:40, Roy Smith wrote: > > In article , > > Ned Batchelder wrote: > > > >> The existence of __new__ is an > >> advanced topic that many programmers never encounter. Taking a quick > >> scan through some large projects (Django, edX, SQLAlchemy, mako), the > >> ratio of __new__ i

Re: piping with subprocess

2014-02-01 Thread Mark Lawrence
On 01/02/2014 15:35, Rick Dooling wrote: Okay, blank lines removed. Apologies. I didn't know Google inserted them. RD No problem, the whole snag is people don't know about this flaw in this tool until they're told about it. -- My fellow Pythonistas, ask not what our language can do for yo

Re: Python prime numbers

2014-02-01 Thread Larry Martell
On Saturday, February 1, 2014, Panagiotis Anastasiou wrote: > Hi i'm new in programming and in python and i have an assignment that i > cant complete. I have to Write a Python program to compute and print the > first 200 prime numbers. The output must be formatted with a title and the > prime num

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 8:00:59 AM UTC-6, Rick Dooling wrote: > On Saturday, February 1, 2014 7:54:34 AM UTC-6, Rick Dooling wrote: > > > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > > > > Rick Dooling wrote: > > > > > I spent half a day trying to convert this bash

Python prime numbers

2014-02-01 Thread Panagiotis Anastasiou
Hi i'm new in programming and in python and i have an assignment that i cant complete. I have to Write a Python program to compute and print the first 200 prime numbers. The output must be formatted with a title and the prime numbers must be printed in 5 properly aligned columns . I have used th

Re: __init__ is the initialiser

2014-02-01 Thread Mark Lawrence
On 01/02/2014 14:40, Roy Smith wrote: In article , Ned Batchelder wrote: The existence of __new__ is an advanced topic that many programmers never encounter. Taking a quick scan through some large projects (Django, edX, SQLAlchemy, mako), the ratio of __new__ implementations to __init__ imp

Re: __init__ is the initialiser

2014-02-01 Thread Roy Smith
In article , Ned Batchelder wrote: > The existence of __new__ is an > advanced topic that many programmers never encounter. Taking a quick > scan through some large projects (Django, edX, SQLAlchemy, mako), the > ratio of __new__ implementations to __init__ implementations ranges from > 0%

Re: piping with subprocess

2014-02-01 Thread Mark Lawrence
On 01/02/2014 13:54, Rick Dooling wrote: On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: Rick Dooling wrote: I spent half a day trying to convert this bash script (on Mac) textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 into Python using

generator slides review

2014-02-01 Thread andrea crotti
I'm giving a talk tomorrow @Fosdem about generators/iterators/iterables.. The slides are here (forgive the strange Chinese characters): https://dl.dropboxusercontent.com/u/3183120/talks/generators/index.html#3 and the code I'm using is: https://github.com/AndreaCrotti/generators/blob/master/code/

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 7:54:34 AM UTC-6, Rick Dooling wrote: > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > > > Rick Dooling wrote: > > > > > > > > > > > > > I spent half a day trying to convert this bash script (on Mac) > > > > > > > > > > > > > > text

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > Rick Dooling wrote: > > > > > I spent half a day trying to convert this bash script (on Mac) > > > > > > textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 > > > > > > into Python using subprocess pipes.

Re: piping with subprocess

2014-02-01 Thread Daniel da Silva
Try this: from subprocess import check_output import sys check_output("textutil -convert html %s -stdout | pandoc -f html -t markdown -o %s" % sys.argv[1:3], shell=True) On Sat, Feb 1, 2014 at 7:19 AM, Rick Dooling wrote: > I spent half a day trying to convert this bash script (on Mac) > > t

Re: piping with subprocess

2014-02-01 Thread Peter Otten
Rick Dooling wrote: > I spent half a day trying to convert this bash script (on Mac) > > textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 > > into Python using subprocess pipes. > > It works if I save the above into a shell script called convert.sh and > then do > > subproc

Re: __init__ is the initialiser

2014-02-01 Thread Ned Batchelder
On 1/31/14 10:42 PM, Steven D'Aprano wrote: On Fri, 31 Jan 2014 14:52:15 -0500, Ned Batchelder wrote: Why can't we call __init__ the constructor and __new__ the allocator? __new__ constructs the object, and __init__ initialises it. What's wrong with calling them the constructor and initialise

piping with subprocess

2014-02-01 Thread Rick Dooling
I spent half a day trying to convert this bash script (on Mac) textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 into Python using subprocess pipes. It works if I save the above into a shell script called convert.sh and then do subprocess.check_call(["convert.sh", file, markd

C++ to python for LED Matrix

2014-02-01 Thread Liam Knott
Hey folks, So the last week or so I've been searching this site for information on how to control and program a LED Matrix (or a number of them) for a project. A few Topics have caught my eye, with me originally having in mind using a Maxim MAX7221 to control the matrix, but none more than Klaa

Re: fseek In Compressed Files

2014-02-01 Thread Dave Angel
Ayushi Dalmia Wrote in message: > > > The size of this file will be 10 GB. The version of Python I am using is > 2.7.2. Yes, performance is an important issue. > Then the only viable option is to extract the entire file and write it to a temp location. Perhaps as you extract it, you could

Re: Python shell wont open idle or an exisiting py file

2014-02-01 Thread Chris Angelico
On Sat, Feb 1, 2014 at 7:51 PM, Terry Reedy wrote: > I should have added 'to C itself', as the string terminator. Oh, right. Yes, in that sense \0 is special. It's still wrong that an incoming text string gets interpreted as code, but that's probably just a consequence of the jump from Python to

Re: Python shell wont open idle or an exisiting py file

2014-02-01 Thread Terry Reedy
On 2/1/2014 2:26 AM, Chris Angelico wrote: On Sat, Feb 1, 2014 at 4:46 PM, Terry Reedy wrote: On 1/31/2014 10:36 PM, Chris Angelico wrote: On Sat, Feb 1, 2014 at 1:54 PM, MRAB wrote: I think that some years ago I heard about a variation on UTF-8 (Microsoft?) where codepoint U+ is encod

Re: __init__ is the initialiser

2014-02-01 Thread Ethan Furman
On 01/31/2014 09:51 PM, Steven D'Aprano wrote: On Sat, 01 Feb 2014 15:35:17 +1100, Chris Angelico wrote: The two methods could have been done as a single method, __construct__, in which you get passed a cls instead of a self, and you call self=super().__construct__() and then initialize stuff.

Re: Help with some python homework...

2014-02-01 Thread David
On 1 February 2014 14:17, David wrote: > > Scott's message quoted above did not reach me, only Chris's quote of > it, so I say: Scott once you begin a discussion on a mailing list like > this one, please make sure that every reply you make goes to > "python-list@python.org" and not to the individu