Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-25 Thread 88888 Dihedral
x = [[1, 2], [3, 4]] for x in x: ... for x in x: ... print(x) This is valid in the syntax level in python. But it is only good for those writing obscure programs in my opinions at most team works. -- https://mail.python.org/mailman/listinfo/python-list

Re: CallBack function in C Libraries.

2014-03-20 Thread 88888 Dihedral
On Friday, March 21, 2014 7:56:43 AM UTC+8, fiens...@gmail.com wrote: Give the function call its required argument and the error will go away... well, at least that one. Yep, many thanks for the answer. But... im totally beginner with Python. I develop in Pascal and C and

Re: How security holes happen

2014-03-05 Thread 88888 Dihedral
On Wednesday, March 5, 2014 8:52:31 AM UTC+8, Andrew Cooper wrote: On 03/03/2014 22:19, Cameron Simpson wrote: On 03Mar2014 09:17, Neal Becker ndbeck...@gmail.com wrote: Charles R Harris charlesr.har...@gmail.com Wrote in message: Imo the lesson here is never write in low

Re: Python programming

2014-03-05 Thread 88888 Dihedral
On Thursday, February 13, 2014 11:30:27 PM UTC+8, Neil Cerutti wrote: On 2014-02-12, Tim Delaney timothy.c.dela...@gmail.com wrote: OK - it's degenerated into one of these threads - I'm going to participate. Me, too! I wrote lots of programs, strictly for fun, on every

Re: Functional programming

2014-03-03 Thread 88888 Dihedral
On Monday, March 3, 2014 10:08:11 PM UTC+8, Rustom Mody wrote: On Monday, March 3, 2014 7:30:17 PM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody wrote: ? [1,2] + [[3,4],[5]] ERROR: Type error in application *** expression : [1,2] + [[3,4],[5]]

Re: Can tuples be replaced with lists all the time?

2014-02-23 Thread 88888 Dihedral
On Sunday, February 23, 2014 12:06:13 PM UTC+8, Sam wrote: My understanding of Python tuples is that they are like immutable lists. If this is the cause, why can't we replace tuples with lists all the time (just don't reassign the lists)? Correct me if I am wrong. == OK, lets be serious

Re: Commonly-used names in the Python standard library

2014-02-21 Thread 88888 Dihedral
On Friday, February 21, 2014 12:26:00 AM UTC+8, Marko Rauhamaa wrote: Chris Angelico ros...@gmail.com: Also, what happens if two modules (one of which might be your script) written for different versions both import some third module? Should they get different versions, based on

Re: Calculator Problem

2014-02-05 Thread 88888 Dihedral
On Monday, February 3, 2014 5:16:44 AM UTC+8, Charlie Winn wrote: Hey Guys i Need Help , When i run this program i get the 'None' Under the program, see what i mean by just running it , can someone help me fix this def Addition(): print('Addition: What are two your numbers?')

Re: Using a static library in a C extension for Python

2014-01-23 Thread 88888 Dihedral
On Thursday, January 23, 2014 3:22:52 AM UTC+8, lgabiot wrote: Le 22/01/14 18:31, 8 Dihedral a écrit : Check the C source code generated by Pyrex and check cython for what u want, but I did try that out in any mobile phone or flat panel programming

Re: SIngleton from __defaults__

2014-01-22 Thread 88888 Dihedral
On Thursday, January 23, 2014 12:37:36 AM UTC+8, Asaf Las wrote: On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote: On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las r@gmail.com wrote: Why not simply: def get_singleton(x = SomeClass()): return x Or

Re: Using a static library in a C extension for Python

2014-01-22 Thread 88888 Dihedral
On Wednesday, January 22, 2014 7:01:50 PM UTC+8, lgabiot wrote: Hello, working on OS X 10.8.5 Python 2.7 I've written a simple C extension for Python that uses the cairo graphic library. It works well, and I can call it from Python with no problem. The only drawback is

Re: Editor for Python

2014-01-08 Thread 88888 Dihedral
On Friday, November 23, 2001 6:43:40 AM UTC+8, MANUEL FERNANDEZ PEREZ wrote: Hello, I'm looking for an editor for Python.I' m interested it works on Windows.Can anybody help me? Thank you Manuel OK, try the notepad++ at notepad-plus-plus.org/ or use IDLE with the pycrust. --

Re: Newbie question. Are those different objects ?

2013-12-20 Thread 88888 Dihedral
On Saturday, December 21, 2013 1:10:37 AM UTC+8, rusi wrote: On Friday, December 20, 2013 9:30:22 PM UTC+5:30, Mark Lawrence wrote: On 20/12/2013 15:34, rusi wrote: On Friday, December 20, 2013 8:46:31 PM UTC+5:30, dec...@msn.com wrote: y = raw_input('Enter a number:') print

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-18 Thread 88888 Dihedral
Roy Smith於 2013年12月19日星期四UTC+8下午12時16分26秒寫道: In article 07c6e6a3-c5f4-4846-9551-434bdaba8...@googlegroups.com, rusi rustompm...@gmail.com wrote: Soon the foo has to split into foo1.c and foo2.c. And suddenly you need to understand: 1. Separate compilation 2. Make

Re: [newbie] trying socket as a replacement for nc

2013-12-18 Thread 88888 Dihedral
8 Dihedral dihedral88...@gmail.com wrote: It is trivial to use UDP with forward error correction such as the CD in 1982. CD uses Reed-Solomon coding, which is great for correcting the types of errors expected on a CD. Namely, bursts of bit errors caused

Re: Need Help with the BeautifulSoup problem, please

2013-12-16 Thread 88888 Dihedral
On Monday, December 16, 2013 2:41:08 PM UTC+8, seas...@gmail.com wrote: I need to replace all tag b with span after ■. But the result from below is '■ span style=REPLACED/span / font/font' Can you explain what I did wrong, please. s = '■bA/b bB/b bC/b bD/b / font/font'

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread 88888 Dihedral
On Friday, December 13, 2013 5:58:49 AM UTC+8, Chris Angelico wrote: On Fri, Dec 13, 2013 at 8:27 AM, Dan Stromberg drsali...@gmail.com wrote: On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards invalid@invalid.invalid wrote: Sockets reserve the right to split one socket.send() into

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread 88888 Dihedral
On Saturday, December 14, 2013 8:12:16 PM UTC+8, Jai wrote: GUI:-want to learn GUI programming in python , how should i proceed. There are lots of book here so I am confuse which book i should refer so that i don't waste time . please answer Please check JYTHON and those

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread 88888 Dihedral
On Sunday, November 10, 2013 4:56:38 PM UTC+8, Jorgen Grahn wrote: On Sun, 2013-11-10, Chris Angelico wrote: On Sun, Nov 10, 2013 at 11:41 AM, Roy Smith r...@panix.com wrote: On 09/11/2013 22:58, Chris Angelico wrote: * Some languages are just fundamentally bad. I do not

Re: Basic Python Questions - Oct. 31, 2013

2013-11-07 Thread 88888 Dihedral
On Tuesday, November 5, 2013 1:22:05 PM UTC+8, E.D.G. wrote: Jim Gibson jimsgib...@gmail.com wrote in message news:031120131018099327%jimsgib...@gmail.com... One way to generate plot within a CGI program is this: To start off with, I am not a CGI expert. Also, I have

Re: Show off your Python chops and compete with others

2013-11-07 Thread 88888 Dihedral
On Friday, November 8, 2013 3:02:10 AM UTC+8, jsk...@gmail.com wrote: We do not currently support cookieless or javascript-less browsing. We are definitely looking at relying less and less on cookies, but it's unlikely we'll ever be able to pull out javascript as it limits interactivity too

Re: Hyper-spacial ray-tracer

2013-10-05 Thread 88888 Dihedral
On Saturday, October 5, 2013 8:17:52 AM UTC+8, Rouslan Korneychuk wrote: On 10/04/2013 04:23 PM, Tony the Tiger wrote: On Wed, 02 Oct 2013 17:05:32 -0400, Rouslan Korneychuk wrote: game Sorry, but that sounds awful. I hate games. This... isn't a game or even related

Re: Tail recursion to while iteration in 2 easy steps

2013-10-04 Thread 88888 Dihedral
On Thursday, October 3, 2013 5:33:27 AM UTC+8, Terry Reedy wrote: On 10/2/2013 8:31 AM, random...@fastmail.us wrote: On Tue, Oct 1, 2013, at 17:30, Terry Reedy wrote: Part of the reason that Python does not do tail call optimization is that turning tail recursion into while iteration

Re: class implementation

2013-10-01 Thread 88888 Dihedral
On Tuesday, October 1, 2013 3:34:08 AM UTC+8, Dave Angel wrote: On 30/9/2013 08:41, markot...@gmail.com wrote: under variables, i mean, the int's and lists and strings and floats that the parent class uses. IF in parent class there is variable called location, then can i use the

Re: How to execute command on remote windows machine

2013-09-03 Thread 88888 Dihedral
gauran...@gmail.com於 2013年9月3日星期二UTC+8下午12時45分57秒寫道: Hi Guys, I have a requirement where i need to kill one process on remote windows machine. Following command just works fine if i have to kill process on local machine os.system('taskkill /f /im processName.exe')

Re: Encapsulation unpythonic?

2013-09-02 Thread 88888 Dihedral
Fabrice Pombet於 2013年8月31日星期六UTC+8上午1時43分28秒寫道: On Saturday, August 17, 2013 2:26:32 PM UTC+2, Fernando Saldanha wrote: I am new to Python, with experience in Java, C++ and R. As I understand encapsulation is not a big thing in the Python world. I read that you can put

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 devyncjohn...@gmail.com mailto:devyncjohn...@gmail.com wrote: Thanks for the thorough

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 my

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

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: from

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 disease, which is

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: 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 integers,

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 rantingrickjohn...@gmail.com wrote: On Thursday, June 20, 2013

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.com To:

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: 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 rustompm...@gmail.com 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

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 r...@panix.com wrote: In article mailman.2265.1369693294.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: I'll use XML when I have to, but if I'm inventing my own

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 version

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 felip...@gmx.net 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: 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+: $ python3

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, the only

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 instance it was

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 c...@zip.com.au wrote: _lock = Lock() def lprint(*a, **kw): global _lock with _lock: print(*a, **kw) and use lprint() everywhere? Fun little

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 it was going

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 rustompm...@gmail.com 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

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, 8 Dihedral dihedral88...@googlemail.com wrote: Hey, ChisA, are you delibrately to write a recursive version to demonstrate the stack depth problem in Python? def fact(n): ret=1

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 and

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: 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 steve+comp.lang.pyt...@pearwood.info wrote: Let's look at his major criticisms: 1) values aren't automatically generated. True. So what? That is the *least* important part of

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 a...@sci.fi wrote: Chris Angelico ros...@gmail.com writes: On Thu, May 9, 2013 at 9:30 PM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: 8 Dihedral writes

Re: Append to python List

2013-05-10 Thread 88888 Dihedral
Jussi Piitulainen於 2013年5月9日星期四UTC+8下午7時30分05秒寫道: 8 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. Do you use speed often? There is another

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 is 3 4 5 6 7 8 9 10

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 wxjmfa...@gmail.com 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

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

2013-05-05 Thread 88888 Dihedral
Steven D'Aprano於 2013年5月6日星期一UTC+8上午3時10分47秒寫道: On Sun, 05 May 2013 12:11:11 -0500, Ignoramus16992 wrote: According to CIO.com, Python programmers make only $83,000 per year, while Perl programmers make $93,000 per year.

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread 88888 Dihedral
Bradley Wright於 2013年5月6日星期一UTC+8上午8時59分15秒寫道: Hey guys and gals doing this tutorial(codecademy) and needed a bit help from the experienced. I'm writing a function that takes a list(one they supply during runtime) here's what my function is supposed to do 1. for each instance

Re: Can read in the BMP data correctly ,but the size is not right?

2013-04-29 Thread 88888 Dihedral
Jimmie He於 2013年4月30日星期二UTC+8上午1時20分49秒寫道: I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the

Re: epiphany

2013-04-28 Thread 88888 Dihedral
Roy Smith於 2013年4月25日星期四UTC+8上午7時50分33秒寫道: I discovered something really neat today. We've got a system with a bunch of rules. Each rule is a method which returns True or False. At some point, we need to know if all the rules are True. Complicating things, not all the rules are

Re: [Python-ideas] Automatic context managers

2013-04-26 Thread 88888 Dihedral
Chris Angelico於 2013年4月27日星期六UTC+8上午12時52分38秒寫道: On Sat, Apr 27, 2013 at 1:54 AM, MRAB pyt...@mrabarnett.plus.com wrote: On 26/04/2013 14:02, anatoly techtonik wrote: This circular reference problem is interesting. In object space it probably looks like a stellar detached from the

Re: Lists and arrays

2013-04-23 Thread 88888 Dihedral
Ana Dionísio於 2013年4月23日星期二UTC+8上午2時13分38秒寫道: Hello! I need your help! I have an array and I need pick some data from that array and put it in a list, for example: array= [a,b,c,1,2,3] list=array[0]+ array[3]+ array[4] list: [a,1,2] When I do it like

Re: List Count

2013-04-22 Thread 88888 Dihedral
Blind Anagram於 2013年4月22日星期一UTC+8下午7時58分20秒寫道: I would be grateful for any advice people can offer on the fastest way to count items in a sub-sequence of a large list. I have a list of boolean values that can contain many hundreds of millions of elements for which I want to count the

Re: Is Unicode support so hard...

2013-04-21 Thread 88888 Dihedral
jmfauth於 2013年4月21日星期日UTC+8上午1時12分43秒寫道: In a previous post, http://groups.google.com/group/comp.lang.python/browse_thread/thread/6aec70817705c226# , Chris “Kwpolska” Warrick wrote: “Is Unicode support so hard, especially in the 21st century?” -- Unicode is

Re: [TYPES] The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-21 Thread 88888 Dihedral
Uday S Reddy於 2013年4月17日星期三UTC+8下午5時10分58秒寫道: Mark Janssen writes: Having said that, theorists do want to unify concepts wherever possible and wherever they make sense. Imperative programming types, which I will call storage types, are semantically the same as classes.

Re: [TYPES] The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-20 Thread 88888 Dihedral
Ned Batchelder於 2013年4月20日星期六UTC+8上午12時41分03秒寫道: On 4/19/2013 12:16 PM, Steven D'Aprano wrote: On Fri, 19 Apr 2013 12:02:00 -0400, Roy Smith wrote: PS: a great C++ interview question is, What's the difference between a class and a struct? Amazing how few self-professed C++

Re: a couple of things I don't understand wrt lists

2013-04-17 Thread 88888 Dihedral
Serhiy Storchaka於 2013年4月17日星期三UTC+8下午5時35分07秒寫道: 17.04.13 07:57, Larry Hudson написав(ла): So using a list comprehension you can do it in two lines: def get_rule(num): bs = bin(num)[2:] return [0] * (8 - len(bs)) + [int(i) for i in bs] You can do it in one

Re: Atoms, Identifiers, and Primaries

2013-04-17 Thread 88888 Dihedral
Ian於 2013年4月17日星期三UTC+8下午3時21分00秒寫道: On Tue, Apr 16, 2013 at 8:57 PM, Bruce McGoveran wrote: These are terms that appear in section 5 (Expressions) of the Python online documentation. I'm having some trouble understanding what, precisely, these terms mean. I'd appreciate the

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-16 Thread 88888 Dihedral
zipher於 2013年4月15日星期一UTC+8上午11時48分05秒寫道: Hello, I'm new to the list and hoping this might be the right place to introduce something that has provoked a bit of an argument in my programming community. I'll state about my opinions about the imperative and non-imperative part. If the

Re: Threadpool item mailboxes design problem

2013-04-14 Thread 88888 Dihedral
Charles Hixson於 2013年4月15日星期一UTC+8上午7時12分11秒寫道: What is the best approach to implementing actors that accept and post messages (and have no other external contacts). So far what I've come up with is something like: actors = {} mailboxs = {} Stuff actors with actor

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread 88888 Dihedral
Steven D'Aprano於 2013年4月12日星期五UTC+8上午8時06分21秒寫道: On Thu, 11 Apr 2013 19:55:53 +, Neil Cerutti wrote: On 2013-04-11, Rob Schneider rmsc...@gmail.com wrote: Thanks. Yes, there is a close function call before the copy is launched. No other writes. Does Python wait for file close

Re: Functional vs. Object oriented API

2013-04-12 Thread 88888 Dihedral
David M Chess於 2013年4月12日星期五UTC+8下午11時37分28秒寫道: Roy Smith r...@panix.com As part of our initial interview screen, we give applicants some small coding problems to do.  One of the things we see a lot is what you could call Java code smell.  This is our clue that the person

Re: Help: pickle module unable to load rb mode files in linux

2013-04-07 Thread 88888 Dihedral
Surya Kasturi於 2013年4月2日星期二UTC+8下午10時54分25秒寫道: Hi, hope you can help me on it.. with open(pickle_f, 'r') as fhand:         obj = pickle.load(fhand) This works on linux but not in windows until  I use rb mode while creating file object. Surprisingly, the rb mode is not working

Re: Decorator help

2013-03-30 Thread 88888 Dihedral
Jason Swails於 2013年3月28日星期四UTC+8上午4時33分08秒寫道: On Wed, Mar 27, 2013 at 3:49 PM, Joseph L. Casale jca...@activenetwerx.com wrote: I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread 88888 Dihedral
Chris Angelico於 2013年3月28日星期四UTC+8上午11時40分17秒寫道: On Thu, Mar 28, 2013 at 2:18 PM, Ethan Furman et...@stoneleaf.us wrote: Has anybody else thought that [jmf's] last few responses are starting to sound bot'ish? Yes, I did wonder. It's like he and Dihedral have been trading

Re: free and nonlocal variables

2013-03-21 Thread 88888 Dihedral
bartolom...@gmail.com於 2013年3月21日星期四UTC+8下午4時52分17秒寫道: In Python 3, free variable and nonlocal variable are synonym terms? Or is there a difference, like a free variable is a variable that is not a local variable, then nonlocal variables and global variables are both free variables?

Re: [Python-ideas] Message passing syntax for objects

2013-03-18 Thread 88888 Dihedral
zipher於 2013年3月19日星期二UTC+8上午1時04分36秒寫道: On Sun, Mar 17, 2013 at 11:46 PM, Steven D'Aprano st...@pearwood.info wrote: I am very interested in this as a concept, although I must admit I'm not entirely sure what you mean by it. I've read your comment on the link above, and subsequent

Re: Finding the Min for positive and negative in python 3.3 list

2013-03-14 Thread 88888 Dihedral
Wolfgang Maier於 2013年3月13日星期三UTC+8下午6時43分38秒寫道: Steven D'Aprano steve+comp.lang.python at pearwood.info writes: On Tue, 12 Mar 2013 17:03:08 +, Norah Jones wrote: For example: a=[-15,-30,-10,1,3,5] I want to find a negative and a positive minimum.

Re: Reversing bits in a byte

2013-03-12 Thread 88888 Dihedral
Oscar Benjamin於 2013年3月12日星期二UTC+8下午11時44分50秒寫道: On 12 March 2013 14:59, Oscar Benjamin oscar.j.benja...@gmail.com wrote: Numpy and matplotlib will do what you want: import numpy as np import matplotlib.pyplot as plt def bits_to_ndarray(bits, shape): abytes =

Re: Creating an object that can track when its attributes are modified

2013-03-06 Thread 88888 Dihedral
Ben Sizer於 2013年3月7日星期四UTC+8上午12時56分09秒寫道: On Wednesday, 6 March 2013 16:22:56 UTC, Chris Angelico wrote: Effectively, you would need to have a subclass of list/dict/tuple/whatever that can respond to the change. This is certainly something I'd be interested in having, but I

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread 88888 Dihedral
On Tuesday, March 5, 2013 6:55:06 AM UTC+8, CM wrote: The main issue is that python has dynamic typing.  The type of object that is referenced by a particular name can vary, and there's no way (in general) to know at compile time what the type of object foo is. That makes

Re: Python script not working on windows 7 but works fine on linux

2013-03-04 Thread 88888 Dihedral
On Tuesday, March 5, 2013 3:20:28 AM UTC+8, ian douglas wrote: On 03/04/2013 11:06 AM, io wrote: esclusioni_file = open('/home/io/btc_trading/exclusions.txt','r') Windows error : Traceback (most recent call last): File C:\btc_trading\scripts

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread 88888 Dihedral
kramer65於 2013年3月1日星期五UTC+8上午4時25分07秒寫道: Hello, I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode?

Re: string.replace doesn't removes :

2013-02-13 Thread 88888 Dihedral
Rick Johnson於 2013年2月14日星期四UTC+8上午12時34分11秒寫道: On Wednesday, February 13, 2013 1:10:14 AM UTC-6, jmfauth wrote: d = {ord('a'): 'A', ord('b'): '2', ord('c'): 'C'} 'abcdefgabc'.translate(d) 'A2CdefgA2C' def jmTranslate(s, table): ... table = {ord(k):table[k]

Re: Simulate Keyboard keypress Delay

2013-02-13 Thread 88888 Dihedral
DaGeek247於 2013年2月14日星期四UTC+8上午3時47分36秒寫道: I am using the windows api feature getasynckeystate() to check the status of every key pressed; like this; #always checking while(True): #iterate through list of ascii codes for num in range(0,127): #if ascii code key

Re: Implicit conversion to boolean in if and while statements

2013-02-12 Thread 88888 Dihedral
Rick Johnson於 2013年2月13日星期三UTC+8上午1時48分07秒寫道: On Monday, February 11, 2013 11:55:19 PM UTC-6, Chris Angelico wrote: On Tue, Feb 12, 2013 at 12:06 PM, 8 Dihedral wrote: A permanently mutated list is a tuple of constant objects. I nominate this line as bemusing head-scratcher

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread 88888 Dihedral
Rick Johnson於 2013年2月11日星期一UTC+8下午9時13分58秒寫道: On Monday, February 11, 2013 6:40:23 AM UTC-6, Chris Angelico wrote: [...] Or doing what you were pointing and laughing at Pike for, and using two-symbol delimiters. You could even make it majorly logical: list_ = [[ 1, 2, 3 ]]

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread 88888 Dihedral
Steven D'Aprano於 2013年2月9日星期六UTC+8上午11時36分52秒寫道: Rick Johnson wrote: The solution is simple. Do not offer the copy-mutate methods and force all mutation to happen in-place: py l = [1,2,3] py l.reverse py l [3,2,1] If the user wants a mutated copy he

Re: confusion with decorators

2013-02-01 Thread 88888 Dihedral
Jason Swails於 2013年1月31日星期四UTC+8上午8時34分03秒寫道: Hello, I was having some trouble understanding decorators and inheritance and all that.  This is what I was trying to do: # untested class A(object):    def _protector_decorator(fcn):       def newfcn(self, *args, **kwargs):        

Re: Maximum Likelihood Estimation

2013-02-01 Thread 88888 Dihedral
subhaba...@gmail.com於 2013年2月2日星期六UTC+8上午1時17分04秒寫道: Dear Group, I am looking for a Python implementation of Maximum Likelihood Estimation. If any one can kindly suggest. With a google search it seems scipy,numpy,statsmodels have modules, but as I am not finding proper example

Re: Maximum Likelihood Estimation

2013-02-01 Thread 88888 Dihedral
在 2013年2月2日星期六UTC+8上午2时47分22秒,subhaba...@gmail.com写道: On Friday, February 1, 2013 11:07:48 PM UTC+5:30, 8 Dihedral wrote: subhaba...@gmail.com於 2013年2月2日星期六UTC+8上午1時17分04秒寫道: Dear Group, I am looking for a Python implementation

Re: advice, python for binary to xml

2013-02-01 Thread 88888 Dihedral
noydb於 2013年1月31日星期四UTC+8下午9時33分48秒寫道: I'm looking for knowlegde about how best to go about converting a binary file (from a GPS unit) to GPX/XML. I am completely clueless on this, so any start-from-the-beginning info would be greatly appreciated! I'm guessing the level of effort will be

Re: PyWart: Module access syntax

2013-01-12 Thread 88888 Dihedral
Chris Angelico於 2013年1月12日星期六UTC+8下午12時40分36秒寫道: On Sat, Jan 12, 2013 at 3:34 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: *The problem:* ... is readability. The current dot syntax used ubiquitously in paths is not conveying the proper information to the reader, and in-fact

Re: PyWart: Import resolution order

2013-01-12 Thread 88888 Dihedral
Ian於 2013年1月12日星期六UTC+8下午3時36分43秒寫道: On Fri, Jan 11, 2013 at 10:28 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Friday, January 11, 2013 12:30:27 AM UTC-6, Chris Angelico wrote: Why is it better to import from the current directory first? Opps. I was not explicit

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2013-01-10 Thread 88888 Dihedral
在 2013年1月10日星期四UTC+8下午7时34分23秒,Duncan Booth写道: Dave Cinege d...@cinege.com wrote: You will notice that the code is disgusting simple. However I have found that this has completely changed the way I program in python. I've re-written some exiting programs using Thesaurus, and often

Re: How to call wget by python ?

2013-01-09 Thread 88888 Dihedral
Michael Torrie於 2013年1月10日星期四UTC+8上午11時04分31秒寫道: On 01/09/2013 07:11 PM, iMath wrote: can you give me an example code ? No but I can suggest some alternative ideas, such as using httplib (built into python), or libcurl. Or if you have to use wget, you run it the same way you

Re: Python programming philosophy

2013-01-05 Thread 88888 Dihedral
chaouche yacine於 2013年1月6日星期日UTC+8上午6時34分38秒寫道: The compiler reads your source code and parses it into parse trees. This is first step. It then takes the parse trees and transform them into abstract syntax trees, which are like a DOM tree in an HTML file, and then transform that AST into a

Re: father class name

2013-01-01 Thread 88888 Dihedral
On Monday, December 31, 2012 12:18:48 PM UTC+8, contro opinion wrote: here is my haha  class class  haha(object):   def  theprint(self):     print i am here The definition of a class named haha. haha().theprint() i am here haha(object).theprint() Traceback (most recent call last):

Re: dict comprehension question.

2013-01-01 Thread 88888 Dihedral
On Tuesday, January 1, 2013 11:10:48 AM UTC+8, Steven D'Aprano wrote: On Sat, 29 Dec 2012 18:56:57 -0500, Terry Reedy wrote: On 12/29/2012 2:48 PM, Quint Rankid wrote: Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a

Re: Multi-dimensional list initialization

2012-11-08 Thread 88888 Dihedral
On Monday, November 5, 2012 3:07:12 PM UTC+8, Chris Rebert wrote: On Sun, Nov 4, 2012 at 10:27 PM, Demian Brecht demianbre...@gmail.com wrote: So, here I was thinking oh, this is a nice, easy way to initialize a 4D matrix (running 2.7.3, non-core libs not allowed): m = [[None] * 4]

Re: is implemented with id ?

2012-11-04 Thread 88888 Dihedral
On Wednesday, September 5, 2012 10:41:19 PM UTC+8, Steven D'Aprano wrote: On Wed, 05 Sep 2012 10:00:09 -0400, Dave Angel wrote: On 09/05/2012 09:19 AM, Franck Ditter wrote: Thanks to all, but : - I should have said that I work with Python 3. Does that matter ? - May I

Re: Negative array indicies and slice()

2012-11-01 Thread 88888 Dihedral
andrew...@gmail.com於 2012年10月29日星期一UTC+8上午11時12分11秒寫道: The slice operator does not give any way (I can find!) to take slices from negative to positive indexes, although the range is not empty, nor the expected indexes out of range that I am supplying. Many programs that I write would

  1   2   3   >