Re: How to improve the usability of nested packages

2012-11-05 Thread Rouslan Korneychuk
On 11/02/2012 12:11 PM, Michael Schwarz wrote: … which doesn't work. Some of the modules reference other modules in the same package. I'm not talking about cyclic references, but, for example, the "dialog" module uses the "transaction" module. The problem is that the "dialog" module uses the same

Re: Lazy Attribute

2012-11-16 Thread Rouslan Korneychuk
On 11/16/2012 02:49 AM, Andriy Kornatskyy wrote: If accessing the descriptor on the class object has no special meaning, then the custom is to return the descriptor object itself, as properties do. If I would satisfy this, I will be forced to check for None 99.9% of the use cases (it is not No

Re: Lazy Attribute

2012-11-16 Thread Rouslan Korneychuk
On 11/16/2012 04:32 AM, Rouslan Korneychuk wrote: On 11/16/2012 02:49 AM, Andriy Kornatskyy wrote: If accessing the descriptor on the class object has no special meaning, then the custom is to return the descriptor object itself, as properties do. If I would satisfy this, I will be forced to

Determining if any threads are waiting for GIL

2012-12-19 Thread Rouslan Korneychuk
I'm working on a package that can compile CPython byte-code into native machine code (so far: x86 and x86_64 are supported). I have support for almost every byte-code instruction implemented already, but to fully emulate the interpreter, I need an efficient way to determine two things: when to

Re: Brython - Python in the browser

2012-12-21 Thread Rouslan Korneychuk
On 12/20/2012 04:37 AM, Pierre Quentel wrote: To create an element, for instance an HTML anchor : doc <= A('Python',href="http://www.python.org";) To me, that is a awful choice and I urge you to change it. '<=' is not just an operator, it is a comparison operator. It normally return False or

Re: How do functions get access to builtins?

2013-01-20 Thread Rouslan Korneychuk
On 01/19/2013 09:59 PM, Steven D'Aprano wrote: I've been playing around with ChainedMap in Python 3.3, and run into something which perplexes me. Let's start with an ordinary function that accesses one global and one builtin. x = 42 def f(): print(x) If you call f(), it works as expected

basic bytecode to machine code compiler (part 3)

2011-06-20 Thread Rouslan Korneychuk
My compiler now supports the x86-64 instruction set, in addition to x86. It also generates faster x86 machine code. Although it's designed to support 64-bit Windows, I have only tested it on Linux so far, and it doesn't support running with Windows' DEP yet. It's available at https://github.c

Re: basic bytecode to machine code compiler (part 3)

2011-06-21 Thread Rouslan Korneychuk
On 06/21/2011 06:55 AM, Ulrich Eckhardt wrote: Rouslan Korneychuk wrote: if i != pindex: (less if x<= pivot else greater).append(x) Just curious, is there a reason why you wrote this last line that way instead of using a "normal" if/else clause? Cheers! Uli No spec

Re: a little parsing challenge ☺

2011-07-18 Thread Rouslan Korneychuk
I don't know why, but I just had to try it (even though I don't usually use Perl and had to look up a lot of stuff). I came up with this: /(?| (\()(?&matched)([\}\]”›»】〉》」』]|$) | (\{)(?&matched)([\)\]”›»】〉》」』]|$) | (\[)(?&matched)([\)\}”›»】〉》」』]|$) | (“)(?&matched)([\)\}\]›»】〉》」』

Re: a little parsing challenge ☺

2011-07-18 Thread Rouslan Korneychuk
On 07/18/2011 03:24 AM, Stefan Behnel wrote: That's solid Perl. Both the code generator and the generated code are unreadable. Well done! Stefan Why, thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: a little parsing challenge ☺

2011-07-18 Thread Rouslan Korneychuk
On 07/18/2011 12:46 PM, Thomas 'PointedEars' Lahn wrote: Rouslan Korneychuk wrote: I don't know why, but I just had to try it (even though I don't usually use Perl and had to look up a lot of stuff). I came up with this: I don't know why … you replied to my posting/e

Re: a little parsing challenge ☺

2011-07-21 Thread Rouslan Korneychuk
On 07/21/2011 09:23 AM, Xah Lee wrote: Thanks for the code. are you willing to make it complete and standalone? i.e. i can run it like this: perl Rouslan_Korneychuk.pl dirPath and it prints any file that has mismatched pair and line/column number or the char position? Since you asked, I put

a basic bytecode to machine code compiler

2011-03-31 Thread Rouslan Korneychuk
I was looking at the list of bytecode instructions that Python uses and I noticed how much it looked like assembly. So I figured it can't be to hard to convert this to actual machine code, to get at least a small boost in speed. And so I whipped up a proof of concept, available at https://git

Re: a basic bytecode to machine code compiler

2011-04-01 Thread Rouslan Korneychuk
Thanks for all the replies. I wasn't aware of some of these alternatives. Most of these seem to transform Python code/bytecode into another language. I was already well aware of Cython. On the Nuitka blog, I notice it says "Compiling takes a lot [sic] time, ...". Compyler seems to generate asse

basic bytecode to machine code compiler (part 2)

2011-05-17 Thread Rouslan Korneychuk
I mentioned before that I had a proof of concept to convert Python bytecode to native machine code. It's available at https://github.com/Rouslan/nativecompile Now that I have a substantial number of the bytecode instructions implemented, I thought I would share some benchmark results. The f

Hyper-spacial ray-tracer

2013-10-02 Thread Rouslan Korneychuk
I have been working on something I thought was interesting and I wanted to know what other people think. It's a ray-tracing library than can work with any number of spacial dimensions greater than two. It's a Python package that uses Pygame. The project and a screenshot are at: https://github.

Re: Hyper-spacial ray-tracer

2013-10-04 Thread Rouslan Korneychuk
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 to gaming. Is it because of the use of Pygame that you thought it was. I use Pygame be

Re: Hyper-spacial ray-tracer

2013-10-04 Thread Rouslan Korneychuk
On 10/04/2013 09:41 PM, Chris Angelico wrote: On Sat, Oct 5, 2013 at 10:17 AM, Rouslan Korneychuk wrote: The point of this was to explore the concept of hyperspace, which is a mathematical curiosity and also has relevance in theoretical physics. I don't have any actual use-case for

Re: [OT] Re: Hyper-spacial ray-tracer

2013-10-05 Thread Rouslan Korneychuk
On 10/05/2013 11:26 AM, Peter Pearson wrote: On Fri, 04 Oct 2013 20:17:52 -0400, Rouslan Korneychuk wrote: [snip] I was also wondering about general relativity. I'm not going to go into too much detail, but basically: if an object with synchronized clocks on either end of it, passes

inheritance, multiple inheritance and the weaklist and instance dictionaries

2011-02-09 Thread Rouslan Korneychuk
I'm working on a program that automatically generates C++ code for a Python extension and I noticed a few limitations when using the weaklist and instance dictionaries (tp_weaklistoffset and tp_dictoffset). This is pertaining to the C API. I noticed that when using multiple inheritance, I need

Re: inheritance, multiple inheritance and the weaklist and instance dictionaries

2011-02-09 Thread Rouslan Korneychuk
On 02/09/2011 02:42 PM, Carl Banks wrote: On Feb 9, 10:54 am, Rouslan Korneychuk wrote: I'm working on a program that automatically generates C++ code for a Python extension and I noticed a few limitations when using the weaklist and instance dictionaries (tp_weaklistoffset and tp_dicto

Re: inheritance, multiple inheritance and the weaklist and instance dictionaries

2011-02-09 Thread Rouslan Korneychuk
On 02/09/2011 04:58 PM, Carl Banks wrote: On Feb 9, 1:14 pm, Rouslan Korneychuk wrote: On 02/09/2011 02:42 PM, Carl Banks wrote: This is the only case I can think of where the layout conflict would be caused by a type setting tp_dictoffset. No, actually I have code that is roughly

Re: inheritance, multiple inheritance and the weaklist and instance dictionaries

2011-02-09 Thread Rouslan Korneychuk
On 02/09/2011 05:02 PM, Carl Banks wrote: On Feb 9, 1:14 pm, Rouslan Korneychuk wrote: Each Python class is a wrapper for a C++ class. Also, if you want my opinion (you probably don't after you've already gone to so much trouble, but here it is anyway): No, your opinion is qui

Re: inheritance, multiple inheritance and the weaklist and instance dictionaries

2011-02-09 Thread Rouslan Korneychuk
On 02/09/2011 08:40 PM, Carl Banks wrote: I explained why in my last post; there's a bunch of reasons. Generally you can't assume someone's going to go through the type structure to find the object's dict, nor can you expect inherited methods to always use the derived class's type structure (some

new extension generator for C++

2010-05-03 Thread Rouslan Korneychuk
Hi, I'm new here. I'm working on a program that exposes C++ declarations to Python and I was wondering if there is any interest in it. It's a hobby project. I was originally using Boost.Python on another project but found a couple of things I didn't like. Eg: you can't really have private cons

Re: new extension generator for C++

2010-05-04 Thread Rouslan Korneychuk
On 05/04/2010 03:06 AM, Samuel Williams wrote: Dear Rouslan, It looks interesting. I say go for it. You will learn something and might make some improvements on existing ideas. I recommend putting the code on www.github.com Kind regards, Samuel Thanks for the suggestion. I think I'll do jus

Re: new extension generator for C++

2010-05-06 Thread Rouslan Korneychuk
I have the code up at http://github.com/Rouslan/PyExpose now. Any comments are welcome. -- http://mail.python.org/mailman/listinfo/python-list

Re: Picking a license (was Re: new extension generator for C++)

2010-05-06 Thread Rouslan Korneychuk
On 05/06/2010 04:22 PM, Aahz wrote: In article<4be05d75.7030...@msn.com>, Rouslan Korneychuk wrote: The only question I have now is what about licensing? Is that something I need to worry about? Should I go with LGPL, MIT, or something else? Which license you use depends partly o

My extension code generator for C++

2010-07-03 Thread Rouslan Korneychuk
It's still in the rough, but I wanted to give an update on my C++ extension generator. It's available at http://github.com/Rouslan/PyExpose The documentation is a little slim right now but there is a comprehensive set of examples in test/test_kompile.py (replace the k with a c. For some reason

Re: My extension code generator for C++

2010-07-03 Thread Rouslan Korneychuk
On 07/03/2010 01:54 PM, Thomas Jollans wrote: On 07/03/2010 07:22 PM, Rouslan Korneychuk wrote: It's still in the rough, but I wanted to give an update on my C++ extension generator. It's available at http://github.com/Rouslan/PyExpose Question that pops to mind immediately: How

Re: My extension code generator for C++

2010-07-03 Thread Rouslan Korneychuk
I missed one: func="operator[]" would also work, I assume? Yes, you can also supply a function if the first parameter accepts the type being wrapped (__rop__ methods will even accept the second parameter taking the wrapped type). -- http://mail.python.org/mailman/listinfo/python-list