Re: Finding in which class an object's method comes from

2016-02-04 Thread dieter
"ast" writes: > Suppose we have: > > ClassC inherit from ClassB > ClassB inherit from ClassA > ClassA inherit from object > > Let's build an object: > > obj = ClassC() > > Let's invoke an obj method > > obj.funct() > > funct is first looked in ClassC, then if not found > on ClassB, then ClassA the

metaclass

2016-02-04 Thread ast
Hi I am looking the relationship between some classes from the enum module from enum import EnumMeta, Enum class Color(Enum): pass type(EnumMeta) EnumMeta.__bases__ (,) so EnumMeta is a metaclass, it is an instance of type and inherit from type too. type(Enum) En

Re: How this C function was called through ctypes this way?

2016-02-04 Thread jfong
eryk sun at 2016/2/4 UTC+8 7:35:17PM wrote: > > _mod = ctypes.cdll.LoadLibrary(_path) > > Calling ctypes.CDLL directly is preferable since it allows passing > parameters such as "mode" and "use_errno". > > IMO, the ctypes.cdll and ctypes.windll loaders should be avoided in > general, especially o

Re: _siftup and _siftdown implementation

2016-02-04 Thread srinivas devaki
On Feb 5, 2016 5:45 AM, "Steven D'Aprano" wrote: > > On Fri, 5 Feb 2016 07:50 am, srinivas devaki wrote: > > > _siftdown function breaks out of the loop when the current pos has a valid > > parent. > > > > but _siftup function is not implemented in that fashion, if a valid > > subheap is given to

Re: _siftup and _siftdown implementation

2016-02-04 Thread Sven R. Kunze
On 05.02.2016 01:12, Steven D'Aprano wrote: On Fri, 5 Feb 2016 07:50 am, srinivas devaki wrote: _siftdown function breaks out of the loop when the current pos has a valid parent. but _siftup function is not implemented in that fashion, if a valid subheap is given to the _siftup, it will bring

Re: _siftup and _siftdown implementation

2016-02-04 Thread Steven D'Aprano
On Fri, 5 Feb 2016 07:50 am, srinivas devaki wrote: > _siftdown function breaks out of the loop when the current pos has a valid > parent. > > but _siftup function is not implemented in that fashion, if a valid > subheap is given to the _siftup, it will bring down the root of sub heap > and then

Re: problem in installing python

2016-02-04 Thread Chris Angelico
On Thu, Feb 4, 2016 at 11:22 PM, Salony Permanand wrote: > During working on python I need urllib2 for my python version 2.7.11. > Kindly provide me address from where to download it.. > Thanking you. It should have come with Python. Try it - you should be able to just use it as-is. ChrisA -- h

_siftup and _siftdown implementation

2016-02-04 Thread srinivas devaki
_siftdown function breaks out of the loop when the current pos has a valid parent. but _siftup function is not implemented in that fashion, if a valid subheap is given to the _siftup, it will bring down the root of sub heap and then again bring it up to its original place. I was wondering why it

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Sven R. Kunze
On 04.02.2016 19:35, Random832 wrote: On Thu, Feb 4, 2016, at 11:18, Sven R. Kunze wrote: On 04.02.2016 00:47, Random832 wrote: On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll keep th

Re: Reply to whom?

2016-02-04 Thread Joel Goldstick
On Thu, Feb 4, 2016 at 12:26 AM, Ben Finney wrote: > Random832 writes: > > > On Wed, Feb 3, 2016, at 16:50, Ben Finney wrote: > > > (You will also have a “reply to all” command. That's almost never > > > appropriate in a forum like this.) > > > > Why not? People reply all to messages I write all

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Random832
On Thu, Feb 4, 2016, at 11:18, Sven R. Kunze wrote: > On 04.02.2016 00:47, Random832 wrote: > > On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: > >> Actually a nice idea if there were no overhead of creating methods for > >> all heap instances separately. I'll keep that in mind. :) > > What abo

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Sven R. Kunze
On 04.02.2016 00:47, Random832 wrote: On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll keep that in mind. :) What about changing the class of the object to one which is inherited from i

Re: How a module is being marked as imported?

2016-02-04 Thread Kevin Conway
As an attempt to answer your original question, Python doesn't explicitly mark a module as done. It does keep imports cached in sys.modules, though. The behaviour you describe where later imports get the same module object is driven by that cache. There are cases, such as cyclical imports, where t

Re: How a module is being marked as imported?

2016-02-04 Thread Jean-Charles Lefebvre
So far, I've been advised to: 1/ Double-check that the GIL was correctly acquired 2/ Ensure there's no 'string' module in my project 3/ Manually pre-import commonly used standard modules at interpreter's init-time to avoid race conditions due to the multi-threaded nature of the running environme

Re: Multiprocess videoplayer

2016-02-04 Thread Ian Kelly
On Thu, Feb 4, 2016 at 2:45 AM, wrote: > I have coded a program with python and vlc that plays some videos, but > whenever I try to play 3 videos at once, Windows closes the program, I'm > guessing that the reason is that one process can't play 3 videos at once (but > I don't really know). My

Re: Tkinter problem: TclError> couldn't connect to display ":0

2016-02-04 Thread gemjack . pb
On Sunday, 29 December 2013 20:20:00 UTC, Michael Matveev wrote: > Hi, > I use live Debian on VM and trying to compile this code. > > > import Tkinter > > root = Tkinter.Tk() > > root.title("Fenster 1") > root.geometry("100x100") > > root.mainloop() > > > The shell gives out that kind of

Re: eval( 'import math' )

2016-02-04 Thread Peter Otten
阎兆珣 wrote: >Excuse me for the same problem in Python 3.4.2-32bit > >I just discovered that function does not necessarily take the >string input and transfer it to a command to execute. > >So is there a problem with my assumption? Python discriminates between statements and expr

Re: eval( 'import math' )

2016-02-04 Thread Ian Kelly
On Thu, Feb 4, 2016 at 6:33 AM, 阎兆珣 wrote: >Excuse me for the same problem in Python 3.4.2-32bit > >I just discovered that function does not necessarily take the >string input and transfer it to a command to execute. > >So is there a problem with my assumption? eval evaluates an

RE: eval( 'import math' )

2016-02-04 Thread Lutz Horn
Hi, >I just discovered that function does not necessarily take the >string input and transfer it to a command to execute. Can you please show us the code you try to execute and tells what result you expect? Lutz -- https://mail.python.org/ma

eval( 'import math' )

2016-02-04 Thread 阎兆珣
Excuse me for the same problem in Python 3.4.2-32bit I just discovered that function does not necessarily take the string input and transfer it to a command to execute. So is there a problem with my assumption? Thanks Option Product Manager Gelin Dahua Futures Co.Ltd

Re: problem in installing python

2016-02-04 Thread Joel Goldstick
On Thu, Feb 4, 2016 at 7:22 AM, Salony Permanand wrote: > hello sir, > During working on python I need urllib2 for my python version 2.7.11. > Kindly provide me address from where to download it.. > Thanking you. > > Hello Salony, Since this is a new question, its best to start a new thread with

Re: .py file won't open in windows 7

2016-02-04 Thread Tim Golden
On 04/02/2016 13:09, Tim Golden wrote: > On 04/02/2016 12:52, Yossifoff Yossif wrote: >> Hallow, >> I try to open a .py file (attached), but what I get is a windows DOS window >> opening and closing in a couple of seconds. Ran repair of the program, >> nothing happened. >> I cannot see error mess

Re: .py file won't open in windows 7

2016-02-04 Thread Tim Golden
On 04/02/2016 12:52, Yossifoff Yossif wrote: > Hallow, > I try to open a .py file (attached), but what I get is a windows DOS window > opening and closing in a couple of seconds. Ran repair of the program, > nothing happened. > I cannot see error messages and don't know where to look for ones. >

.py file won't open in windows 7

2016-02-04 Thread Yossifoff Yossif
Hallow, I try to open a .py file (attached), but what I get is a windows DOS window opening and closing in a couple of seconds. Ran repair of the program, nothing happened. I cannot see error messages and don't know where to look for ones. Would appreciate your piece of advice. [cid:image003.jpg

setup failed

2016-02-04 Thread Prince Thomas
Hi I am an computer science engineer. I downloaded the python version 3.5.1.amd64 and just python 3.5.1. The problem is when I install the program setup is failed and showing 0*80070570-The file or directory is corrupted and unreadable. I install the newest visual c++ redist and still same.

Re: Non working Parallel videoplayer

2016-02-04 Thread mdelamo90
I think it has to be with some functions that I think they are defined on the "forked" processes and maybe they don't, if I create a class on the new process it should have all the defined functions than the original right? -- https://mail.python.org/mailman/listinfo/python-list

Non working Parallel videoplayer

2016-02-04 Thread mdelamo90
I have coded a program with python and vlc that plays some videos, but whenever I try to play 3 videos at once, Windows closes the program, I'm guessing that the reason is that one process can't play 3 videos at once (but I don't really know). My trimmed program plays one video (trhough a globa

Re: problem in installing python

2016-02-04 Thread Salony Permanand
hello sir, During working on python I need urllib2 for my python version 2.7.11. Kindly provide me address from where to download it.. Thanking you. On Wed, Feb 3, 2016 at 4:27 PM, Salony Permanand wrote: > Thankyou for consideration..I have solved my problem by changing name of > temp files by

Re: How this C function was called through ctypes this way?

2016-02-04 Thread eryk sun
On Thu, Feb 4, 2016 at 3:33 AM, wrote: > > class DoubleArrayType: > def from_param(self, param): > > [snip] > > DoubleArray = DoubleArrayType() > _avg = _mod.avg > _avg.argtypes = (DoubleArray, ctypes.c_int) > > [snip] > > What confuse me are: > (1) at line: _avg.argtypes = (DoubleArray, ctyp

multiprocessing videoplayer

2016-02-04 Thread mdelamo90
I have coded a program with python and vlc that plays some videos, but whenever I try to play 3 videos at once, Windows closes the program, I'm guessing that the reason is that one process can't play 3 videos at once (but I don't really know). My trimmed program plays one video (trhough a globa

How a module is being marked as imported?

2016-02-04 Thread Jean-Charles Lefebvre
Hi all, The short version: How CPython marks a module as being fully imported, if it does, so that the same import statement ran from another C thread at the same time does not collide? Or, reversely, does not think the module is not already fully imported? The full version: I'm running CPytho

Multiprocess videoplayer

2016-02-04 Thread mdelamo90
I have coded a program with python and vlc that plays some videos, but whenever I try to play 3 videos at once, Windows closes the program, I'm guessing that the reason is that one process can't play 3 videos at once (but I don't really know). My trimmed program plays one video (trhough a globa

Re: Finding in which class an object's method comes from

2016-02-04 Thread Wolfgang Maier
On 04.02.2016 10:00, Chris Angelico wrote: On Thu, Feb 4, 2016 at 7:54 PM, ast wrote: It is strange but I dont have the same result that you: (Python 3.4) class A: def a(self):pass class B(A): def b(self):pass class C(B): def c(self):pass obj = C() obj.a > Curious. It appears

How this C function was called through ctypes this way?

2016-02-04 Thread jfong
Here is an example from "Python Cookbook, Third Edition(by David Beazley and Brian K. Jones)" Chapter 15.1. "Accessing C Code Using ctypes" --- import ctypes ... # Try to locate the .so file in the same directory as this file ... _mod = ctypes.cdll.LoadLibrary(_path) ... ... # voi

Re: please help

2016-02-04 Thread Oscar Benjamin
On 3 February 2016 at 23:03, Syavosh Malek wrote: > hi i install python 3.5.1 and found run time error > see attach file and help me please I'm afraid your attachment didn't arrive as this is a text-only mailing list. Can you include more information about the error? If it's that you're missing

Re: Install Error

2016-02-04 Thread Oscar Benjamin
On 3 February 2016 at 21:55, Barrie Taylor wrote: > > I am attempting to install and run Python3.5.1 on my Windows machine. > > After installation on launching I am presented the attached error message. > It reads: > 'The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing >

Re: __bases__ attribute on classes not displayed by dir() command

2016-02-04 Thread ast
"eryk sun" a écrit dans le message de news:mailman.49.1454576255.30993.python-l...@python.org... On Thu, Feb 4, 2016 at 2:03 AM, ast wrote: but if I am using dir to display all Carre's attributes and methods, __bases__ is not on the list. Why ? The __bases__ property is defined by the meta

Re: import cannot be used inside eval

2016-02-04 Thread Gary Herron
On 02/03/2016 09:03 PM, 阎兆珣 wrote: a = input("tell me which py to execute: ") print(a) print('import '+a) print(type('import'+a)) eval('print(a)') Eval is meant to evaluate Python expressions. The import is a statement, not an expression. Also, it's a bad idea to use e

Re: Finding in which class an object's method comes from

2016-02-04 Thread Chris Angelico
On Thu, Feb 4, 2016 at 7:54 PM, ast wrote: > It is strange but I dont have the same result that you: > (Python 3.4) > class A: > > def a(self):pass > class B(A): > def b(self):pass > class C(B): > def c(self):pass > obj = C() > obj.a > > > Curious. It appears to have chan

Re: Finding in which class an object's method comes from

2016-02-04 Thread ast
"Ben Finney" a écrit dans le message de news:mailman.48.1454575803.30993.python-l...@python.org... That's been answered, but I'm curious to know what your program will do with that information? Nothings, I was just wondering. -- https://mail.python.org/mailman/listinfo/python-list

Re: __bases__ attribute on classes not displayed by dir() command

2016-02-04 Thread eryk sun
On Thu, Feb 4, 2016 at 2:03 AM, ast wrote: > but if I am using dir to display all Carre's attributes and methods, > __bases__ is not on the list. Why ? The __bases__ property is defined by the metaclass, "type". dir() of a class doesn't show attributes from the metaclass [1]. Because dir() i

Re: Finding in which class an object's method comes from

2016-02-04 Thread ast
"Chris Angelico" a écrit dans le message de news:mailman.43.1454574987.30993.python-l...@python.org... You can see that by looking at the objects without calling them: class A: ... def a(self): pass ... class B(A): ... def b(self): pass ... class C(B): ... def c(self): pass ... ob

Re: Finding in which class an object's method comes from

2016-02-04 Thread Ben Finney
"ast" writes: > Let's invoke an obj method > > obj.funct() > > funct is first looked in ClassC, then if not found > on ClassB, then ClassA then object If it helps: What you describe is attribute lookup, and it happens whether or not you're going to call the attribute. In other words, you need o

Re: import cannot be used inside eval

2016-02-04 Thread Chris Angelico
On Thu, Feb 4, 2016 at 4:03 PM, 阎兆珣 wrote: >a = input("tell me which py to execute: ") > >print(a) > >print('import '+a) > >print(type('import'+a)) > >eval('print(a)') > >try: > >eval('import '+a) > >except Exception as e: > >print('Error: ', e) > >

Re: Finding in which class an object's method comes from

2016-02-04 Thread ast
"Chris Angelico" a écrit dans le message de news:mailman.43.1454574987.30993.python-l...@python.org... Is that what you're hoping for? yes, ty -- https://mail.python.org/mailman/listinfo/python-list

import cannot be used inside eval

2016-02-04 Thread 阎兆珣
a = input("tell me which py to execute:  ") print(a) print('import '+a) print(type('import'+a)) eval('print(a)') try:     eval('import '+a) except Exception as e:     print('Error: ', e) ##while True: ##    pass @python 3.4.2 this code attempts to

please help

2016-02-04 Thread Syavosh Malek
hi i install python 3.5.1 and found run time error see attach file and help me please -- https://mail.python.org/mailman/listinfo/python-list

Install Error

2016-02-04 Thread Barrie Taylor
Hi, I am attempting to install and run Python3.5.1 on my Windows machine. After installation on launching I am presented the attached error message. It reads: 'The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix thi

Re: Finding in which class an object's method comes from

2016-02-04 Thread Chris Angelico
On Thu, Feb 4, 2016 at 7:25 PM, ast wrote: > Hi > > Suppose we have: > > ClassC inherit from ClassB > ClassB inherit from ClassA > ClassA inherit from object > > Let's build an object: > > obj = ClassC() > > Let's invoke an obj method > > obj.funct() > > funct is first looked in ClassC, then if no

Finding in which class an object's method comes from

2016-02-04 Thread ast
Hi Suppose we have: ClassC inherit from ClassB ClassB inherit from ClassA ClassA inherit from object Let's build an object: obj = ClassC() Let's invoke an obj method obj.funct() funct is first looked in ClassC, then if not found on ClassB, then ClassA then object But is there a command to

__bases__ attribute on classes not displayed by dir() command

2016-02-04 Thread ast
Hi I have a Carre class which inherit from a Rectangle class. Carre has a __bases__ tuple attribute which contains the classes which it inherit from. Carre.__bases__ (,) and Rectangle only inherit from object, so: Rectangle.__bases__ (,) Thats OK but if I am using dir to display all Carr