Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Steven D'Aprano
On Tuesday 22 March 2016 11:49, BartC wrote: [...] > Ideally there would be a descriptor or handle passed around which > contains the current state of the tokeniser, and where you stick the > current token values. But for a speed test, I was worried about > attribute lookups. Bart, in my experien

Re: GAPI -- Sharing a post to Social Networking Pages from my App

2016-03-21 Thread Steven D'Aprano
On Tuesday 22 March 2016 15:14, Karthik Reddy wrote: > Hi Experts, > > I am trying to post on facebook and google plus page from my > application. I am using facebook-sdk an d I am able to post using local > machine but I am not able to post from dev server. > > Can Anyone Please help me on th

Re: Convert list to another form but providing same information

2016-03-21 Thread Steven D'Aprano
On Tuesday 22 March 2016 11:31, Ben Bacarisse wrote: > Ian Kelly writes: > >> On Mon, Mar 21, 2016 at 2:03 PM, Ben Bacarisse >> wrote: >>> For experts here: why can't I write a lambda that has a statement in it >>> (actually I wanted two: lambda l, i: l[i] += 1; return l)? >> >> https://docs.py

Re: GAPI -- Sharing a post to Social Networking Pages from my App

2016-03-21 Thread Mark Lawrence
On 22/03/2016 04:14, Karthik Reddy wrote: Hi Experts, I am trying to post on facebook and google plus page from my application. I am using facebook-sdk an d I am able to post using local machine but I am not able to post from dev server. Can Anyone Please help me on this. Thanks, Karthik

GAPI -- Sharing a post to Social Networking Pages from my App

2016-03-21 Thread Karthik Reddy
Hi Experts, I am trying to post on facebook and google plus page from my application. I am using facebook-sdk an d I am able to post using local machine but I am not able to post from dev server. Can Anyone Please help me on this. Thanks, Karthik -- https://mail.python.org/mailman/listinf

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 2:36 PM, Wildman via Python-list wrote: > Thanks. I changed the code as you (and MRAB) suggested. > > def copy_clipboard(self): > try: > text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST) > except tk.TclError: > text2copy = self.text.get() > r

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Wildman via Python-list
On Tue, 22 Mar 2016 12:47:11 +1100, Chris Angelico wrote: > On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list > wrote: >> I have a gui that has text widget and I want to be able to >> copy to the clipboard the text that is highlighted or the >> text widget's entire contents if no text is

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Wildman via Python-list
On Tue, 22 Mar 2016 02:01:53 +, MRAB wrote: > On 2016-03-22 01:47, Chris Angelico wrote: >> On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list >> wrote: >>> I have a gui that has text widget and I want to be able to >>> copy to the clipboard the text that is highlighted or the >>> text

Re: crash while using PyCharm / Python3

2016-03-21 Thread Jonathan N. Little
Adam wrote: Sure glad I did not reinstall Ubuntu. Whew!! Unless you really-really-really screw things up, you usually do not have to. Linux is not Windows ;-) Even if you had to, with /home on its own partition a reinstall would not have been an issue, you just have to choose the "Something

Re: crash while using PyCharm / Python3

2016-03-21 Thread Jonathan N. Little
Adam wrote: "Adam" wrote in message news:ncprqb$tl9$1...@news.albasani.net... "Jonathan N. Little" wrote in message news:ncpjj0$7ug$1...@dont-email.me... Adam wrote: There ought to be a way to just reinstall the graphics subsystem rather than an all-or-none installation approach. Yes you

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Mark Lawrence
On 22/03/2016 00:49, BartC wrote: I was surprised at one time that slices don't create 'views', but I've since implemented view-slices and I can appreciate the problems.) Why, the docs are quite clear on how Python works? Of course you can always use memoryviews https://docs.python.org/3/l

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread MRAB
On 2016-03-22 01:47, Chris Angelico wrote: On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list wrote: I have a gui that has text widget and I want to be able to copy to the clipboard the text that is highlighted or the text widget's entire contents if no text is highlighted. Fortunately

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list wrote: > I have a gui that has text widget and I want to be able to > copy to the clipboard the text that is highlighted or the > text widget's entire contents if no text is highlighted. Fortunately your code reveals that you're using "tk"

Re: Convert list to another form but providing same information

2016-03-21 Thread Paul Rubin
Maurice writes: > I have a list such [6,19,19,21,21,21] > Therefore the resulting list should be: > [0,0,0,0,0,0,1,0,0,0...,2,0,3,0...0] Rather than a sparse list you'd typically want a dictionary (untested): from collections import defaultdict the_list = [0,0,0,0,0,0,1,0,0,0...,2,0,3,0...0]

Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Wildman via Python-list
I have a gui that has text widget and I want to be able to copy to the clipboard the text that is highlighted or the text widget's entire contents if no text is highlighted. This line of code works for the highlighted text: text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST) However, this co

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Steven D'Aprano
On Tue, 22 Mar 2016 06:43 am, BartC wrote: > This code was adapted from a program that used: > > readstrfile(filename) > > which either returned the contents of the file as a string, or 0. What an interesting function. And I don't mean that in a good way. So if it returns 0, how do you kno

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 22/03/2016 00:42, Mark Lawrence wrote: On 22/03/2016 00:18, BartC wrote: On 21/03/2016 23:50, Terry Reedy wrote: On 3/21/2016 8:43 AM, BartC wrote: This tests highlights the benefits of an O(1) switch statement. So why are you not taking advantage of Python's O(1) dict lookup? I've alr

Re: Convert list to another form but providing same information

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 11:31 AM, Ben Bacarisse wrote: > However, the explanation ("because Python’s syntactic framework can't > handle statements nested inside expressions") seemed, at first, to be > saying you can't because you can't! But the term "syntactic framework" > hints that it's not rea

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 23:20, Dennis Lee Bieber wrote: On Mon, 21 Mar 2016 17:31:21 +, BartC declaimed the following: I wasn't going to post it but here it is anyway: http://pastebin.com/FLbWSdpT (I've added some spaces for your benefit. This also builds a histogram of names so as to do somethin

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Mark Lawrence
On 22/03/2016 00:18, BartC wrote: On 21/03/2016 23:50, Terry Reedy wrote: On 3/21/2016 8:43 AM, BartC wrote: This tests highlights the benefits of an O(1) switch statement. So why are you not taking advantage of Python's O(1) dict lookup? I've already reported using a list lookup which is

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Adam" wrote in message news:ncpev8$51d$1...@news.albasani.net... > > "Dirk T. Verbeek" wrote in message > news:56f03080$0$5924$e4fe5...@news.xs4all.nl... >> Op 21-03-16 om 17:51 schreef Adam: >>> "Adam" wrote in message >>> news:ncikss$tks$1...@news.albasani.net... Host OS:Ubun

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Adam" wrote in message news:ncprqb$tl9$1...@news.albasani.net... > > "Jonathan N. Little" wrote in message > news:ncpjj0$7ug$1...@dont-email.me... >> Adam wrote: >>> There ought to be a way to just reinstall the graphics subsystem rather >>> than >>> an all-or-none installation approach. >>

Re: Convert list to another form but providing same information

2016-03-21 Thread Ben Bacarisse
Ian Kelly writes: > On Mon, Mar 21, 2016 at 2:03 PM, Ben Bacarisse wrote: >> For experts here: why can't I write a lambda that has a statement in it >> (actually I wanted two: lambda l, i: l[i] += 1; return l)? > > https://docs.python.org/3/faq/design.html#why-can-t-lambda-expressions-contain-st

Re: creating multiple python Django projects in Windows environment

2016-03-21 Thread ivan77
> > Hmm, that depends how you want to structure things. If the different > applications are conceptually different, you can keep them completely > separate by making them separate Django projects; that would give you > the flexibility to put them onto independent URLs, post the source > code to o

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Terry Reedy
On 3/21/2016 1:12 PM, BartC wrote: Given that 99.9998% of input byte data is ASCII, and 99.% of characters (in this data), is it unreasonable to concentrate on that 0..127 range? No. And if you take the approach of mapping the whole ascii set, you should use a lookup sequence rather than

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 23:50, Terry Reedy wrote: On 3/21/2016 8:43 AM, BartC wrote: This tests highlights the benefits of an O(1) switch statement. So why are you not taking advantage of Python's O(1) dict lookup? I've already reported using a list lookup which is also O(1), and it didn't really hel

Re: Static caching property

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 11:05 AM, Steven D'Aprano wrote: > But my favourite is to combine them: > > > class Desc: > def __get__(self, obj, type): > sentinel = object() # guaranteed to be unique > value = getattr(type, _cached_value, sentinel) > if value is sentinel: >

Re: Convert list to another form but providing same information

2016-03-21 Thread Steven D'Aprano
On Tue, 22 Mar 2016 05:26 am, Maurice wrote: > I have a list such [6,19,19,21,21,21] (FYI this is the item of a certain > key in the dictionary) > > And I need to convert it to a list of 32 elements (meaning days of the > month however first element ie index 0 or day zero has no meaning - > keepi

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Terry Reedy
On 3/21/2016 8:34 AM, BartC wrote: On 21/03/2016 02:21, Terry Reedy wrote: On 3/20/2016 9:15 PM, BartC wrote: http://pastebin.com/dtM8WnFZ This is a test of a character-at-a-time task in Python; I disagree. It tests of C code re-written in ludicrously crippled Python. No use of the re modul

Re: Static caching property

2016-03-21 Thread Steven D'Aprano
On Tue, 22 Mar 2016 04:48 am, Ian Kelly wrote: > You don't actually need a metaclass for this: > class Desc: > ... def __get__(self, obj, type=None): > ... if not type._cached_value: > ... type._cached_value = compute_value(type) > ... return type._cached_valu

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Terry Reedy
On 3/21/2016 8:43 AM, BartC wrote: This tests highlights the benefits of an O(1) switch statement. So why are you not taking advantage of Python's O(1) dict lookup? -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: creating multiple python Django projects in Windows environment

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 8:02 AM, jogaserbia wrote: > On Saturday, March 19, 2016 at 3:16:53 AM UTC-4, Chris Angelico wrote: >> On Sat, Mar 19, 2016 at 6:04 AM, jogaserbia wrote: >> > Can someone please give me ideas on what I should read about (or pay >> > someone to do) that would enable me to c

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Jonathan N. Little" wrote in message news:ncpjj0$7ug$1...@dont-email.me... > Adam wrote: >> There ought to be a way to just reinstall the graphics subsystem rather >> than >> an all-or-none installation approach. > > Yes you can. Did it for a borked install of the nVidia driver. reference > t

Re: need help With understanding

2016-03-21 Thread Peter Pearson
On Mon, 21 Mar 2016 11:18:57 +, mohamed mohamud wrote: > hey im new at Learning Python, and i have an issue which i would like > som help With. > > i have currently installed Python, and im Reading this book which > tells me i have to have IDLE, but i cant find it on my computer. do i > need to

Re: multiprocessing, pool, queue length

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 1:46 PM, Michael Welle wrote: > Wait on the result means to set a multiprocessing.Event if one of the > consumers finds the sentinel task and wait for it on the producer? Hmm, > that might be better than incrementing a counter. But still, it couples > the consumers and the

Re: creating multiple python Django projects in Windows environment

2016-03-21 Thread jogaserbia
On Saturday, March 19, 2016 at 3:16:53 AM UTC-4, Chris Angelico wrote: > On Sat, Mar 19, 2016 at 6:04 AM, jogaserbia wrote: > > Can someone please give me ideas on what I should read about (or pay > > someone to do) that would enable me to create a basis on which multiple > > Python (web and non-

Re: Why do you use python?

2016-03-21 Thread Larry Martell
On Mon, Mar 21, 2016 at 4:26 PM, wrote: > On Monday, 21 March 2016 04:13:45 UTC, Chris Angelico wrote: >> On Mon, Mar 21, 2016 at 2:59 PM, wrote: >> > instead, to be efficient, it is best to combine tools to solve problems >> > that contain complexities where there is nothing available off th

Re: monkey patching __code__

2016-03-21 Thread Matt Wheeler
On 20 March 2016 at 16:46, Sven R. Kunze wrote: > On 19.03.2016 00:58, Matt Wheeler wrote: >> >> I know you have a working solution now with updating the code & >> defaults of the function, but what about just injecting your function >> into the modules that had already imported it after the >> mo

Re: Why do you use python?

2016-03-21 Thread mbg1708
On Monday, 21 March 2016 04:13:45 UTC, Chris Angelico wrote: > On Mon, Mar 21, 2016 at 2:59 PM, wrote: > > instead, to be efficient, it is best to combine tools to solve problems > > that contain complexities where there is nothing available off the shelve > > that does the job. c# is free, fr

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ned Batchelder
On Monday, March 21, 2016 at 3:43:40 PM UTC-4, BartC wrote: > > This code was adapted from a program that used: > > readstrfile(filename) > > which either returned the contents of the file as a string, or 0. > > That's all. My Python version was thrown together as I don't know if > there's

Re: Convert list to another form but providing same information

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 2:12 PM, Ian Kelly wrote: > On Mon, Mar 21, 2016 at 2:03 PM, Ben Bacarisse wrote: >> For experts here: why can't I write a lambda that has a statement in it >> (actually I wanted two: lambda l, i: l[i] += 1; return l)? > > https://docs.python.org/3/faq/design.html#why-can-

Re: Convert list to another form but providing same information

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 2:03 PM, Ben Bacarisse wrote: > For experts here: why can't I write a lambda that has a statement in it > (actually I wanted two: lambda l, i: l[i] += 1; return l)? https://docs.python.org/3/faq/design.html#why-can-t-lambda-expressions-contain-statements -- https://mail.p

Re: Convert list to another form but providing same information

2016-03-21 Thread Ben Bacarisse
Maurice writes: > Hello, hope everything is okay. I think someone might have dealt with > a similar issue I'm having. > > Basically I wanna do the following: > > I have a list such [6,19,19,21,21,21] (FYI this is the item of a >certain key in the dictionary) > > And I need to convert it to a list

Re: crash while using PyCharm / Python3

2016-03-21 Thread Jonathan N. Little
Adam wrote: There ought to be a way to just reinstall the graphics subsystem rather than an all-or-none installation approach. Yes you can. Did it for a borked install of the nVidia driver. reference this:

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Mark Lawrence
On 21/03/2016 19:43, BartC wrote: On 21/03/2016 02:02, Mark Lawrence wrote: On 21/03/2016 01:35, Chris Angelico wrote: On Mon, Mar 21, 2016 at 12:28 PM, Mark Lawrence wrote: I got to line 22, saw the bare except, and promptly gave up. Oh, keep going, Mark. It gets better. def readstrfile(f

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 02:02, Mark Lawrence wrote: On 21/03/2016 01:35, Chris Angelico wrote: On Mon, Mar 21, 2016 at 12:28 PM, Mark Lawrence wrote: I got to line 22, saw the bare except, and promptly gave up. Oh, keep going, Mark. It gets better. def readstrfile(file): try: data=open(

Re: Convert list to another form but providing same information

2016-03-21 Thread Mark Lawrence
On 21/03/2016 18:30, Maurice wrote: Just figured why: If I type this on the kernel: weirdList = [[0]*3]*5 weirdList Out[257]: [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] weirdList[0][0] = 1 weirdList Out[259]: [[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]] All first ele

Re: Convert list to another form but providing same information

2016-03-21 Thread Peter Otten
Maurice wrote: > Hello, hope everything is okay. I think someone might have dealt with a > similar issue I'm having. > > Basically I wanna do the following: > > I have a list such [6,19,19,21,21,21] (FYI this is the item of a certain > key in the dictionary) > > And I need to convert it to a li

Re: Convert list to another form but providing same information

2016-03-21 Thread Mark Lawrence
On 21/03/2016 18:26, Maurice wrote: Hello, hope everything is okay. I think someone might have dealt with a similar issue I'm having. Basically I wanna do the following: I have a list such [6,19,19,21,21,21] (FYI this is the item of a certain key in the dictionary) And I need to convert it t

Re: multiprocessing, pool, queue length

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 4:25 AM, Michael Welle wrote: > Hello, > > I use a multiprocessing pool. My producer calls pool.map_async() > to fill the pool's job queue. It can do that quite fast, while the > consumer processes need much more time to empty the job queue. Since the > producer can create

Re: WConio won't install in Python 3.4

2016-03-21 Thread Mark Lawrence
On 21/03/2016 18:11, David Lemper wrote: Recently returned to Python after four years. Installed version 3.4.4 and attempted to install WConio in my Windows 8.1 system Gonnerman's website has WConio-1.5.1.win32-py3.3.exe & WConio-1.5.1.win32-py3.5.exe , but no py3.4 ( ? ) Tried to i

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Dirk T. Verbeek" wrote in message news:56f03080$0$5924$e4fe5...@news.xs4all.nl... > Op 21-03-16 om 17:51 schreef Adam: >> "Adam" wrote in message >> news:ncikss$tks$1...@news.albasani.net... >>> >>> Host OS:Ubuntu Desktop 14.04 LTS / Unity >>> >>> System crashed while using PyCharm / Pytho

Re: Convert list to another form but providing same information

2016-03-21 Thread Maurice
Just figured why: If I type this on the kernel: weirdList = [[0]*3]*5 weirdList Out[257]: [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] weirdList[0][0] = 1 weirdList Out[259]: [[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]] All first elements of the sublists also changes. I

Convert list to another form but providing same information

2016-03-21 Thread Maurice
Hello, hope everything is okay. I think someone might have dealt with a similar issue I'm having. Basically I wanna do the following: I have a list such [6,19,19,21,21,21] (FYI this is the item of a certain key in the dictionary) And I need to convert it to a list of 32 elements (meaning days

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Dirk T. Verbeek" wrote in message news:56f03080$0$5924$e4fe5...@news.xs4all.nl... > Op 21-03-16 om 17:51 schreef Adam: >> "Adam" wrote in message >> news:ncikss$tks$1...@news.albasani.net... >>> >>> Host OS:Ubuntu Desktop 14.04 LTS / Unity >>> >>> System crashed while using PyCharm / Pytho

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Mark Lawrence
On 21/03/2016 17:31, BartC wrote: (While I here, something that came up yesterday: why hasn't Python fixed the bug it seems to have inherited from C, where: a << b + c is evaluated as 'a << (b+c)'? That cost me half an hour to sort out! << and >> scale numbers just like * and /, so should h

WConio won't install in Python 3.4

2016-03-21 Thread David Lemper
Recently returned to Python after four years. Installed version 3.4.4 and attempted to install WConio in my Windows 8.1 system Gonnerman's website has WConio-1.5.1.win32-py3.3.exe & WConio-1.5.1.win32-py3.5.exe , but no py3.4 ( ? ) Tried to install each of the above. Both failed giving s

Re: empty clause of for loops

2016-03-21 Thread Rob Gaddi
Sven R. Kunze wrote: > On 16.03.2016 16:02, Tim Chase wrote: >> On 2016-03-16 15:29, Sven R. Kunze wrote: >>> I would re-use the "for-else" for this. Everything I thought I >>> could make use of the "-else" clause, I was disappointed I couldn't. >> Hmm...this must be a mind-set thing. I use the "

Re: Why do you use python?

2016-03-21 Thread sohcahtoa82
On Saturday, October 31, 2009 at 12:11:02 AM UTC-7, sk wrote: > What would be your answer if this question is asked to you in an > interview? > > a modified version might be: > "Where would you use python over C/C++/Java?" > > (because my resume says I know C/C++/Java)? I use Python when speed o

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Adam" wrote in message news:ncp8r1$ofd$1...@news.albasani.net... > > "Adam" wrote in message > news:ncikss$tks$1...@news.albasani.net... >> >> Host OS:Ubuntu Desktop 14.04 LTS / Unity >> >> System crashed while using PyCharm / Python3. >> Booting takes forever and stuck at the purple scre

Re: Static caching property

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 10:54 AM, Chris Angelico wrote: > On Tue, Mar 22, 2016 at 3:49 AM, Joseph L. Casale > wrote: >> Right, but _private refers to an api call that is expensive and may not even >> be accessed, >> so while I may new up three instances of Test across a, b and c, if none of >>

Re: Static caching property

2016-03-21 Thread Ethan Furman
On 03/21/2016 10:03 AM, Joseph L. Casale wrote: One solution is to use descriptor protocol on the class, which means using a metaclass. I'm not sure it's the best option, but it is an option. I will look at that, I wonder if however I am not over complicating it: class Foo: _bar = None

Re: Static caching property

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 10:36 AM, Steven D'Aprano wrote: > On Tue, 22 Mar 2016 03:15 am, Ian Kelly wrote: >> Why not do the same thing but using a class attribute instead of an >> instance attribute? > > Properties don't work when called from a class: Properties specifically do not, but descripto

Re: crash while using PyCharm / Python3

2016-03-21 Thread Dirk T. Verbeek
Op 21-03-16 om 17:51 schreef Adam: "Adam" wrote in message news:ncikss$tks$1...@news.albasani.net... Host OS:Ubuntu Desktop 14.04 LTS / Unity System crashed while using PyCharm / Python3. Booting takes forever and stuck at the purple screen with the Ubuntu logo and the five dots cycling.

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 12:34, BartC wrote: On 21/03/2016 02:21, Terry Reedy wrote: Of course you can. But you cannot write in a crippled Python subset and fairly claim that the result represents idiomatic Python code. For Python I would have used a table of 0..255 functions, indexed by the ord() cod

Re: Scipy2016: call for proposals

2016-03-21 Thread Nelle Varoquaux
I'm terribly sorry about this second email. The deadline for submitting talks and posters for scipy 2016 is this friday (friday 25th), and not next friday (april fools day). Thanks, Nelle On 21 March 2016 at 15:32, Nelle Varoquaux wrote: > Dear all, > > This is a quick reminder that the deadlin

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 12:59, Chris Angelico wrote: On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: For Python I would have used a table of 0..255 functions, indexed by the ord() code of each character. So all 52 letter codes map to the same name-handling function. (No Dict is needed at this point.) O

Re: Static caching property

2016-03-21 Thread Joseph L. Casale
> One solution is to use descriptor protocol on the class, which means > using a metaclass. I'm not sure it's the best option, but it is an > option. I will look at that, I wonder if however I am not over complicating it: class Foo: _bar = None @property def expensive(self): i

Re: crash while using PyCharm / Python3

2016-03-21 Thread Adam
"Adam" wrote in message news:ncikss$tks$1...@news.albasani.net... > > Host OS:Ubuntu Desktop 14.04 LTS / Unity > > System crashed while using PyCharm / Python3. > Booting takes forever and stuck at the purple screen with > the Ubuntu logo and the five dots cycling. > How to fix? > So, I tri

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 16:30, Steven D'Aprano wrote: On Mon, 21 Mar 2016 06:47 pm, Ben Finney wrote: Steven D'Aprano writes: On Monday 21 March 2016 13:11, Ben Finney wrote: Please, stop making assertions about Python code until you have learned Python. I don't see how "I don't have a clue about e

Re: Static caching property

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 3:49 AM, Joseph L. Casale wrote: > Right, but _private refers to an api call that is expensive and may not even > be accessed, > so while I may new up three instances of Test across a, b and c, if none of > those end up > accessing var x, it shouldn't get fetched. Without

Re: Static caching property

2016-03-21 Thread Joseph L. Casale
> I think Joseph is using "static" in the Java sense of being associated with > the class rather than an instance. (In Java, members of classes must be > known at compile-time.) Yup, so a single value on the class itself, not instance specific. > But what you can do is have the property refer to

Re: Static caching property

2016-03-21 Thread Steven D'Aprano
On Tue, 22 Mar 2016 03:15 am, Ian Kelly wrote: > On Mon, Mar 21, 2016 at 9:38 AM, Joseph L. Casale > wrote: >> With non static properties, you can use a decorator that overwrites the >> method on the instance with an attribute containing the methods return >> effectively caching it. > > Can you

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Steven D'Aprano
On Mon, 21 Mar 2016 06:47 pm, Ben Finney wrote: > Steven D'Aprano writes: > >> On Monday 21 March 2016 13:11, Ben Finney wrote: >> > Please, stop making assertions about Python code until you have >> > learned Python. >> >> I don't see how "I don't have a clue about exceptions" is an assertion >

Re: Static caching property

2016-03-21 Thread Ian Kelly
On Mon, Mar 21, 2016 at 9:38 AM, Joseph L. Casale wrote: > With non static properties, you can use a decorator that overwrites the > method on the instance with an attribute containing the methods return > effectively caching it. Can you give an example of what you mean? > What technique for a s

Re: Python boilerplate

2016-03-21 Thread Chris Warrick
On 21 March 2016 at 00:36, Fernando Felix do Nascimento Junior wrote: > I made the boilerplate with intent that everyone can understand, download and > use quickly. So, I didn't put extra dependence like cookiecutter (that > depends jinja, that depends markupsafe) to **just** replace fields and

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 12:48 AM, Steven D'Aprano wrote: > On Mon, 21 Mar 2016 11:59 pm, Chris Angelico wrote: > >> On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: >>> For Python I would have used a table of 0..255 functions, indexed by the >>> ord() code of each character. So all 52 letter codes

Static caching property

2016-03-21 Thread Joseph L. Casale
With non static properties, you can use a decorator that overwrites the method on the instance with an attribute containing the methods return effectively caching it. What technique for a static property can be used to accomplish what the descriptor protocol does? I need to cache the results of a

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Rustom Mody
On Monday, March 21, 2016 at 7:19:03 PM UTC+5:30, Steven D'Aprano wrote: > On Mon, 21 Mar 2016 11:59 pm, Chris Angelico wrote: > > > On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: > >> For Python I would have used a table of 0..255 functions, indexed by the > >> ord() code of each character. So a

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Steven D'Aprano
On Mon, 21 Mar 2016 11:34 pm, BartC wrote: > On 21/03/2016 02:21, Terry Reedy wrote: >> On 3/20/2016 9:15 PM, BartC wrote: >>> http://pastebin.com/dtM8WnFZ >>> This is a test of a character-at-a-time task in Python; >> >> I disagree. It tests of C code re-written in ludicrously crippled >> Python

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Steven D'Aprano
On Tue, 22 Mar 2016 01:04 am, Random832 wrote: > On Mon, Mar 21, 2016, at 09:48, Steven D'Aprano wrote: >> Pardon me, do I understand you correctly? You're saying that the C parser >> is >> Unicode-aware and allows you to use Unicode in C source code? > > Er, "the" C parser? > > In the C standar

Re: Scipy2016: call for proposals

2016-03-21 Thread Nelle Varoquaux
Dear all, This is a quick reminder that the deadline for submitting talks and posters proposal is next friday. Thanks, Nelle On 22 February 2016 at 10:15, Nelle Varoquaux wrote: > > Dear all, > > SciPy 2016, the Fifteenth Annual Conference on Python in Science, takes > place in Austin, TX on J

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Random832
On Mon, Mar 21, 2016, at 09:48, Steven D'Aprano wrote: > Pardon me, do I understand you correctly? You're saying that the C parser > is > Unicode-aware and allows you to use Unicode in C source code? Er, "the" C parser? In the C standard, the source character set is implementation-defined, and is

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Steven D'Aprano
On Mon, 21 Mar 2016 11:59 pm, Chris Angelico wrote: > On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: >> For Python I would have used a table of 0..255 functions, indexed by the >> ord() code of each character. So all 52 letter codes map to the same >> name-handling function. (No Dict is needed at

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread MRAB
On 2016-03-21 12:59, Chris Angelico wrote: On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: For Python I would have used a table of 0..255 functions, indexed by the ord() code of each character. So all 52 letter codes map to the same name-handling function. (No Dict is needed at this point.) O

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ned Batchelder
On Monday, March 21, 2016 at 8:44:01 AM UTC-4, BartC wrote: > On 21/03/2016 12:08, Ned Batchelder wrote: > > On Sunday, March 20, 2016 at 9:15:32 PM UTC-4, BartC wrote: > >> > >> A tokeniser along those lines in Python, with most of the bits filled > >> in, is here: > >> > >> http://pastebin.com/dt

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Mark Lawrence
On 21/03/2016 12:59, Chris Angelico wrote: On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: For Python I would have used a table of 0..255 functions, indexed by the ord() code of each character. So all 52 letter codes map to the same name-handling function. (No Dict is needed at this point.) O

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Rustom Mody
On Monday, March 21, 2016 at 6:04:28 PM UTC+5:30, BartC wrote: > On 21/03/2016 02:21, Terry Reedy wrote: > > On 3/20/2016 9:15 PM, BartC wrote: > >> http://pastebin.com/dtM8WnFZ > >> This is a test of a character-at-a-time task in Python; > > > > I disagree. It tests of C code re-written in ludicr

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Chris Angelico
On Mon, Mar 21, 2016 at 11:34 PM, BartC wrote: > For Python I would have used a table of 0..255 functions, indexed by the > ord() code of each character. So all 52 letter codes map to the same > name-handling function. (No Dict is needed at this point.) > Once again, you forget that there are not

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 12:08, Ned Batchelder wrote: On Sunday, March 20, 2016 at 9:15:32 PM UTC-4, BartC wrote: A tokeniser along those lines in Python, with most of the bits filled in, is here: http://pastebin.com/dtM8WnFZ Bart, we get it: you don't like the trade-offs that Python has made. ... Y

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread BartC
On 21/03/2016 02:21, Terry Reedy wrote: On 3/20/2016 9:15 PM, BartC wrote: http://pastebin.com/dtM8WnFZ This is a test of a character-at-a-time task in Python; I disagree. It tests of C code re-written in ludicrously crippled Python. No use of the re module, You can't use the re module for

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ned Batchelder
On Sunday, March 20, 2016 at 9:15:32 PM UTC-4, BartC wrote: > > A tokeniser along those lines in Python, with most of the bits filled > in, is here: > > http://pastebin.com/dtM8WnFZ > Bart, we get it: you don't like the trade-offs that Python has made. You want Python to be faster, but it can'

Re: Using SSL socket as stdin for subprocess.Popen

2016-03-21 Thread Chris Angelico
On Sun, Mar 20, 2016 at 4:44 AM, Matt Ruffalo wrote: > Hi all- > > I'm writing a backup client for automating the synchronization of btrfs > snapshots between machines -- essentially piping the output of `btrfs > send` on my laptop/desktop to `btrfs receive` on a server. I've been > doing this man

Using SSL socket as stdin for subprocess.Popen

2016-03-21 Thread Matt Ruffalo
Hi all- I'm writing a backup client for automating the synchronization of btrfs snapshots between machines -- essentially piping the output of `btrfs send` on my laptop/desktop to `btrfs receive` on a server. I've been doing this manually for quite a while, and something automated would be much mo

Re: Python boilerplate

2016-03-21 Thread Sam
On 03/19/2016 07:43 AM, Fernando Felix do Nascimento Junior wrote: A simple boilerplate for those who don't know the structure of a project. https://goo.gl/lJRvS6 ## Features * Build and distribute with setuptools * Check code style with flake8 * Make and run tests with pytest * Run tests on e

need help With understanding

2016-03-21 Thread mohamed mohamud
hey im new at Learning Python, and i have an issue which i would like som help With. i have currently installed Python, and im Reading this book which tells me i have to have IDLE, but i cant find it on my computer. do i need to install it? and if so where do/can i find it.? -- https://mail

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ben Finney
Steven D'Aprano writes: > On Monday 21 March 2016 13:11, Ben Finney wrote: > > Please, stop making assertions about Python code until you have > > learned Python. > > I don't see how "I don't have a clue about exceptions" is an assertion > about Python code. That's not the assertion. I'm asking

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Marko Rauhamaa
Chris Angelico : > Given that the exact same issue was pointed out the last time he > posted a version of this code, I have less sympathy and more snark. I > completely understand that not everyone understands what's idiomatic > Python code; but when something is pointed out as a deadly > anti-pat

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Chris Angelico
On Mon, Mar 21, 2016 at 5:38 PM, Steven D'Aprano wrote: > On Monday 21 March 2016 12:35, Chris Angelico wrote: > >> On Mon, Mar 21, 2016 at 12:28 PM, Mark Lawrence >> wrote: >>> I got to line 22, saw the bare except, and promptly gave up. >> >> Oh, keep going, Mark. It gets better. > [...] >> So,

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Rustom Mody
On Monday, March 21, 2016 at 12:11:19 PM UTC+5:30, Steven D'Aprano wrote: > On Monday 21 March 2016 13:11, Ben Finney wrote: > > > BartC writes: > > > >> I don't have a clue about exceptions > > > > Please, stop making assertions about Python code until you have learned > > Python. > > > I don

  1   2   >