Re: python file API

2012-09-25 Thread Ulrich Eckhardt
Am 24.09.2012 23:49, schrieb Dave Angel: And what approach would you use for positioning relative to end-of-file? That's currently done with an optional second > parameter to seek() method. Negative indices. ;) Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: python file API

2012-09-25 Thread Mark Lawrence
On 25/09/2012 03:32, Mark Adam wrote: On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin wrote: There are many situations where a little bit of attribute access magic is a good thing. However, operations that involve the underlying OS and that are prone to raising exceptions even in bug free code

Re: python file API

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 07:25:48 +0200, Thomas Rachel wrote: > Am 25.09.2012 04:28 schrieb Steven D'Aprano: > >> By the way, the implementation of this is probably trivial in Python >> 2.x. Untested: >> >> class MyFile(file): >> @property >> def pos(self): >> return self.tell() >>

Re: For Counter Variable

2012-09-25 Thread Dwight Hutto
> By now I think we're in the DNFTT zone. > -- Taking a bite yourself there buddy. Hop under the bridge, and comment...it make you a troll, and you're trying to feed yourself with pile on comment from the rest of the under bridge dwellers. -- Best Regards, David Hutto CEO: http://www.hitwebdevelo

ANN: eGenix mxODBC 3.2.1 - Python ODBC Database Interface

2012-09-25 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Python ODBC Database Interface Version 3.2.1 mxODBC is our commercially supported Python extension providing

Re: which a is used?

2012-09-25 Thread Mark Lawrence
On 25/09/2012 06:07, Thomas Rachel wrote: Am 25.09.2012 04:37 schrieb Dwight Hutto: I honestly could not care less what you think about me, but don't use that term. This isn't a boys' club and we don't need your hurt ego driving people away from here. OH. stirrin up shit and can't

Re: For Counter Variable

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 07:53:55 +0200, Thomas Rachel wrote: > When learning Python, it often happend me to re-inven the wheel. But as > soon as I saw the presence of something I re-wrote, I skipped my > re-written version and used the built-in. And me. Not just Python either. The very first piece o

Re: Who's laughing at my responses, and who's not?

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 00:43:18 -0400, Dwight Hutto wrote: > It sounds pretentious, but over the past several days, I've been slammed > on every post almost. That's a gross exaggeration. Over the last few days you have gotten slammed because you mildly broke etiquette and then, instead of accepti

Re: For Counter Variable

2012-09-25 Thread Chris Angelico
On Tue, Sep 25, 2012 at 11:32 AM, Dwight Hutto wrote: >> By now I think we're in the DNFTT zone. >> -- > Taking a bite yourself there buddy. Hop under the bridge, and > comment...it make you a troll, and you're trying to feed yourself with > pile on comment from the rest of the under bridge dwelle

Re: For Counter Variable

2012-09-25 Thread Mark Lawrence
On 25/09/2012 08:46, Steven D'Aprano wrote: On Tue, 25 Sep 2012 07:53:55 +0200, Thomas Rachel wrote: When learning Python, it often happend me to re-inven the wheel. But as soon as I saw the presence of something I re-wrote, I skipped my re-written version and used the built-in. And me. Not

Re: Seome kind of unblocking input

2012-09-25 Thread janis . judvaitis
Thanks for reply's. I'll be looking into threading, it seems like right way to go. btw. Why Python developers don't make a wrapper for input() with callback function using threads, so people can easily use nonblocking input? -- http://mail.python.org/mailman/listinfo/python-list

Article on the future of Python

2012-09-25 Thread Mark Lawrence
Hi all, I though this might be of interest. http://www.ironfroggy.com/software/i-am-worried-about-the-future-of-python -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: why do this program not fullscreen?

2012-09-25 Thread Vlastimil Brom
2012/9/25 Levi Nie : > the code: > import wx > app=wx.App() > win=wx.Frame(None) > win.ShowFullScreen() > app.MainLoop() > > > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, win.ShowFullScreen(True) should work, the boolean parameter appears to be required. hth, vbr -- http://m

Re: PIL questions: still supported? Problems on 2.7 for win? alternatives?

2012-09-25 Thread Gelonida N
On 09/25/2012 01:38 AM, alex23 wrote: On Sep 25, 6:04 am, Gelonida N wrote: This all does not sound very comforting. Why is there no fix on the official site? Has a bug been logged about the issue? The Plone community keeps a fairly up-to-date fork called Pillow, we've had a lot of success u

random access to video file

2012-09-25 Thread JRV
Hello, Is there a method for randomly accessing a video file in Python / OpenCV ? A kind of fseek which would allow to go directly to frame n ... Cordially, JRV -- http://mail.python.org/mailman/listinfo/python-list

Re: keeping information about players around

2012-09-25 Thread Jean-Michel Pichavant
- Original Message - > PHPMyAdmin? Might I ask why? This is a mud, so it's all command > based, > so that's not even a question, but I'm kind of curious how PHPMyAdmin > factors in there. It's a database creation tool from all I've ever > seen > of it, to define tables. Also, using it requi

Re: Who's laughing at my responses, and who's not?

2012-09-25 Thread Jean-Michel Pichavant
- Original Message - > On 9/24/2012 10:43 PM, Dwight Hutto wrote: > > It sounds pretentious, but over the past several days, I've been > > slammed on every post almost. All because of an argument over me > > not > > posting a little context in a conversation, that seemed short and > > cha

Re: For Counter Variable

2012-09-25 Thread wxjmfauth
I wrote my first program on a PDP-8. I discovered Python at release 1.5.? Now years later... I find Python more and more unusable. As an exemple related to this topic, which summarizes a little bit the situation. I just opened my interactive interpreter and produced this: >>> for i in range(len(

Re: python file API

2012-09-25 Thread Ian Kelly
On Mon, Sep 24, 2012 at 11:32 PM, Thomas Rachel wrote: > Am 25.09.2012 00:37 schrieb Ian Kelly: >> Since ints are immutable, the language specifies that it should be the >> equivalent of "file.pos = file.pos - 100", so it should set the file >> pointer to 68 bytes before EOF. > > > But this is not

Re: which a is used?

2012-09-25 Thread Alain Ketterlin
Jayden writes: > # Begin > a = 1 > > def f(): > print a > > def g(): > a = 20 > f() > > g() > #End > > I think the results should be 20, but it is 1. Would you please tell me why? When python looks at g(), it sees that a variable a is assigned to, and decides it is a local variable.

Re: For Counter Variable

2012-09-25 Thread Mark Lawrence
On 25/09/2012 10:32, wxjmfa...@gmail.com wrote: I wrote my first program on a PDP-8. I discovered Python at release 1.5.? Now years later... I find Python more and more unusable. Dementia is a growing problem for us older people :) As an exemple related to this topic, which summarizes a lit

Re: For Counter Variable

2012-09-25 Thread Chris Rebert
On Tue, Sep 25, 2012 at 2:46 AM, Mark Lawrence wrote: > On 25/09/2012 10:32, wxjmfa...@gmail.com wrote: >> >> I wrote my first program on a PDP-8. I discovered Python >> at release 1.5.? >> >> Now years later... I find Python more and more unusable. >> I'm toying more and more with the go languag

Re: python file API

2012-09-25 Thread Oscar Benjamin
On Sep 25, 2012 9:28 AM, "Dennis Lee Bieber" wrote: > > On Tue, 25 Sep 2012 08:22:05 +0200, Ulrich Eckhardt > declaimed the following in > gmane.comp.python.general: > > > Am 24.09.2012 23:49, schrieb Dave Angel: > > > And what approach would you use for positioning relative to > > > end-of-file?

Re: PHP vs. Python

2012-09-25 Thread andrea crotti
2012/9/25 : > On Thursday, 23 December 2004 03:33:36 UTC+5:30, (unknown) wrote: >> Anyone know which is faster? I'm a PHP programmer but considering >> getting into Python ... did searches on Google but didn't turn much up >> on this. >> >> Thanks! >> Stephen > > > Here some helpful gudance. > >

Re: For Counter Variable

2012-09-25 Thread Mark Lawrence
On 25/09/2012 10:53, Chris Rebert wrote: [snip] Well, the PSU might, except they emphatically do not exist... I know that they exist but if I admit to it I'd have to shoot myself. If I can get the bra off of the debutante that is. Cheers, Chris -- PEP-401 compliant -- Cheers. Mark L

Re: PHP vs. Python

2012-09-25 Thread Tejas
How to configure python in apache2 ? So my html embedded code will works. -- http://mail.python.org/mailman/listinfo/python-list

Re: python file API

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 08:27, Mark Lawrence wrote: > On 25/09/2012 03:32, Mark Adam wrote: > >> On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin >> wrote: >> >>> try: >>> f.pos = 256 >>> except IOError: >>> print('Unseekable file') >> >> > Something along these lines http://docs.python.or

Re: PHP vs. Python

2012-09-25 Thread Mark Lawrence
On 25/09/2012 11:22, Tejas wrote: How to configure python in apache2 ? So my html embedded code will works. Please follow the instructions that you'll find by searching the web. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Tim Chase
On 09/24/12 23:41, Dennis Lee Bieber wrote: > On Mon, 24 Sep 2012 14:59:47 -0700 (PDT), MrsEntity > declaimed the following in > gmane.comp.python.general: > >> Hi all, >> >> I'm working on some code that parses a 500kb, 2M line file line by line and >> saves, per line, some derived strings > >

Re: python file API

2012-09-25 Thread Mark Lawrence
On 25/09/2012 11:38, Oscar Benjamin wrote: On 25 September 2012 08:27, Mark Lawrence wrote: On 25/09/2012 03:32, Mark Adam wrote: On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin wrote: try: f.pos = 256 except IOError: print('Unseekable file') Something along these lines ht

Re: Article on the future of Python

2012-09-25 Thread Michael Harleman
That's a very interesting article.  It is encouraging to me, from reading many of the comments made, that I have chosen a good language to spend time learning despite the misgivings offered by the author.  I think Python does have a future in mobile markets as it is being used by some today ac

RE: Fastest web framework

2012-09-25 Thread Andriy Kornatskyy
The post has been updated with two more frameworks (per community request): tornado and web2py. Comments or suggestions are welcome. Thanks. Andriy Kornatskyy > From: andriy.kornats...@live.com > To: python-list@python.org > Subject: Fastest web frame

Re: For Counter Variable

2012-09-25 Thread Tim Chase
On 09/25/12 00:53, Thomas Rachel wrote: > Am 25.09.2012 01:39 schrieb Dwight Hutto: >> You don't always know all the built-ins, so the builtin is >> simpler, but knowing how to code it yourself is the priority of >> learning to code in a higher level language, which should be >> simpler to the user

RE: Fastest web framework

2012-09-25 Thread Andriy Kornatskyy
Alec While performing benchmark for web2py I noticed a memory leak. It constantly grows and never release it... Thanks. Andriy Kornatskyy > Date: Mon, 24 Sep 2012 17:36:25 +1000 > Subject: Re: Fastest web framework > From: alec.tayl...@gmail.com > To: andri

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Dave Angel
On 09/25/2012 12:21 AM, Junkshops wrote: >> Just curious; which is it, two million lines, or half a million bytes? > > Sorry, that should've been a 500Mb, 2M line file. > >> which machine is 2gb, the Windows machine, or the VM? > VM. Winders is 4gb. > >> ...but I would point out that just beca

Re: python file API

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 11:51, Mark Lawrence wrote: > On 25/09/2012 11:38, Oscar Benjamin wrote: > >> On 25 September 2012 08:27, Mark Lawrence >> wrote: >> >> On 25/09/2012 03:32, Mark Adam wrote: >>> >>> On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin wrote: try: > f.

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Mark Lawrence
On 25/09/2012 11:51, Tim Chase wrote: [snip] If only other unnamed persons on the list were so gracious rather than turning the flame-dial to 11. Oh heck what have I said this time? -tkc -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: For Counter Variable

2012-09-25 Thread Mark Lawrence
On 25/09/2012 11:57, Tim Chase wrote: [snip] Coming from C where just about *nothing* is in the stdlib and Java & PHP where only some core functionalities are in the stdlib, to Python where just the list of modules in the stdlib is humongous, I have to make http://docs.python.org/library/ my f

Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Robison Santos
Hello guys, I'm having a very serious problem with my python3 environment and I'm completely lost about the problem. In my server I run two python apps (custom apps) during system start time, and sometime when the apps are starting a corefile is generated for one one them (not always the same) and

Re: python file API

2012-09-25 Thread Thomas Rachel
Am 25.09.2012 10:13 schrieb Dennis Lee Bieber: Or some bit setting registers, like on ATxmega: OUT = 0x10 sets bit 7 and clears all others, OUTSET = 0x10 only sets bit 7, OUTTGL = 0x10 toggles it and OUTCLR = 0x10 clears it. Umpfzg. s/bit 7/bit 4/. I don't think I'd want to work with

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 00:58, Junkshops wrote: > Hi Tim, thanks for the response. > > > - check how you're reading the data: are you iterating over >>the lines a row at a time, or are you using >>.read()/.readlines() to pull in the whole file and then >>operate on that? >> > I'm using

Re: gracious responses (was: Memory usage per top 10x usage per heapy)

2012-09-25 Thread Tim Chase
On 09/25/12 06:10, Mark Lawrence wrote: > On 25/09/2012 11:51, Tim Chase wrote: >> If only other unnamed persons on the list were so gracious rather >> than turning the flame-dial to 11. >> > > Oh heck what have I said this time? You'd *like* to take credit? ;-) Nah, not you or any of the regul

Re: gracious responses

2012-09-25 Thread Mark Lawrence
On 25/09/2012 12:40, Tim Chase wrote: On 09/25/12 06:10, Mark Lawrence wrote: On 25/09/2012 11:51, Tim Chase wrote: If only other unnamed persons on the list were so gracious rather than turning the flame-dial to 11. Oh heck what have I said this time? You'd *like* to take credit? ;-) Na

RE: Fastest template engine

2012-09-25 Thread Andriy Kornatskyy
The post has been updated due to comment from Makoto Kuwata (author of tenjin) related to use of optimized version of HTML escape in tenjin templates. I believe Mako and Jinja2 both are using MarkupSafe which serves exactly for that purpose there. The test assert the output is unicode. http:/

Re: PIL questions: still supported? Problems on 2.7 for win? alternatives?

2012-09-25 Thread alex23
On Sep 25, 6:25 pm, Gelonida N wrote: > So it seems to be safe to use either Christoph' binary PIL distribution > or to use Pillow. > > The fact, that pillow is accessable via PyPi / easy_install / PIP pushes > me slightly towards pillow. > I assume it's best to uninstall PIL before installing p

Re: gracious responses (was: Memory usage per top 10x usage per heapy)

2012-09-25 Thread alex23
On Sep 25, 9:39 pm, Tim Chase wrote: > Mostly instigated by one person with a > particularly quick trigger, vitriolic tongue, and a disregard for > pythonic code. I'm sorry. I'll get me coat. -- http://mail.python.org/mailman/listinfo/python-list

Re: which a is used?

2012-09-25 Thread alex23
On Sep 25, 3:30 pm, Dwight Hutto wrote: > You'd have to read the other posts. And remember that some of these > names are A.K.A.'s, they ask respond, and befriend another name > through another proxy. You've actively accused me of this several times. If you have evidence that there's sockpuppetin

Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 12:32, Robison Santos wrote: > Hello guys, > > I'm having a very serious problem with my python3 environment and I'm > completely lost about the problem. > In my server I run two python apps (custom apps) during system start time, > and sometime when the apps are starting a c

Re: gracious responses

2012-09-25 Thread Mark Lawrence
On 25/09/2012 13:44, alex23 wrote: On Sep 25, 9:39 pm, Tim Chase wrote: Mostly instigated by one person with a particularly quick trigger, vitriolic tongue, and a disregard for pythonic code. I'm sorry. I'll get me coat. Oi, back of the queue if you don't mind :) -- Cheers. Mark Lawrence

Re: which a is used?

2012-09-25 Thread Colin J. Williams
On 24/09/2012 10:14 PM, alex23 wrote: On Sep 25, 11:13 am, Dwight Hutto wrote: bitch I honestly could not care less what you think about me, but don't use that term. This isn't a boys' club and we don't need your hurt ego driving people away from here. +1 -- http://mail.python.org/mailman/l

RE: Fastest web framework

2012-09-25 Thread Andriy Kornatskyy
Tarek, With all respect, running benchmark on something that has sleeps, etc is pretty far from real world use case. So I went a little bit different way. Here is a live demo (a semi real world web application) that comes with wheezy.web framework as a template: http://wheezy.pythonanywhere.c

Re: Article on the future of Python

2012-09-25 Thread Kevin Walzer
On 9/25/12 4:15 AM, Mark Lawrence wrote: Hi all, I though this might be of interest. http://www.ironfroggy.com/software/i-am-worried-about-the-future-of-python Interesting article, but the comments of those who say "the only language I need to know is Python" strike me as a bit limited. If

data attributes override method attributes?

2012-09-25 Thread Jayden
Dear All, In the Python Tutorial, Section 9.4, it is said that "Data attributes override method attributes with the same name." But in my testing as follows: #Begin class A: i = 10 def i(): print 'i' A.i #End I think A.i should be the number 10 but it is th

Re: Article on the future of Python

2012-09-25 Thread Roy Smith
In article , Kevin Walzer wrote: > the comments of those who say "the only > language I need to know is Python" strike me as a bit limited. I have been convinced that "X is the only language I need to know", for many different values of X over the years. -- http://mail.python.org/mailman/lis

Re: data attributes override method attributes?

2012-09-25 Thread alex23
On Sep 25, 11:41 pm, Jayden wrote: > Dear All, > > In the Python Tutorial, Section 9.4, it is said that > > "Data attributes override method attributes with the same name." > > But in my testing as follows: > > #Begin > class A: >         i = 10 >         def i(): >                 print 'i' > > A

Re: Article on the future of Python

2012-09-25 Thread Martin P. Hellwig
On Tuesday, 25 September 2012 09:14:27 UTC+1, Mark Lawrence wrote: > Hi all, > > I though this might be of interest. > http://www.ironfroggy.com/software/i-am-worried-about-the-future-of-python > -- > > Cheers. > Mark Lawrence. I glanced over the article but it seems to me another 'I am afraid

Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 14:56, Robison Santos wrote: > I'm using python3.2.1 > on Enterprise Linux Server release 5.3 (Carthage). > > I'm starting my apps calling python3 file.py > > I have a script that runs on system startup executing my python scripts. > What happens if you just run the script

Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Robison Santos
I'm using python3.2.1 on Enterprise Linux Server release 5.3 (Carthage). I'm starting my apps calling python3 file.py I have a script that runs on system startup executing my python scripts. Any other info you need? Thanks so far, Robison On Tue, Sep 25, 2012 at 9:49 AM, Oscar Benjamin wrot

Stop feeding the trolls (Was: which a is used?)

2012-09-25 Thread D'Arcy Cain
On Tue, 25 Sep 2012 08:44:18 +0100 Mark Lawrence wrote: > On 25/09/2012 06:07, Thomas Rachel wrote: > > Am 25.09.2012 04:37 schrieb Dwight Hutto: [...usual nonsense] > someone had the audacity to protect his stance. I am sure that people > have seen enough of his behaviour in the last few hours

Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Robison Santos
This problem does not happen very often, but when it happen is only on system startup, and I couldn't reproduce by starting by hand. My startup script tries to initiate a lot of services in sequence (ruby, java, C and python), but does not do anything with stdio streams, at least not directly. At

Re: python file API

2012-09-25 Thread Grant Edwards
On 2012-09-25, Dennis Lee Bieber wrote: > On Tue, 25 Sep 2012 08:22:05 +0200, Ulrich Eckhardt > declaimed the following in > gmane.comp.python.general: > >> Am 24.09.2012 23:49, schrieb Dave Angel: >> > And what approach would you use for positioning relative to >> > end-of-file? That's currently

Re: data attributes override method attributes?

2012-09-25 Thread Peter Otten
Jayden wrote: > In the Python Tutorial, Section 9.4, it is said that > > "Data attributes override method attributes with the same name." The tutorial is wrong here. That should be "Instance attributes override class attributes with the same name." As methods are usually defined in the class a

Re: data attributes override method attributes?

2012-09-25 Thread alex23
On Sep 26, 12:08 am, Peter Otten <__pete...@web.de> wrote: > Jayden wrote: > > In the Python Tutorial, Section 9.4, it is said that > > > "Data attributes override method attributes with the same name." > > The tutorial is wrong here. That should be > > "Instance attributes override class attribute

Re: For Counter Variable

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence wrote: > On 25/09/2012 10:53, Chris Rebert wrote: > > [snip] > >> Well, the PSU might, except they emphatically do not exist... > > I know that they exist You are delusional. The PSU certainly do not exist and it is a myth that they -- ht

Re: data attributes override method attributes?

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 06:41:43 -0700, Jayden wrote: > Dear All, > > In the Python Tutorial, Section 9.4, it is said that > > "Data attributes override method attributes with the same name." > > But in my testing as follows: > > #Begin > class A: > i = 10 > def i(): > pr

Re: Who's laughing at my responses, and who's not?

2012-09-25 Thread Ramchandra Apte
On Tuesday, 25 September 2012 10:40:02 UTC+5:30, Terry Reedy wrote: > On 9/25/2012 12:43 AM, Dwight Hutto wrote: > > > It sounds pretentious, but over the past several days, I've been > > > slammed on every post almost. All because of an argument over me not > > > posting a little context in a

Re: For Counter Variable

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 12:19 AM, Steven D'Aprano wrote: > On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence wrote: > >> On 25/09/2012 10:53, Chris Rebert wrote: >> >> [snip] >> >>> Well, the PSU might, except they emphatically do not exist... >> >> I know that they exist > > You are delusional. T

new-style class or old-style class?

2012-09-25 Thread Jayden
In learning Python, I found there are two types of classes? Which one are widely used in new Python code? Is the new-style much better than old-style? Thanks!! -- http://mail.python.org/mailman/listinfo/python-list

Re: data attributes override method attributes?

2012-09-25 Thread Peter Otten
alex23 wrote: > On Sep 26, 12:08 am, Peter Otten <__pete...@web.de> wrote: >> Jayden wrote: >> > In the Python Tutorial, Section 9.4, it is said that >> >> > "Data attributes override method attributes with the same name." >> >> The tutorial is wrong here. That should be >> >> "Instance attributes

Re: new-style class or old-style class?

2012-09-25 Thread Littlefield, Tyler
On 9/25/2012 8:44 AM, Jayden wrote: In learning Python, I found there are two types of classes? Which one are widely used in new Python code? Is the new-style much better than old-style? Thanks!! Perhaps this is useful: http://docs.python.org/reference/datamodel.html It's 3.3 I think. -- Ta

Re: new-style class or old-style class?

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 12:44 AM, Jayden wrote: > In learning Python, I found there are two types of classes? Which one are > widely used in new Python code? Is the new-style much better than old-style? > Thanks!! Definitely go with new-style. In Python 3, old-style classes aren't supported, an

Re: data attributes override method attributes?

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 12:54 AM, Peter Otten <__pete...@web.de> wrote: > To me > > "Data attributes override method attributes with the same name" > > implies that data attributes take precedence over method attributes, not > that they replace them only when there is an assignment of data after th

Re: How to limit CPU usage in Python

2012-09-25 Thread DPalao
On Jueves septiembre 20 2012 11:12:44 Rolando Cañer Roblejo escribió: > Hi all, > > Is it possible for me to put a limit in the amount of processor usage (% > CPU) that my current python script is using? Is there any module useful > for this task? I saw Resource module but I think it is not the mo

Re: data attributes override method attributes?

2012-09-25 Thread Ulrich Eckhardt
Am 25.09.2012 16:11, schrieb alex23: On Sep 26, 12:08 am, Peter Otten <__pete...@web.de> wrote: Jayden wrote: In the Python Tutorial, Section 9.4, it is said that "Data attributes override method attributes with the same name." The tutorial is wrong here. That should be "Instance attribut

Re: gracious responses

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 12:54:05 +0100, Mark Lawrence wrote: > Well thank goodness for that. Of course the person to whom you've > alluded has been defended over on the tutor mailing list, seriously, and > as I've said elsewhere after referring to my family as pigs!!! Since pigs are at least as inte

Re: Article on the future of Python

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 09:26:19 -0400, Kevin Walzer wrote: > On 9/25/12 4:15 AM, Mark Lawrence wrote: >> Hi all, >> >> I though this might be of interest. >> >> http://www.ironfroggy.com/software/i-am-worried-about-the-future-of- >> python >> >> > Interesting article, but the comments of those who sa

Re: python file API

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 2:07 AM, Dennis Lee Bieber wrote: > f.pos += delta > > would be a "seek.set" and with a naive driver might trigger a rewind to > the start of the tape followed by a seek to the absolute position, > whereas the seek from current location would only move the tape by t

How to export a logging level?

2012-09-25 Thread Vincent Vande Vyvre
In my application I import a module and I want to set the same logging level as the main app to this module. I've tried this code main.py import logging logger = logging.getLogger(__name__) lvl = logging.DEBUG LOG_FORMAT = "%(asctime)-6s %(levelname)s: %(name)s - %(message)s" logging.basicConfig

Re: new-style class or old-style class?

2012-09-25 Thread Steven D'Aprano
On Tue, 25 Sep 2012 07:44:04 -0700, Jayden wrote: > In learning Python, I found there are two types of classes? Which one > are widely used in new Python code? New-style classes. > Is the new-style much better than old-style? Yes. Always use new-style classes, unless you have some specific re

Re: How to export a logging level?

2012-09-25 Thread Peter Otten
Vincent Vande Vyvre wrote: > In my application I import a module and I want to set the same logging > level as the main app to this module. Isn't that the default? If you set the logging level with basicConfig() that level should be applied to all messages. -- http://mail.python.org/mailman/

Re: Article on the future of Python

2012-09-25 Thread Paul Rubin
Kevin Walzer writes: > language, but it's another thing entirely to call Python the One > Language to Rule Them All. (That's C, because all other languages are > implemented in it. :-) ) I got into a discussion about that in another newsgroup and noticed that C seems to have been a 20th-century l

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Junkshops
I'm a bit surprised you aren't beyond the 2gb limit, just with the structures you describe for the file. You do realize that each object has quite a few bytes of overhead, so it's not surprising to use several times the size of a file, to store the file in an organized way. I did some back of the

Re: How to export a logging level?

2012-09-25 Thread Vincent Vande Vyvre
Le 25/09/12 19:01, Peter Otten a écrit : > Vincent Vande Vyvre wrote: > >> In my application I import a module and I want to set the same logging >> level as the main app to this module. > Isn't that the default? If you set the logging level with basicConfig() that > level should be applied to all

Re: How to export a logging level?

2012-09-25 Thread Jean-Michel Pichavant
- Original Message - > In my application I import a module and I want to set the same > logging > level > as the main app to this module. > > I've tried this code > > main.py > > import logging > logger = logging.getLogger(__name__) > lvl = logging.DEBUG > LOG_FORMAT = "%(asctime)-6s %(l

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Junkshops
Can you give an example of how these data structures look after reading only the first 5 lines? Sure, here you go: In [38]: mpef._ustore._store Out[38]: defaultdict(, {'Measurement': {'8991c2dc67a49b909918477ee4efd767': , '7b38b429230f00fe4731e60419e92346': , 'b53531471b261c44d52f651add64

Re: How to export a logging level?

2012-09-25 Thread Vincent Vande Vyvre
Le 25/09/12 19:47, Jean-Michel Pichavant a écrit : > - Original Message - >> In my application I import a module and I want to set the same >> logging >> level >> as the main app to this module. >> >> I've tried this code >> >> main.py >> >> import logging >> logger = logging.getLogger(__na

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 19:08, Junkshops wrote: > > Can you give an example of how these data structures look after reading > only the first 5 lines? > > Sure, here you go: > > In [38]: mpef._ustore._store > Out[38]: defaultdict(, {'Measurement': > {'8991c2dc67a49b909918477ee4efd767': > , > '7b38b4

Re: Article on the future of Python

2012-09-25 Thread Grant Edwards
On 2012-09-25, Martin P. Hellwig wrote: > On Tuesday, 25 September 2012 09:14:27 UTC+1, Mark Lawrence wrote: >> Hi all, >> >> I though this might be of interest. >> http://www.ironfroggy.com/software/i-am-worried-about-the-future-of-python > I glanced over the article but it seems to me another

Re: new-style class or old-style class?

2012-09-25 Thread Mark Lawrence
On 25/09/2012 17:20, Steven D'Aprano wrote: On Tue, 25 Sep 2012 07:44:04 -0700, Jayden wrote: In learning Python, I found there are two types of classes? Which one are widely used in new Python code? New-style classes. Is the new-style much better than old-style? Yes. Always use new-styl

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Dave Angel
On 09/25/2012 01:39 PM, Junkshops wrote: Procedural point: I know you're trying to conform to the standard that this mailing list uses, but you're off a little, and it's distracting. It's also probably more work for you, and certainly for us. You need an attribution in front of the quoted portio

google api and oauth2

2012-09-25 Thread Littlefield, Tyler
Hello all: I've been trying to figure out the oauth2client part of google's api, and I am really confused. It shows a flow, and even with the client flow, you need a redirect uri. This isn't important because I just want to get both an access and refresh token. Has anyone had any experience wi

Re: python file API

2012-09-25 Thread Thomas Rachel
Am 25.09.2012 09:28 schrieb Steven D'Aprano: The whole concept is incomplete at one place: self.seek(10, 2) seeks beyond EOF, potentially creating a sparse file. This is a thing you cannot achieve. On the contrary, since the pos attribute is just a wrapper around seek, you can seek beyond EOF

Re: data attributes override method attributes?

2012-09-25 Thread Terry Reedy
On 9/25/2012 11:03 AM, Chris Angelico wrote: On Wed, Sep 26, 2012 at 12:54 AM, Peter Otten <__pete...@web.de> wrote: To me "Data attributes override method attributes with the same name" implies that data attributes take precedence over method attributes, not that they replace them only when t

Re: google api and oauth2

2012-09-25 Thread Demian Brecht
This is a shameless plug, but if you want a much easier to understand method of accessing protected resources via OAuth2, I have a 55 LOC client implementation with docs and examples here: https://github.com/demianbrecht/sanction (Google is one of the tested providers with an access example). Are

Re: data attributes override method attributes?

2012-09-25 Thread Thomas Rachel
Am 25.09.2012 16:08 schrieb Peter Otten: Jayden wrote: In the Python Tutorial, Section 9.4, it is said that "Data attributes override method attributes with the same name." The tutorial is wrong here. That should be "Instance attributes override class attributes with the same name." I jum

Re: data attributes override method attributes?

2012-09-25 Thread Ian Kelly
On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy wrote: > On 9/25/2012 11:03 AM, Chris Angelico wrote: >> Instance attributes override (shadow) class attributes. > > > except for (some? all?) special methods Those names are shadowed too. If you call foo.__len__() and the name is bound on the instanc

Re: data attributes override method attributes?

2012-09-25 Thread Terry Reedy
On 9/25/2012 10:54 AM, Peter Otten wrote: alex23 wrote: On Sep 26, 12:08 am, Peter Otten <__pete...@web.de> wrote: Jayden wrote: In the Python Tutorial, Section 9.4, it is said that "Data attributes override method attributes with the same name." The tutorial is wrong here. That should b

Re: google api and oauth2

2012-09-25 Thread Littlefield, Tyler
On 9/25/2012 2:05 PM, Demian Brecht wrote: This is a shameless plug, but if you want a much easier to understand method of accessing protected resources via OAuth2, I have a 55 LOC client implementation with docs and examples here:https://github.com/demianbrecht/sanction (Google is one of the

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Junkshops
On 9/25/2012 11:17 AM, Oscar Benjamin wrote: On 25 September 2012 19:08, Junkshops > wrote: In [38]: mpef._ustore._store Out[38]: defaultdict(, {'Measurement': {'8991c2dc67a49b909918477ee4efd767': , '7b38b429230f00fe4731e60419e92346': , 'b53531471

Re: data attributes override method attributes?

2012-09-25 Thread Terry Reedy
On 9/25/2012 4:07 PM, Ian Kelly wrote: On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy wrote: On 9/25/2012 11:03 AM, Chris Angelico wrote: Instance attributes override (shadow) class attributes. except for (some? all?) special methods Those names are shadowed too. If you call foo.__len__()

  1   2   >