Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread 88888 Dihedral
Chris Angelico於 2013年5月7日星期二UTC+8下午9時32分55秒寫道: > On Tue, May 7, 2013 at 11:22 PM, jmfauth wrote: > > > There are plenty of good reasons to use Python. There are > > > also plenty of good reasons to not use (or now to drop) > > > Python and to realize that if you wish to process text > > > seri

Re: Append to python List

2013-05-09 Thread 88888 Dihedral
Jussi Piitulainen於 2013年5月9日星期四UTC+8下午2時55分20秒寫道: > RAHUL RAJ writes: > > > > > Checkout the following code: > > > > > > sample2 = [x+y for x in range(1,10) for y in range(1,10) if x!=y] > > > output=[] > > > output=[x for x in sample2 if x not in output] > > > > > > the output I get

Re: Append to python List

2013-05-10 Thread 88888 Dihedral
Jussi Piitulainen於 2013年5月9日星期四UTC+8下午7時30分05秒寫道: > 88888 Dihedral writes: > > > > > This is just the handy style for a non-critical loop. > > > In a critical loop, the number of the total operation counts > > > does matter in the execution speed. >

Re: Append to python List

2013-05-11 Thread 88888 Dihedral
Chris Angelico於 2013年5月12日星期日UTC+8上午12時00分44秒寫道: > On Sun, May 12, 2013 at 1:47 AM, Anssi Saari wrote: > > > Chris Angelico writes: > > > > > >> On Thu, May 9, 2013 at 9:30 PM, Jussi Piitulainen > > >> wrote: > > >>> 8 Dihe

Re: Python's sad, unimaginative Enum

2013-05-14 Thread 88888 Dihedral
Chris Angelico於 2013年5月14日星期二UTC+8上午1時36分34秒寫道: > On Mon, May 13, 2013 at 8:17 PM, Steven D'Aprano > > wrote: > > > Let's look at his major criticisms: > > > > > > 1) values aren't automatically generated. > > > > > > True. So what? That is the *least* important part of enums. > > > > I s

Re: Python C-API: how to define nested classes?

2013-05-16 Thread 88888 Dihedral
Serge WEINSTOCK於 2013年5月16日星期四UTC+8下午4時55分07秒寫道: > Hi, > >   > > I'm currently writing a C extension module for python using the "raw" C-API. > I would like to be able to define "nested classes" like in the following > python code > >   > >

Re: Back-end Python Developer Seeking Telecommute Work

2013-05-17 Thread 88888 Dihedral
Rob Sutton於 2013年5月18日星期六UTC+8上午2時36分07秒寫道: > I am seeking part/full time work as a back-end Python developer (telecommute > or Utah only). I have been maintaining a > Debian/Python/Django/Apache/PostgreSQL/PHP/MySql web application for 3 years > on my own. I do all the development, database a

Re: How to write fast into a file in python?

2013-05-18 Thread 88888 Dihedral
Steven D'Aprano於 2013年5月18日星期六UTC+8下午12時01分13秒寫道: > On Fri, 17 May 2013 21:18:15 +0300, Carlos Nepomuceno wrote: > > > > > I thought there would be a call to format method by "'%d\n' % i". It > > > seems the % operator is a lot faster than format. I just stopped using > > > it because I read i

Re: Python for philosophers

2013-05-18 Thread 88888 Dihedral
Chris Angelico於 2013年5月14日星期二UTC+8上午12時24分44秒寫道: > On Tue, May 14, 2013 at 12:53 AM, rusi wrote: > > > int fact(int n, int acc) > > > { > > > return !n? acc : fact(n-1,acc*n); > > > } > > > - > > > When I run these, the C happily keeps giving answers until a

Re: Python for philosophers

2013-05-18 Thread 88888 Dihedral
Chris Angelico於 2013年5月19日星期日UTC+8上午8時04分45秒寫道: > On Sun, May 19, 2013 at 9:56 AM, 88888 Dihedral > > wrote: > > > Hey, ChisA, are you delibrately to write a recursive version > > > to demonstrate the stack depth problem in Python? > > > > > >

Re: Please help with Threading

2013-05-20 Thread 88888 Dihedral
Chris Angelico於 2013年5月20日星期一UTC+8下午5時09分13秒寫道: > On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote: > > > _lock = Lock() > > > > > > def lprint(*a, **kw): > > > global _lock > > > with _lock: > > > print(*a, **kw) > > > > > > and use lprint() everywhere? > > > >

Re: @staticmethods called more than once

2013-05-21 Thread 88888 Dihedral
Ethan Furman於 2013年5月22日星期三UTC+8上午12時30分22秒寫道: > On 05/21/2013 08:39 AM, Skip Montanaro wrote: > > > Don't confuse the use of "static" in Python with its use in C/C++. From a > > post on StackOverflow: > > > > > > A staticmethod is a method that knows nothing about the class or > > instan

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年5月22日星期三UTC+8上午11時38分45秒寫道: > > > From: steve+comp.lang.pyt...@pearwood.info > > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > Date: Wed, 22 May 2013 03:08:54 + > > To: python-list@python.org > [...] > >> So,

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年5月22日星期三UTC+8上午2時49分28秒寫道: > > > From: alyssonbr...@gmail.com > > Date: Tue, 21 May 2013 09:03:13 -0300 > > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > To: python-list@python.org > > > > This work in 3.1+: > >

Re: Future standard GUI library

2013-05-28 Thread 88888 Dihedral
Chris Angelico於 2013年5月28日星期二UTC+8下午3時11分55秒寫道: > On Tue, May 28, 2013 at 9:10 AM, Roy Smith wrote: > > > In article , > > > Chris Angelico wrote: > > > > > >> I'll use XML when I have to, but if I'm inventing my own protocol, > > >> nope. There are just too many quirks with it. How do you

Re: Python #ifdef

2013-05-28 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年5月29日星期三UTC+8上午3時46分37秒寫道: > Are there Python 'preprocessor directives'? > > I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a > single file. > > Is that possible? How? Use execfile(filename) at the beginning to get what you want. The .pyc ver

Re: Future standard GUI library

2013-05-28 Thread 88888 Dihedral
Grant Edwards於 2013年5月29日星期三UTC+8上午2時25分08秒寫道: > On 2013-05-28, Wolfgang Keller wrote: > > > > > Actually productive work of significant intensity at a computer screen. > > > > Oh. You mean emacs. > > > > -- > > Grant Edwards grant.b.edwardsYow! Will it improve my

Re: Short-circuit Logic

2013-05-30 Thread 88888 Dihedral
Steven D'Aprano於 2013年5月30日星期四UTC+8上午10時28分57秒寫道: > On Wed, 29 May 2013 10:50:47 -0600, Ian Kelly wrote: > > > > > On Wed, May 29, 2013 at 8:33 AM, rusi wrote: > > >> 0.0 == 0.0 implies 5.4 == 5.4 > > >> is not a true statement is what (I think) Steven is saying. 0 (or if > > >> you prefer 0

Re: Python Magazine

2013-06-01 Thread 88888 Dihedral
Steven D'Aprano於 2013年5月26日星期日UTC+8上午11時50分31秒寫道: > On Sat, 25 May 2013 21:54:43 -0400, Roy Smith wrote: > > > > > Of course not every IPv6 endpoint will be able to talk to every other > > > IPv6 endpoint, even if the both have globally unique addresses. But, > > > the access controls will be

Re: Listing modules from all installed packages

2013-06-09 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年6月9日星期日UTC+8下午1時23分15秒寫道: > print '\n'.join([re.findall("from '(.*)'",str(v))[0] for k,v in > sys.modules.items() if str(v).find('from')>-1]) > > > > > Date: Sat, 8 Jun 2013 21:30:48 -0700 > > Subject: Listing modules from all installed packages > > From: jph...@gmail.co

Re: Default Value

2013-06-20 Thread 88888 Dihedral
rusi於 2013年6月21日星期五UTC+8上午1時12分01秒寫道: > You know Rick, you are good at python, you are better at polemics. > > If only you would cut the crap I would (be able to) agree with you. > > See below > > > > On Jun 20, 7:49 pm, Rick Johnson wrote: > > > On Thursday, June 20, 2013 7:57:06 AM UTC-5,

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-26 Thread 88888 Dihedral
Michael Torrie於 2013年6月20日星期四UTC+8下午2時01分11秒寫道: > > But since the LISP never really got a form beyond S-expressions, > > leaving us with lots of parenthesis everywhere, Python wins much as the > > Hitchhiker's Guide to the Galaxy wins. Yep, a list is mutable even it's empty. But constant integ

Re: FACTS: WHY THE PYTHON LANGUAGE FAILS.

2013-06-28 Thread 88888 Dihedral
Jason Friedman於 2013年6月28日星期五UTC+8上午11時52分33秒寫道: > > I was hoping to have a good laugh. :| > > > > > > > Although I wouldn't call it hostile. > > > > I think the python community is being educated in how to spam and troll at > the same time. > > > > It is possible the OP has a mental di

Re: Problems with subclassing enum34

2013-06-28 Thread 88888 Dihedral
Thomas Heller於 2013年6月28日星期五UTC+8下午6時48分38秒寫道: > trying out the enum34 module. > > > > What I want to create is a subclass of enum.Enum that is also > > based on ctypes.c_int so that I can better use enum instances > > in ctypes api calls. > > > > When I do this, I get a metaclass conflict:

Re: Stupid ways to spell simple code

2013-07-01 Thread 88888 Dihedral
Steven D'Aprano於 2013年7月2日星期二UTC+8上午6時09分18秒寫道: > On Mon, 01 Jul 2013 20:36:29 +0100, Marcin Szamotulski wrote: > > > > > Here is another example which I came across when playing with > > > generators, the first function is actually quite useful, the second > > > generator is the whole fun: >

Re: ANN: psutil 1.0.0 released

2013-07-11 Thread 88888 Dihedral
Giampaolo Rodola'於 2013年7月11日星期四UTC+8下午11時02分01秒寫道: > > Congratulations on the 1.0.0 release! > > > > Thanks a lot. =) > > > > > Btw. any change you can put up a prebuilt installer for a 64-bit built > > > with Python 3.3? You have one for Python 3.2 > > > (http://code.google.com/p/psutil

Re: RE Module Performance

2013-07-14 Thread 88888 Dihedral
On Saturday, July 13, 2013 1:37:46 PM UTC+8, Steven D'Aprano wrote: > On Fri, 12 Jul 2013 13:58:29 -0400, Devyn Collier Johnson wrote: > > > > > I plan to spend some time optimizing the re.py module for Unix systems. > > > I would love to amp up my programs that use that module. > > > > In m

Re: RE Module Performance

2013-07-18 Thread 88888 Dihedral
Devyn Collier Johnson於 2013年7月16日星期二UTC+8下午6時30分33秒寫道: > Am 07/12/2013 07:16 PM, schrieb MRAB: > > > On 12/07/2013 23:16, Tim Delaney wrote: > > >> On 13 July 2013 03:58, Devyn Collier Johnson > >> > wrote: > > >> > > >> > > >> Thanks for the thorough resp

Re: Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-22 Thread 88888 Dihedral
Albert van der Horst於 2012年6月22日星期五UTC+8下午11時53分01秒寫道: > In article , > Kevin Walzer wrote: > >On 6/11/12 8:01 AM, Wolfgang Keller wrote: > >> Tkinter is imho honestly the very best "argument" if you want to make > >> potential new users turn their backs away from Python for good. Just > >> show

Re: lambda in list comprehension acting funny

2012-07-11 Thread 88888 Dihedral
On Thursday, July 12, 2012 12:34:33 AM UTC+8, Ian wrote: > On Wed, Jul 11, 2012 at 4:28 AM, Colin J. Williams wrote: > > I don't understand why you would expect 1, 2, 4. > > Because: > > funcs[0](2) == 2 ** 0 == 1 > funcs[1](2) == 2 ** 1 == 2 > funcs[2](2) == 2 ** 2 == 4 > > > Perh

Re: lambda in list comprehension acting funny

2012-07-11 Thread 88888 Dihedral
On Thursday, July 12, 2012 11:51:04 AM UTC+8, Steven D'Aprano wrote: > On Wed, 11 Jul 2012 20:39:45 -0700, 8 Dihedral wrote: > > > I'll contribute my way of python programming: > > > > def powerb(x, b): # > > return x**b > > Here's a

Re: lambda in list comprehension acting funny

2012-07-14 Thread 88888 Dihedral
Alister於 2012年7月12日星期四UTC+8下午5時44分15秒寫道: > On Wed, 11 Jul 2012 08:43:11 +0200, Daniel Fetchinson wrote: > > >> funcs = [ lambda x: x**i for i in range( 5 ) ] > >> print funcs[0]( 2 ) > >> print funcs[1]( 2 ) > >> print funcs[2]( 2 ) > >> > >> This gives me > >> > >> 16 16 16 > >> > >> When I was e

Re: Diagramming code

2012-07-17 Thread 88888 Dihedral
Chris Rebert於 2012年7月16日星期一UTC+8上午9時38分53秒寫道: > On Sun, Jul 15, 2012 at 6:26 PM, hamilton wrote: > > Subject: Diagramming code > > > > Is there any software to help understand python code ? > > What sort of diagrams? Control flow diagrams? Class diagrams? Sequence > diagrams

Re: reloading code and multiprocessing

2012-07-19 Thread 88888 Dihedral
andrea crotti於 2012年7月19日星期四UTC+8下午6時15分11秒寫道: > We need to be able to reload code on a live system. This live system > has a daemon process always running but it runs many subprocesses with > multiprocessing, and the subprocesses might have a short life... > > Now I found a way to reload the cod

Re: Basic question about speed/coding style/memory

2012-07-23 Thread 88888 Dihedral
Jan Riechers於 2012年7月21日星期六UTC+8下午3時33分27秒寫道: > Hello Pythonlist, > > I have one very basic question about speed,memory friendly coding, and > coding style of the following easy "if"-statement in Python 2.7, > but Im > sure its also the same in Python 3.x > > Block > #-

Re: Basic question about speed/coding style/memory

2012-07-23 Thread 88888 Dihedral
Chris Angelico於 2012年7月21日星期六UTC+8下午5時04分12秒寫道: > On Sat, Jul 21, 2012 at 5:33 PM, Jan Riechers > wrote: > > Block > > #-- > > if statemente_true: > > doSomething() > > else: > > doSomethingElseInstead() > > > > #--

Re: Linux shell to python

2012-07-31 Thread 88888 Dihedral
Mark Lawrence於 2012年7月31日星期二UTC+8下午3時15分32秒寫道: > On 31/07/2012 02:20, Dennis Lee Bieber wrote: > > > On Mon, 30 Jul 2012 22:56:48 +, Dan Stromberg > > > declaimed the following in gmane.comp.python.general: > > > > > > > > >> Sigh, and I'm also not keen on multi-line list comprehensions,

Re: [newbie] String to binary conversion

2012-08-07 Thread 88888 Dihedral
Steven D'Aprano於 2012年8月7日星期二UTC+8上午10時01分05秒寫道: > On Mon, 06 Aug 2012 22:46:38 +0200, Mok-Kong Shen wrote: > > > > > If I have a string "abcd" then, with 8-bit encoding of each character, > > > there is a corresponding 32-bit binary integer. How could I best obtain > > > that integer and from

Re: looking for a neat solution to a nested loop problem

2012-08-07 Thread 88888 Dihedral
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道: > On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote: > > > > >> for i in range(N,N+100): > > >> for j in range(M,M+100): > > >> do_something(i % 100 ,j % 100) > > >> > > >> Emile > > > > > > How about... > > > >

Re: looking for a neat solution to a nested loop problem

2012-08-09 Thread 88888 Dihedral
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道: > On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote: > > > > >> for i in range(N,N+100): > > >> for j in range(M,M+100): > > >> do_something(i % 100 ,j % 100) > > >> > > >> Emile > > > > > > How about... > > > >

Re: looking for a neat solution to a nested loop problem

2012-08-09 Thread 88888 Dihedral
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道: > On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote: > > > > >> for i in range(N,N+100): > > >> for j in range(M,M+100): > > >> do_something(i % 100 ,j % 100) > > >> > > >> Emile > > > > > > How about... > > > >

Re: save dictionary to a file without brackets.

2012-08-09 Thread 88888 Dihedral
Andrew Cooper於 2012年8月10日星期五UTC+8上午6時03分26秒寫道: > On 09/08/2012 22:34, Roman Vashkevich wrote: > > > Actually, they are different. > > > Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred > > thousand entries, and you will feel the difference. > > > Dict uses hashing to get a

Re: save dictionary to a file without brackets.

2012-08-10 Thread 88888 Dihedral
Dave Angel於 2012年8月10日星期五UTC+8上午5時47分45秒寫道: > On 08/09/2012 05:34 PM, Roman Vashkevich wrote: > > > Actually, they are different. > > > Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred > > thousand entries, and you will feel the difference. > > > Dict uses hashing to get a

Re: save dictionary to a file without brackets.

2012-08-12 Thread 88888 Dihedral
Steven D'Aprano於 2012年8月11日星期六UTC+8下午7時26分37秒寫道: > On Fri, 10 Aug 2012 08:53:43 +1000, Chris Angelico wrote: > > > > > On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote: > > >> On 08/09/2012 06:03 PM, Andrew Cooper wrote: > > >>> O(n) for all other entries in the dict which suffer a hash coll

Re: looking for a neat solution to a nested loop problem

2012-08-14 Thread 88888 Dihedral
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道: > On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote: > > > > >> for i in range(N,N+100): > > >> for j in range(M,M+100): > > >> do_something(i % 100 ,j % 100) > > >> > > >> Emile > > > > > > How about... > > > >

Re: New image and color management library for Python 2+3

2012-08-15 Thread 88888 Dihedral
Christian Heimes於 2012年8月15日星期三UTC+8上午2時22分54秒寫道: > Hello fellow Pythonistas, > > > > I'm looking for co-developers, testers, documentation writers and users > > for a new image library I created. The code is available at > > https://bitbucket.org/tiran/smc.freeimage > > > > > > Backgroun

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread 88888 Dihedral
On Monday, August 20, 2012 1:03:34 AM UTC+8, Blind Anagram wrote: > "Steven D'Aprano" wrote in message > > news:502f8a2a$0$29978$c3e8da3$54964...@news.astraweb.com... > > > > On Sat, 18 Aug 2012 01:09:26 -0700, wxjmfauth wrote: > > > > [...] > > If you can consistently replicate a 100% to

Re: Why doesn't Python remember the initial directory?

2012-08-19 Thread 88888 Dihedral
On Monday, August 20, 2012 4:42:16 AM UTC+8, kj wrote: > As far as I've been able to determine, Python does not remember > > (immutably, that is) the working directory at the program's start-up, > > or, if it does, it does not officially expose this information. > > > > Does anyone know why th

Re: Abuse of Big Oh notation

2012-08-20 Thread 88888 Dihedral
Paul Rubin於 2012年8月21日星期二UTC+8上午3時29分12秒寫道: > Ian Kelly writes: > > > The difference between the two is that the former is bounded by a > > > constant that is fundamental to the algorithm at hand,... S is > > > clearly bounded by the constraints of actual shoes, so we can safely > > > treat S

Re: Abuse of Big Oh notation

2012-08-20 Thread 88888 Dihedral
Paul Rubin於 2012年8月21日星期二UTC+8上午3時29分12秒寫道: > Ian Kelly writes: > > > The difference between the two is that the former is bounded by a > > > constant that is fundamental to the algorithm at hand,... S is > > > clearly bounded by the constraints of actual shoes, so we can safely > > > treat S

Re: Objects in Python

2012-08-25 Thread 88888 Dihedral
Jan Kuiken於 2012年8月24日星期五UTC+8上午2時02分00秒寫道: > On 8/23/12 06:11 , Steven D'Aprano wrote: > > > > >> 2) Related to the above, you can infinitely nest scopes. There's nothing > > >> wrong with having six variables called 'q'; you always use the innermost > > >> one. Yes, this can hurt readability

Re: Unittest - testing for filenames and filesize

2012-08-31 Thread 88888 Dihedral
On Saturday, September 1, 2012 12:19:10 AM UTC+8, Chris Withers wrote: > On 23/08/2012 12:25, Tigerstyle wrote: > > > class FileTest(unittest.TestCase): > > > > > > def setUp(self): > > > self.origdir = os.getcwd() > > > self.dirname = tempfile.mkdtemp("testdir") > > >

Re: set and dict iteration

2012-09-10 Thread 88888 Dihedral
Paul Rubin於 2012年8月17日星期五UTC+8上午9時01分39秒寫道: > Ian Kelly writes: > > > With regard to key insertion and deletion while iterating over a dict > > > or set, though, there is just no good reason to be doing that > > > (especially as the result is very implementation-specific), and I > > > wouldn't

Re: Python presentations

2012-09-13 Thread 88888 Dihedral
mblume於 2012年9月14日星期五UTC+8上午12時26分17秒寫道: > Am Thu, 13 Sep 2012 17:00:19 +0100 schrieb andrea crotti: > > > > > > I have to give a couple of Python presentations in the next weeks, and > > > I'm still thinking what is the best approach. > > > > > My idea for an introductory presentation of pyt

Re: Python presentations

2012-09-13 Thread 88888 Dihedral
Chris Angelico於 2012年9月14日星期五UTC+8上午6時39分25秒寫道: > On Fri, Sep 14, 2012 at 8:33 AM, Alexander Blinne wrote: > > > On 13.09.2012 21:01, 88888 Dihedral wrote: > > >> def powerlist(x, n): > > >> # n is a natural number > > >> result=[]

Re: Decorators not worth the effort

2012-09-14 Thread 88888 Dihedral
Chris Angelico於 2012年9月14日星期五UTC+8下午10時41分06秒寫道: > On Sat, Sep 15, 2012 at 12:12 AM, andrea crotti > > wrote: > > > def fib(n): > > > if n <= 1: > > > return 1 > > > return fib(n-1) + fib(n-2) > > > > > > @memoize > > > def fib_memoized(n): > > > if n <= 1: > > >

Re: Decorators not worth the effort

2012-09-15 Thread 88888 Dihedral
Steven D'Aprano於 2012年9月15日星期六UTC+8上午7時39分28秒寫道: > On Fri, 14 Sep 2012 15:16:47 -0600, Ian Kelly wrote: > > > > > If only there were a conceptually simpler way to do this. Actually, > > > there is. I give you: metadecorators! > > [code snipped but shown below] > > > Which I think is certain

Re: Decorators not worth the effort

2012-09-15 Thread 88888 Dihedral
David Hutto於 2012年9月15日星期六UTC+8下午6時04分28秒寫道: > On Sat, Sep 15, 2012 at 5:45 AM, 88888 Dihedral > > wrote: > > > Steven D'Aprano於 2012年9月15日星期六UTC+8上午7時39分28秒寫道: > > >> On Fri, 14 Sep 2012 15:16:47 -0600, Ian Kelly wrote: > > >> > > &

Re: Python garbage collector/memory manager behaving strangely

2012-09-16 Thread 88888 Dihedral
alex23於 2012年9月17日星期一UTC+8上午11時25分06秒寫道: > On Sep 17, 12:32 pm, "Jadhav, Alok" > > wrote: > > > - As you have seen, the line separator is not '\n' but its '|\n'. > > > Sometimes the data itself has '\n' characters in the middle of the line > > > and only way to find true end of the line is tha

Re: Decorators not worth the effort

2012-09-18 Thread 88888 Dihedral
Chris Angelico於 2012年9月18日星期二UTC+8下午9時25分04秒寫道: > On Tue, Sep 18, 2012 at 11:19 PM, Neil Cerutti wrote: > > > On 2012-09-14, Chris Angelico wrote: > > >> But then again, who actually ever needs fibonacci numbers? > > > > > > If it should happen that your question is not facetious: > > > > >

Re: Decorators not worth the effort

2012-09-18 Thread 88888 Dihedral
Terry Reedy於 2012年9月15日星期六UTC+8上午4時40分32秒寫道: > 2nd try, hit send button by mistake before > > > > On 9/14/2012 5:28 AM, Jean-Michel Pichavant wrote: > > > > > Decorators are very popular so I kinda already know that the fault is > > > mine. Now to the reason why I have troubles writing them,

Re: Python presentations

2012-09-19 Thread 88888 Dihedral
andrea crotti於 2012年9月20日星期四UTC+8上午12時42分50秒寫道: > 2012/9/19 Trent Nelson : > > > > > > FWIW, I gave a presentation on decorators to the New York Python > > > User Group back in 2008. Relevant blog post: > > > > > > http://blogs.onresolve.com/?p=48 > > > > > > There's a l

Re: Functional way to compare things inside a list

2012-09-21 Thread 88888 Dihedral
Ulrich Eckhardt於 2012年9月21日星期五UTC+8下午5時15分03秒寫道: > Am 21.09.2012 00:58, schrieb thorso...@lavabit.com: > > > list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] > > > > > > I want to check for a value (e.g. '4'), and get the key of the dictionary > > > that contains that value. > > > > Note: >

Re: [Q] How to exec code object with local variables specified?

2012-09-21 Thread 88888 Dihedral
Makoto Kuwata於 2012年9月20日星期四UTC+8下午7時27分40秒寫道: > Hi, > > > > Is it possible to run code object with local variables specified? > > I'm trying the following code but not work: > > > > def fn(): > >x = 1 > >y = 2 > > localvars = {'x': 0} > > exec(fn.func_code, g

Re: Functional way to compare things inside a list

2012-09-21 Thread 88888 Dihedral
A Ian於 2012年9月22日星期六UTC+8上午4時50分49秒寫道: > On Fri, Sep 21, 2012 at 1:54 PM, 88888 Dihedral > > wrote: > > > I don't think functional aspects are only marked as lazy > > > programming. > > > > He wrote "lazy evaluation", not &

Re: technologies synergistic with Python

2012-09-21 Thread 88888 Dihedral
i Rodrick Brown於 2012年9月22日星期六UTC+8上午6時33分59秒寫道: > On Sep 21, 2012, at 5:59 PM, Ethan Furman wrote: > > > > > Greetings! > > > > > > What is the consensus... okay, okay -- what are some wide ranging opinions > > on technologies that I should know if my dream job is one that consists > > m

Re: Functional way to compare things inside a list

2012-09-21 Thread 88888 Dihedral
Ian於 2012年9月22日星期六UTC+8下午2時23分43秒寫道: > On Fri, Sep 21, 2012 at 7:25 PM, Steven D'Aprano > > wrote: > > > On Fri, 21 Sep 2012 14:49:55 -0600, Ian Kelly wrote: > > > > > >> On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral > > >> wrote: &

Re: Blue Screen Python

2012-09-22 Thread 88888 Dihedral
Dave Angel於 2012年9月22日星期六UTC+8下午7時44分54秒寫道: > On 09/22/2012 06:53 AM, Alister wrote: > > > On Fri, 21 Sep 2012 18:47:57 -0400, Dave Angel wrote: > > > > > >> > > >> > > >> That's not true at all. You'd re thinking of Windows 3, Windows 95, 98, > > >> and ME, which were hacked on top of MSDO

Re: Blue Screen Python

2012-09-23 Thread 88888 Dihedral
Chris Angelico於 2012年9月22日星期六UTC+8下午10時10分12秒寫道: > On Sat, Sep 22, 2012 at 11:07 PM, Steven D'Aprano > > wrote: > > > As per their partnership agreement, IBM took over development of OS/2 > > > version 2 while Microsoft worked on developing version 3. OS/2 2.0 was > > > significantly improved

Re: write to a file two dict()

2012-09-23 Thread 88888 Dihedral
giuseppe...@gmail.com於 2012年9月24日星期一UTC+8上午1時44分30秒寫道: > Hi > > Have two dict() of the same length and i want print them to a common file. > > > > > > a={1: 1, 2: 2, 3: 3} > > b={1: 11, 2: 22, 3: 33} > > > > in order to obtain > > > > 1 1 1 11 > > 2 2 2 22 > > 3 3 3 33 > > > > I

Re: Does python have built command for package skeleton creation?

2012-09-24 Thread 88888 Dihedral
xliiv於 2012年9月21日星期五UTC+8下午9時13分38秒寫道: > On Friday, September 21, 2012 3:04:02 PM UTC+2, Tarek Ziadé wrote: > > > On 9/21/12 2:14 PM, xliiv wrote: > > > > > > > > > > > > > > Python Paste is probably what you are looking for - see > > > > > > > > > > > > > > http://lucasmanual.com/mywi

Re: Java singletonMap in Python

2012-09-24 Thread 88888 Dihedral
Duncan Booth於 2012年9月25日星期二UTC+8上午1時33分31秒寫道: > Steven D'Aprano wrote: > > > > > On Mon, 24 Sep 2012 00:14:23 +0100, Mark Lawrence wrote: > > > > > >> Purely for fun I've been porting some code to Python and came across > > >> the singletonMap[1]. I'm aware that there are loads of recipes

Re: How to limit CPU usage in Python

2012-09-25 Thread 88888 Dihedral
DPalao於 2012年9月25日星期二UTC+8下午11時13分54秒寫道: > 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 > >

Re: Article on the future of Python

2012-09-25 Thread 88888 Dihedral
Grant Edwards於 2012年9月26日星期三UTC+8上午2時25分31秒寫道: > 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

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-26 Thread 88888 Dihedral
TP於 2012年9月27日星期四UTC+8上午5時25分04秒寫道: > Hi everybody, > > > > I have tried, naively, to do the following, so as to make lists quickly: > > > > >>> a=[0]*2 > > >>> a > > [0, 0] > > >>> a[0]=3 > > >>> a > > [3, 0] > > > > All is working fine, so I extended the technique to do: > > > >

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-26 Thread 88888 Dihedral
Paul Rubin於 2012年9月27日星期四UTC+8上午5時43分58秒寫道: > TP writes: > > > copies a list, he copies in fact the *pointer* to the list > > > Is it the correct explanation? > > > > Yes, that is correct. > > > > > In these conditions, how to make this list [[0,0,0],[0,0,0]] with "*" > > > without

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-26 Thread 88888 Dihedral
8 Dihedral於 2012年9月27日星期四UTC+8上午6時07分35秒寫道: > Paul Rubin於 2012年9月27日星期四UTC+8上午5時43分58秒寫道: > > > TP writes: > > > > > > > copies a list, he copies in fact the *pointer* to the list > > > > > > > Is it the correct explanatio

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-26 Thread 88888 Dihedral
Tim Chase於 2012年9月27日星期四UTC+8上午6時44分42秒寫道: > On 09/26/12 17:28, 88888 Dihedral wrote: > > > 88888 Dihedral於 2012年9月27日星期四UTC+8上午6時07分35秒寫道: > > >>>> In these conditions, how to make this list [[0,0,0],[0,0,0]] with "*" > > >>>> without

Re: Algorithms using Python?

2012-09-27 Thread 88888 Dihedral
Wayne Werner於 2012年9月27日星期四UTC+8上午12時05分31秒寫道: > On Fri, 21 Sep 2012, Dennis Lee Bieber wrote: > > > > > On Fri, 21 Sep 2012 14:26:04 +0530, Mayuresh Kathe > > > declaimed the following in gmane.comp.python.general: > > > > > >> Is there a good book on foundational as well as advanced algori

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-27 Thread 88888 Dihedral
Tim Chase於 2012年9月27日星期四UTC+8上午6時44分42秒寫道: > On 09/26/12 17:28, 88888 Dihedral wrote: > > > 88888 Dihedral於 2012年9月27日星期四UTC+8上午6時07分35秒寫道: > > >>>> In these conditions, how to make this list [[0,0,0],[0,0,0]] with "*" > > >>>> without

Re: Python source code easy to hack?

2012-09-28 Thread 88888 Dihedral
Jayden於 2012年9月28日星期五UTC+8下午7時57分14秒寫道: > Dear All, > > > > I have a concern in developing commercial code with Python. Someone told me > that its program can be easily hacked to get its source code. Is it really > the case? Any way to protect your source code? > > > > Thanks a lot! > > >

Re: creating an artificial "last element" in sort list

2012-09-28 Thread 88888 Dihedral
dave於 2012年9月29日星期六UTC+8上午7時51分10秒寫道: > more clearer, this is a more realistic use case: > > > > ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', > 'zz'] > > > > and the quantity of ''zz'' would be dynamic. > > > > On Friday, September 28, 2

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-29 Thread 88888 Dihedral
On Saturday, September 29, 2012 9:46:22 PM UTC+8, Ramchandra Apte wrote: > On Thursday, 27 September 2012 04:14:42 UTC+5:30, Tim Chase wrote: > > > On 09/26/12 17:28, 88888 Dihedral wrote: > > > > > > > 8 Dihedral於 2012年9月27日星期四UTC+8上午6時07分35秒寫道: >

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-29 Thread 88888 Dihedral
On Sunday, September 30, 2012 1:19:22 AM UTC+8, Ian wrote: > On Sat, Sep 29, 2012 at 11:01 AM, 88888 Dihedral > > wrote: > > > > > > Don't you get it why I avoided the lambda one liner as a functon. > > > > > > I prefer the def way with a na

Re: Slicing iterables in sub-generators without loosing elements

2012-09-30 Thread 88888 Dihedral
On Sunday, September 30, 2012 12:15:57 AM UTC+8, Thomas Bach wrote: > Hi, > > > > say we have the following: > > > > >>> data = [('foo', 1), ('foo', 2), ('bar', 3), ('bar', 2)] > > > > is there a way to code a function iter_in_blocks such that > > > > >>> result = [ list(block) for bloc

Re: parse an environment file

2012-10-01 Thread 88888 Dihedral
On Monday, October 1, 2012 10:42:02 PM UTC+8, Chris Angelico wrote: > On Tue, Oct 2, 2012 at 12:37 AM, Jason Friedman wrote: > > >> Is there a reason to use that format, rather than using Python > > >> notation? I've at times made config files that simply get imported. > > >> Instead of a dicti

Re: Slicing iterables in sub-generators without loosing elements

2012-10-02 Thread 88888 Dihedral
On Monday, October 1, 2012 4:17:50 PM UTC+8, Mark Lawrence wrote: > On 01/10/2012 01:58, 88888 Dihedral wrote: > > > > > > Your question seems vague to me. If you know you are storing > > > only immutable tuples in a list, then the way to iterate is simple. >

Re: Slicing iterables in sub-generators without loosing elements

2012-10-02 Thread 88888 Dihedral
Steven D'Aprano於 2012年10月3日星期三UTC+8上午8時57分20秒寫道: > On Wed, 03 Oct 2012 03:58:02 +1000, Chris Angelico wrote: > > > > > Dihedral might be a bot and might not. I've come to the conclusion that > > > it's not worth trying to find out, given that a good bot can outdo a lot > > > of humans in usefu

Re: Slicing iterables in sub-generators without loosing elements

2012-10-02 Thread 88888 Dihedral
Steven D'Aprano於 2012年10月3日星期三UTC+8上午9時24分13秒寫道: > On Tue, 02 Oct 2012 18:11:20 -0700, 8 Dihedral wrote: > > > > > Steven D'Aprano於 2012年10月3日星期三UTC+8上午8時57分20秒寫道: > > > > >> Oh, I'm convinced that it's a bot. > > >> Th

Re: Combinations of lists

2012-10-03 Thread 88888 Dihedral
Oscar Benjamin於 2012年10月4日星期四UTC+8上午4時29分51秒寫道: > Oscar wrote: > > >>> def uniquecombinations(h, m): > > >>> for ha in submultisets(h, len(h)//2): > > >>> hb = list(h) > > >>> for c in ha: > > >>> hb.remove(c) > > >>> yield [m[0] + a for a in ha] + [m[1

Re: Combinations of lists

2012-10-04 Thread 88888 Dihedral
> > for combination in first_combinations: > > > yield [sletter+combination[0], sletter+combination[1]] > > > else: > > > for combination in first_combinations: > > > first_ = first[:] > > > first_.remove(combination[0]) > > > first

Re: notmm is dead!

2012-10-05 Thread 88888 Dihedral
Prasad, Ramit於 2012年10月6日星期六UTC+8上午4時06分31秒寫道: > Steven D'Aprano wrote: > > > Sent: Thursday, October 04, 2012 7:22 PM > > > To: python-list@python.org > > > Subject: Re: notmm is dead! > > > > > > On Thu, 04 Oct 2012 14:10:46 -0400, Etienne Robillard wrote: > > > > > > > Dear list, > > >

Re: write binary with struct.pack_into

2012-10-05 Thread 88888 Dihedral
palmeira於 2012年10月6日星期六UTC+8上午11時27分47秒寫道: > Dear pythonists, > > > > I'm having a problem with read/write binary in python. > > I have a binary file that I need to read information, extract a array, > > modify this array and put these values into file again in same binary > > format. > > I

Re: Problems building Python from hg trunk on Open SUSE

2012-10-07 Thread 88888 Dihedral
Skip Montanaro於 2012年10月6日星期六UTC+8上午8時25分06秒寫道: > I haven't messed around with Python 3 recently, so decided to give it > > a whirl again. I cloned the trunk (cpython) and set about it. This > > is on an OpenSUSE 12.1 system. I configured like so: > > > > ./configure --prefix=/home/skipm/

Re: Private methods

2012-10-10 Thread 88888 Dihedral
D.M. Procida於 2012年10月9日星期二UTC+8下午9時24分30秒寫道: > What exactly is the point of a private method? Why or when would I want > Private methods in the object level are searched first in the run time of python interpreter. I did turn some private methods in to c programs from time to time. --

Re: Checking for dlls in ctypes

2012-10-13 Thread 88888 Dihedral
Wanderer於 2012年10月12日星期五UTC+8下午11時36分27秒寫道: > I'm trying to write some code that will load one of three dll depending on > the one available. I've tried the code below, but it doesn't work. The try > except doesn't catch the exception. Is there a way to do this? > > > > try: > >

Re: overriding equals operation

2012-10-16 Thread 88888 Dihedral
Pradipto Banerjee於 2012年10月16日星期二UTC+8下午9時59分05秒寫道: > I am trying to define class, where if I use a statement a = b, then instead > of "a" pointing to the same instance as "b", it should point to a copy of > "b", but I can't get it right. > > > > Currently, I have the following: > > > > ---

Re: list comprehension question

2012-10-17 Thread 88888 Dihedral
Dave Angel於 2012年10月17日星期三UTC+8下午10時37分01秒寫道: > On 10/17/2012 10:06 AM, rusi wrote: > > > On Oct 17, 5:33 pm, Dave Angel wrote: > > >> On 10/17/2012 12:43 AM, Kevin Anthony wrote:> Is it not true that list > >> comprehension is much faster the the for loops? > > >> > > >>> If it is not the co

Re: list comprehension question

2012-10-17 Thread 88888 Dihedral
rusi於 2012年10月17日星期三UTC+8下午10時50分11秒寫道: > On Oct 17, 7:37 pm, Dave Angel wrote: > > > > > And I'd wager all the improvement is in the inner loop, the dot() function. > > > > Sorry -- red herring! > > > > Changing > > > > def mm1(a,b): return [[sum(x*y for x,y in zip(ra,rb)) for rb in >

Re: Remove uncide notation

2012-10-19 Thread 88888 Dihedral
Ashish Jain於 2012年10月18日星期四UTC+8下午5時27分04秒寫道: > Hi, > > > > I have a html string in an object, when I do repr() of that object, I get > value as: > > > > {'Id' : 1, 'Body': u' Hello '} > > > > I don't wish to have 'u' as the character in my string representation. As > this is not a valid

  1   2   3   >