Re: Rule of order for dot operators?

2015-05-16 Thread Rustom Mody
On Sunday, May 17, 2015 at 7:15:13 AM UTC+5:30, Steven D'Aprano wrote: > On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: > > > C.D. Reimer wrote: > > > > Who? > > Don't be a dick, Thomas. Lots of people use their initials. You use your > nickname as part of your sender address

Re: How to deploy a custom common module?

2015-05-16 Thread Irmen de Jong
On 17-5-2015 4:06, Jason Friedman wrote: >> When I deploy test.py on another computer, I put (rsync) both test.py and >> cmn_funcs.py in the same remote directory. >> >> If I create another python project (test2.py) in new directory, that needs >> common functions, what should I do with cmn_funcs

Re: How to deploy a custom common module?

2015-05-16 Thread Jason Friedman
> When I deploy test.py on another computer, I put (rsync) both test.py and > cmn_funcs.py in the same remote directory. > > If I create another python project (test2.py) in new directory, that needs > common functions, what should I do with cmn_funcs.py? I put my shared code in a separate folde

Re: Rule of order for dot operators?

2015-05-16 Thread Steven D'Aprano
On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: > C.D. Reimer wrote: > > Who? Don't be a dick, Thomas. Lots of people use their initials. You use your nickname as part of your sender address, why are you questioning somebody for using their initials? >> Noobie > > What? Wh

Re: Rule of order for dot operators?

2015-05-16 Thread Steven D'Aprano
On Sun, 17 May 2015 05:20 am, C.D. Reimer wrote: > Greetings, > > Noobie question regarding a single line of code that transforms a URL > slug ("this-is-a-slug") into a title ("This Is A Slug"). > > title = slug.replace('-',' ').title() > > This line also works if I switched the dot operators a

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Denis McMahon
On Sat, 16 May 2015 06:28:19 -0700, bruceg113355 wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n 002 : some hexadecimal text > ... \n 003 : some hexadecimal text ... \n ... > 010 : some hexadeci

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Cameron Simpson
On 16May2015 10:35, bruceg113...@gmail.com wrote: On Saturday, May 16, 2015 at 12:59:19 PM UTC-4, Chris Angelico wrote: On Sun, May 17, 2015 at 2:22 AM, wrote: > # Original Approach > # - > ss = ss.split("\n") > ss1 = "" > for sdata in ss: > ss1 = ss1 + (sdata[OFFSET:] + "

Re: Building CPython

2015-05-16 Thread Marko Rauhamaa
Marko Rauhamaa : > Ok, here's a quick port that have barely tried out: And here's a more complete port (with some possible dunder abuse): ### Simple OO Framework class _O: pass def make_object(*procedures, base=None, base

Re: Rule of order for dot operators?

2015-05-16 Thread Tim Chase
On 2015-05-16 12:20, C.D. Reimer wrote: > Does python perform the dot operators from left to right or > according to a rule of order (i.e., multiplication/division before > add/subtract)? Yes, Python evaluates dot-operators from left to right. -tkc -- https://mail.python.org/mailman/listinfo/p

Re: Rule of order for dot operators?

2015-05-16 Thread C.D. Reimer
On 5/16/2015 12:34 PM, Peter Otten wrote: You can find out yourself by using operations where the order does matter: "Test".upper().lower() I was wondering about that and couldn't think of an example off the top of my head. Thank you, Chris Reimer -- https://mail.python.org/mailman/listinf

Re: Rule of order for dot operators?

2015-05-16 Thread C.D. Reimer
On 5/16/2015 12:40 PM, Thomas 'PointedEars' Lahn wrote: However, for greater efficiency, in general you should call .replace() in such a way that the length of the string it operates on is minimized. For example, if feasible, always slice *before* .replace(). Slice was how I got the slug from

Re: Rule of order for dot operators?

2015-05-16 Thread Thomas 'PointedEars' Lahn
C.D. Reimer wrote: Who? > Noobie What? > question regarding a single line of code that transforms a URL > slug ("this-is-a-slug") into a title ("This Is A Slug"). > > title = slug.replace('-',' ').title() > > This line also works if I switched the dot operators around. > > title = slug.t

Re: Rule of order for dot operators?

2015-05-16 Thread Peter Otten
C.D. Reimer wrote: > Greetings, > > Noobie question regarding a single line of code that transforms a URL > slug ("this-is-a-slug") into a title ("This Is A Slug"). > > title = slug.replace('-',' ').title() > > This line also works if I switched the dot operators around. > > title = slug.title

Re: Rule of order for dot operators?

2015-05-16 Thread Joel Goldstick
On Sat, May 16, 2015 at 3:20 PM, C.D. Reimer wrote: > Greetings, > > Noobie question regarding a single line of code that transforms a URL slug > ("this-is-a-slug") into a title ("This Is A Slug"). > > title = slug.replace('-',' ').title() > > This line also works if I switched the dot operators a

Re: Rule of order for dot operators?

2015-05-16 Thread Gary Herron
On 05/16/2015 12:20 PM, C.D. Reimer wrote: Greetings, Noobie question regarding a single line of code that transforms a URL slug ("this-is-a-slug") into a title ("This Is A Slug"). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title = slu

Rule of order for dot operators?

2015-05-16 Thread C.D. Reimer
Greetings, Noobie question regarding a single line of code that transforms a URL slug ("this-is-a-slug") into a title ("This Is A Slug"). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title = slug.title().replace('-',' ') I'm reading the

Re: Building CPython

2015-05-16 Thread Marko Rauhamaa
Steven D'Aprano : > On Sat, 16 May 2015 11:59 pm, Marko Rauhamaa wrote: >> supports multiple inheritance without classes. Maybe I should port that >> to Python... > > I'd like to see it, but somehow I don't think that your "Scheme object > system" is another name for "closures". We were talking ab

Re: Building CPython

2015-05-16 Thread Steven D'Aprano
On Sat, 16 May 2015 11:59 pm, Marko Rauhamaa wrote: > Steven D'Aprano : > >> A couple more negatives: >> >> - no such thing as inheritance; > > Untrue. My simple Scheme object system (125 lines incl. documentation) Ah yes, I've seen Javascript code like that too. Each line is thirty thousand ch

Re: Secret code in Ex Machina

2015-05-16 Thread David H. Lipman
From: "Seymore4Head" http://www.reddit.com/r/movies/comments/365f9b/secret_code_in_ex_machina/ LOL - It is like an Easter Egg in a movie. C O O L ! -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp -- https://mail.python.org/mai

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 12:59:19 PM UTC-4, Chris Angelico wrote: > On Sun, May 17, 2015 at 2:22 AM, wrote: > > # Original Approach > > # - > > ss = ss.split("\n") > > ss1 = "" > > for sdata in ss: > > ss1 = ss1 + (sdata[OFFSET:] + "\n") > > > > > > # Chris's Approach > >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Chris Angelico
On Sun, May 17, 2015 at 2:22 AM, wrote: > # Original Approach > # - > ss = ss.split("\n") > ss1 = "" > for sdata in ss: > ss1 = ss1 + (sdata[OFFSET:] + "\n") > > > # Chris's Approach > # > lines = ss.split("\n") > new_text = "\n".join(line[8:] for line in line

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Irmen de Jong
On 16-5-2015 18:24, bruceg113...@gmail.com wrote: > Data is coming from a wxPython TextCtrl widget. Hm, there should be a better source of the data before it ends up in the textctrl widget. > The widget is displaying data received on a serial port for a user to analyze. If this is read from a s

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Ian Kelly
On Sat, May 16, 2015 at 10:22 AM, wrote: > # Chris's Approach > # > lines = ss.split("\n") > new_text = "\n".join(line[8:] for line in lines) Looks like the approach you have may be fast enough already, but I'd wager the generator expression could be replaced with: map(oper

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 11:13:45 AM UTC-4, Rustom Mody wrote: > On Saturday, May 16, 2015 at 8:30:02 PM UTC+5:30, Grant Edwards wrote: > > On 2015-05-16, bruceg113355 wrote: > > > > > I have a string that contains 10 million characters. > > > > > > The string is formatted as: > > > > > > "000

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 10:06:31 AM UTC-4, Stefan Ram wrote: > bruceg113...@gmail.com writes: > >Your approach using .join is what I was looking for. > > I'd appreciate a report of your measurements. # Original Approach # - ss = ss.split("\n") ss1 = "" for sdata in ss:

Secret code in Ex Machina

2015-05-16 Thread Seymore4Head
http://www.reddit.com/r/movies/comments/365f9b/secret_code_in_ex_machina/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Rustom Mody
On Saturday, May 16, 2015 at 8:30:02 PM UTC+5:30, Grant Edwards wrote: > On 2015-05-16, bruceg113355 wrote: > > > I have a string that contains 10 million characters. > > > > The string is formatted as: > > > > "001 : some hexadecimal text ... \n > > 002 : some hexadecimal text ... \n > >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Grant Edwards
On 2015-05-16, bruceg113...@gmail.com wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n > 002 : some hexadecimal text ... \n > 003 : some hexadecimal text ... \n > ... > 010 : some hexadecimal text

EuroPython 2015: Come with your partners

2015-05-16 Thread M.-A. Lemburg
We are happy to announce the official EuroPython Partner Program for EuroPython 2015 in Bilbao: *** EuroPython 2015 Partner Program *** https://ep2015.europython.eu/en/events/partner-program/ There is plenty to see in and around Bilbao. We have worked out a set of interesting

Re: Minimising stack trace

2015-05-16 Thread Cecil Westerhof
Op Friday 15 May 2015 20:17 CEST schreef Cecil Westerhof: > While playing with recursion I get: > RuntimeError: maximum recursion depth exceeded in comparison > > But then I get a very long stack trace. Is there a way to make this > a lot shorter. Now I ‘lose’ interesting information because of th

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 9:46:17 AM UTC-4, Chris Angelico wrote: > On Sat, May 16, 2015 at 11:28 PM, wrote: > > I have a string that contains 10 million characters. > > > > The string is formatted as: > > > > "001 : some hexadecimal text ... \n > > 002 : some hexadecimal text ... \n >

Re: Building CPython

2015-05-16 Thread Marko Rauhamaa
Steven D'Aprano : > A couple more negatives: > > - no such thing as inheritance; Untrue. My simple Scheme object system (125 lines incl. documentation) supports multiple inheritance without classes. Maybe I should port that to Python... > - "is-a" relationship tests don't work; >From the duckty

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Chris Angelico
On Sat, May 16, 2015 at 11:28 PM, wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n > 002 : some hexadecimal text ... \n > 003 : some hexadecimal text ... \n > ... > 010 : some hexadecimal text ...

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Joel Goldstick
On Sat, May 16, 2015 at 9:28 AM, wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n > 002 : some hexadecimal text ... \n > 003 : some hexadecimal text ... \n > ... > 010 : some hexadecimal text ...

Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
I have a string that contains 10 million characters. The string is formatted as: "001 : some hexadecimal text ... \n 002 : some hexadecimal text ... \n 003 : some hexadecimal text ... \n ... 010 : some hexadecimal text ... \n 011 : some hexadecimal text ... \n" and I need the

Re: Building CPython

2015-05-16 Thread Steven D'Aprano
On Sat, 16 May 2015 06:08 pm, Marko Rauhamaa wrote: > Note that almost identical semantics could be achieved without a class. > Thus, these two constructs are almost identical: [...] > IOW, the class is a virtually superfluous concept in Python. Python has > gotten it probably without much though

Re: Building CPython

2015-05-16 Thread Marko Rauhamaa
BartC : > I suppose in many cases an object will have no attributes of its own, > and so it can rapidly bypass the first lookup. Almost all objects have quite many instance attributes. That's what tells objects apart. > I don't understand the need for an object creation (to represent A.B > so th

Re: Minimising stack trace

2015-05-16 Thread Cecil Westerhof
Op Friday 15 May 2015 21:04 CEST schreef Ned Batchelder: > On Friday, May 15, 2015 at 2:50:12 PM UTC-4, Cecil Westerhof wrote: >> While playing with recursion I get: >> RuntimeError: maximum recursion depth exceeded in comparison >> >> But then I get a very long stack trace. Is there a way to make