Re: AssertionError - help me to solve this in a programme with Queue

2009-05-12 Thread maxim
> hi > It did work that way > > File "queue.py", line 15 >     threading.Thread__init__.(self) >                              ^ > SyntaxError: invalid syntax You've wrote right first time "threading.Thread.__init__(slef)", but misprinted in your code "def _int_(self,q)" instead of "def __init__ (

[announcement] - python graph library

2005-03-04 Thread Maxim Khesin
Hello Folks, I recently started working on a graph-algorithms library in Python. What makes this one different from the other couple of libs that are available is a heavy influence from the C++ Boost Graph Library. There are IMO a lot of good ideas there, so I am attempting to translate the spi

unicode converting

2005-03-15 Thread Maxim Kasimov
there are a few questions i can find answer in manual: 1. how to define which is internal encoding of python unicode strings (UTF-8, UTF-16 ...) 2. how to convert string to UCS-2 (Python 2.2.3 on freebsd4) -- Best regards, Maxim -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode converting

2005-03-15 Thread Maxim Kasimov
Diez B. Roggisch wrote: Maxim Kasimov wrote: there are a few questions i can find answer in manual: 1. how to define which is internal encoding of python unicode strings (UTF-8, UTF-16 ...) It shouldn't be your concern - but you can specify it using " ./configure --enable-unicod

Re: unicode converting

2005-03-16 Thread Maxim Kasimov
Christos TZOTZIOY Georgiou wrote: If unicode_data references your unicode data, all you have to send is: unicode_data.encode('utf-16') # maybe utf-16be for network order is utf-16 string the same ucs-2? my question is how to get string encoded as UCS-2 -- Best regards, Max

Re: unicode converting

2005-03-16 Thread Maxim Kasimov
-unicode=ucs2 no character can be >= 0x1 so you don't have to check. thank you very match! that's exactly what i need -- Best regards, Maxim -- http://mail.python.org/mailman/listinfo/python-list

libxml2/xpath

2004-12-15 Thread Maxim Khesin
I am trying to do some xpath on http://fluidobjects.com/doc.xhtml but cannot get past 'point A' (that is, I am totally stuck): >> import libxml2 >> mydoc = libxml2.parseDoc(text) >> mydoc.xpathEval('/html') >> [] this returns an empty resultlist, which just seems plain wrong. Can anyone throw a s

Re: libxml2/xpath

2004-12-16 Thread Maxim Khesin
I do not believe it is... You can see the doc by clicking on the link. Does it have to be? thanks, m Martijn Faassen wrote: Maxim Khesin wrote: I am trying to do some xpath on http://fluidobjects.com/doc.xhtml but cannot get past 'point A' (that is, I am totally stuck): import lib

portable text user interface

2004-12-29 Thread Maxim Kasimov
Hi. Are there widely used and recommended Python libraries that will let me makes a portable text user interface? -- Best regards, Maxim -- http://mail.python.org/mailman/listinfo/python-list

Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
y", line 177, in ? root = Tk() # Main window File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 1511, in __init__ self.tk = _tkinter.create(screenName, baseName, className) TclError: no display name and no $DISPLAY environment variable -- Best regards, Maxim -- http://mail.python.org/mailman/listinfo/python-list

Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
Steve Holden wrote: Maxim Kasimov wrote: Miki Tebeka wrote: Hello Fuzzyman, Are there widely used and recommended Python libraries that will let me makes a portable text user interface? If you just need a text-like interface you can use Tkinter. See (shameless plug) http://developer.berlios.de

Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
Grant Edwards wrote: On 2004-12-30, Maxim Kasimov <[EMAIL PROTECTED]> wrote: yes i'm telneting (sshing), that is the reason why i'm looking for libs for making text interfaces. i know there is a project named "anakonda" - red hat linux installer, but it is uses speci

Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
Grant Edwards wrote: On 2004-12-30, Maxim Kasimov <[EMAIL PROTECTED]> wrote: yes i'm telneting (sshing), that is the reason why i'm looking for libs for making text interfaces. i know there is a project named "anakonda" - red hat linux installer, but it is uses speci

Re: Archives and magic bytes

2005-03-23 Thread Maxim Krikun
> Another thing, I work on linux (gentoo) and I would like to use the "file" command to retrieve informations about type of file instead of using extensions, do you think this can be done? this is trivial: >>> import os >>> os.popen("file /etc/passwd").read() '/etc/passwd: ASCII text\n' -- http

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Mage wrote: praba kar wrote: Dear All, In Python what is equivalent to goto statement You shouldn't use goto in high-level languages. it would be quite useful for debuging porposes -- Best regards, Maxim Kasimov mailto: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Simon Brunning wrote: On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: it would be quite useful for debuging porposes How does goto help you to remove bugs? I can certainly see how it helps you put them in in the first place... if you need to comment a couple of code (and then unc

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Robert Kern wrote: Maxim Kasimov wrote: Simon Brunning wrote: On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: it would be quite useful for debuging porposes How does goto help you to remove bugs? I can certainly see how it helps you put them in in the first place... if you need to com

Re: goto statement

2005-04-20 Thread Maxim Kasimov
e singles. ''' Or, if you really like the spirit of goto, use "if 0:". ... and add tabs to each string Reinhold -- Best regards, Maxim Kasimov mailto: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Torsten Bronger wrote: HallÃchen! Maxim Kasimov <[EMAIL PROTECTED]> writes: [...] WOW, just greate! ... but i'd like to relax at some more interesting way than to comment each of rows but what if i just can't to do this becouse i'm working thrue ssh, and have to use only in

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Peter Hansen wrote: Maxim Kasimov wrote: Torsten Bronger wrote: HallÃchen! Maxim Kasimov <[EMAIL PROTECTED]> writes: WOW, just greate! ... but i'd like to relax at some more interesting way than to comment each of rows but what if i just can't to do this becouse i'm working

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Christos TZOTZIOY Georgiou wrote: On Wed, 20 Apr 2005 16:13:32 +0300, rumours say that Maxim Kasimov <[EMAIL PROTECTED]> might have written: but what if i just can't to do this becouse i'm working thrue ssh, and have to use only installed editors (such as vi) If you use plain

Re: goto statement

2005-04-20 Thread Maxim Kasimov
by the way, "goto" statement will be useful for writing more powerful obfuscators -- Best regards, Maxim Kasimov mailto: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Troll? was: Re: goto statement

2005-04-20 Thread Maxim Kasimov
André Roberge wrote: Maxim Kasimov wrote: by the way, "goto" statement will be useful for writing more powerful obfuscators Let me get that clear: you want a goto to help with debugging. And you want to obfuscate your code even more? !? Perhaps you need to write in Perl, or some oth

Re: goto statement

2005-04-21 Thread Maxim Kasimov
nstall new software (it is critical for remote working, for example, installing X11 may be impossible at all) 2) enables to make new, better software (better obfuscators) -- Best regards, Maxim Kasimov mailto: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-21 Thread Maxim Kasimov
Sergei Organov wrote: Maxim Kasimov <[EMAIL PROTECTED]> writes: 1. comment for debug It can be used in the same way, as the comments for debugging are used, but it will be easier than to use """ or ''', or using features of text-editors, when it is n

Re: goto statement

2005-04-21 Thread Maxim Kasimov
' ... ... ... sql = """ another query """ ... ... ... print "goodbye world" -- Best regards, Maxim Kasimov mailto: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: help needed :-pgdb givig error

2005-04-25 Thread Maxim Kasimov
Please try to check out permisions on the library. Perhaps there is no permissions for reading the library with uid of web-server "Ram" <[EMAIL PROTECTED]> ???/ ? ?: news:[EMAIL PROTECTED] Dear All I am very new to python . i would appreciate any help from you all on

Re: python equivalent of php implode

2005-04-27 Thread Maxim Kasimov
i'm tying to run example, and then get a traceback. am i something missed? mysql> create table tmp_tmp (id int not null auto_increment primary key, sd varchar(255) not null default '', si int not null default 1); >>> import MySQLdb >>> db = MySQLdb.connect("localhost", "login", "password", "

article posting

2014-10-06 Thread Maxim Lesnichenko
Maxim Lesnichenko Business Development Manager Redwerk phone: +1 (347) 329-1444 email: <mailto:ma...@redwerk.com> ma...@redwerk.com skype: redwerk.com web: <http://redwerk.com> http://redwerk.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Javascript is turning into Python?!

2006-11-02 Thread Maxim Sloyko
Paul Rubin wrote: > [Correction of earlier accidental crosspost] > > I hadn't seen this before. New Javascript 1.7 features: > > - Generators > - Iterators > - Array comprehensions > - Destructuring assignment > > Sounds like another language we know. > > http://developer.mozilla.org/en/docs/New_

psycopg2 features

2006-08-30 Thread Maxim Sloyko
Hello, clp and all people reading it! Recently I was porting my (small) app from psycopg to psycopg2 (they got me with this "2"). I read, that psycopg2 supports all features of psycopg and plus many more, however, when I started to port, I discovered, that psycopg2 lacks serialized connections and

Re: What do you want in a new web framework?

2006-08-30 Thread Maxim Sloyko
Laurent Pointal wrote: > > Look at http://wiki.python.org/moin/WebFrameworks > > Do you *really* need to develop a *new* framework (maybe a scholl > exercise - it that case, KISS)? Isn't the main reason why there are so many of them is that all of them suck badly? -- http://mail.python.org/mailm

Re: Minidom XML output - attributes in wrong order ?

2006-09-05 Thread Maxim Sloyko
u shouldn't rely on the order of attributes in the document in any way, because this is implementation dependent. If you need to preserve order of some items -- use child elements instead of attributes. -- Regards, Maxim Sloyko -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to get data into a new instance?

2006-09-29 Thread Maxim Sloyko
', 'last_name', 'age', 'salary', 'whatever']: self.__dict__[name] = kw.get(name, None) -- Maxim Sloyko -- http://mail.python.org/mailman/listinfo/python-list

Re: apache & mod_python

2006-12-08 Thread Maxim Sloyko
m.banaouas wrote: > Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent > versions) without facing any known major issue ? Works fine for me. The only "known major issue" you can face is general non-threadsafety of Python interpreter. So, if you are using Apache MPM, you have

Re: your opinion about psycopg vs pygresql

2006-12-21 Thread Maxim Sloyko
Martin P. Hellwig wrote: > However, given the choice, what in your opinion would be the reason why > someone would chose one over the other? Now I know this could easily get > into a flamewar, so if you comment (but please do so) I'll still > investigate that, since at this moment I don't even hav

Re: Mod_python

2006-12-27 Thread Maxim Sloyko
e suggest a solution? The only solution you need is Apache and mod_python :) I mean, Apache won't load a huge POST request into its memory no matter what. All file uploads will be stored in temporary files. Under mod_python (provided you use FieldStorage) you'll need to deal only with &#

lxml namespaces problem

2007-01-07 Thread Maxim Sloyko
Hi All! I have a little problem with XML namespaces. In my application I have two XML processors, that process the same document, one after the other. The first one looks for nodes in 'ns1' namespace, and substitutes them, according to some algorithm. After this processor is finished, it is guara

python 2.3.4, cx_Oracle 4.1 and utf-8 - trouble

2005-05-12 Thread Maxim Kuleshov
nt - Oracle Client 9.2.0.1.0 NLS_LANG="RUSSIAN_CIS.UTF8" -- Best regards, Maxim Kuleshov -- http://mail.python.org/mailman/listinfo/python-list

I can't inherit from "compiled" classes ?

2007-04-29 Thread Maxim Veksler
module.__init__() takes at most 2 arguments (3 given) """ What am I breaking wrong? Thank you, Maxim. -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Re: I can't inherit from "compiled" classes ?

2007-04-29 Thread Maxim Veksler
On 4/29/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Maxim Veksler > wrote: > > > Hello list, > > > > I'm trying to subclass socket and select, for both I get: > > """ TypeError: Error

Non blocking sockets with select.poll() ?

2007-05-04 Thread Maxim Veksler
port select s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setblocking(0) s.bind(('0.0.0.0', 1)) s.listen(5) __poll = select.poll() __poll.register(s) __poll.poll() print "I did not block" """ -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Non blocking sockets with select.poll() ?

2007-05-04 Thread Maxim Veksler
On 5/4/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Fri, 4 May 2007 13:04:41 +0300, Maxim Veksler <[EMAIL PROTECTED]> wrote: > >Hi, > > > >I'm trying to write a non blocking socket port listener based on > >poll() because select is limited t

Re: Non blocking sockets with select.poll() ?

2007-05-04 Thread Maxim Veksler
On 5/4/07, Maxim Veksler <[EMAIL PROTECTED]> wrote: > On 5/4/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > On Fri, 4 May 2007 13:04:41 +0300, Maxim Veksler <[EMAIL PROTECTED]> wrote: > > >Hi, > > > > > >I'm trying to write a non

Re: Non blocking sockets with select.poll() ?

2007-05-05 Thread Maxim Veksler
Echo > from twisted.internet.protocol import ServerFactory > > f = ServerFactory() > f.protocol = Echo > for i in range(1, 19169): > reactor.listenTCP(i, f) > reactor.run() > > This will handle traffic from an arbitrary number of clients at the same > time and do so more efficiently than the loop in your version. You can > also try epollreactor instead of pollreactor, if the version of Linux you > are using supports epoll, for even better performance. > Thanks! > Jean-Paul > -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Init style output with python?

2007-05-05 Thread Maxim Veksler
WHITE_FG + msg + self.BLACK_FG cc = ColorTerm() print cc.red('Cool!') + cc.yellow('?'), cc.green('Sure is!!!') print "Now setting your terminal text color to blue" + cc.BLUE_FG print "well don't be blue about this, here let me set it back for you" print cc.BLACK_FG + "see, nothing to worry about" """ -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Init style output with python?

2007-05-06 Thread Maxim Veksler
On 5/6/07, Tina I <[EMAIL PROTECTED]> wrote: > Maxim Veksler wrote: > > > Is there are frame work or something in python that would allow me to > > do this (quickly) ? > > If not, ideas how I should I be getting this boring task of: > > 1. get screen width >

programmatically manipulation environment variables of the calling shell

2007-03-12 Thread Maxim Veksler
h python? (If at all possible because python is actually a sub process of bash). Thank you, Maxim. -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Re: programmatically manipulation environment variables of the calling shell

2007-03-12 Thread Maxim Veksler
On 3/12/07, Tommy Nordgren <[EMAIL PROTECTED]> wrote: > > On 12 mar 2007, at 11.33, Maxim Veksler wrote: > > > Hello list, > > > > I'm trying to write a python script that would allow me to manipulate > > shell variables of the calling shell. I'm

low level networking in python

2007-04-03 Thread Maxim Veksler
ow.py", line 30, in ? raise 'source file doesn\'t look like swigged shadow class code' source file doesn't look like swigged shadow class code error: command '/usr/bin/python' failed with exit status 1 """ [1] http://pylibpcap.sourceforge.net/

Re: low level networking in python

2007-04-03 Thread Maxim Veksler
On 3 Apr 2007 08:43:57 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Apr 3, 10:29 am, "Maxim Veksler" <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I wish to do some low level network stuff using python. > > > > -- > > Chee

Re: low level networking in python

2007-04-06 Thread Maxim Veksler
On 4/4/07, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Maxim Veksler wrote: > > > I'm trying to bind a non-blocking socket, here is my code: > > """ > > #!/usr/bin/env python > > > > import socket, select > > fro

ulimit on open sockets ?

2007-04-09 Thread Maxim Veksler
rent version of select or something? Or should I implement this the other way around, if so please suggest how. Thank you very much, (enthusiastically learning python) Maxim. -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Re: ulimit on open sockets ?

2007-04-12 Thread Maxim Veksler
On 4/10/07, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > Maxim Veksler wrote: > > > I've written this code, the general idea was to listen on all > > 65535 port of tcp for connection. > > Please excuse the question: Why would anyone want to do such a manic &g

Re: ulimit on open sockets ?

2007-04-12 Thread Maxim Veksler
On 4/10/07, Alex Martelli <[EMAIL PROTECTED]> wrote: > Maxim Veksler <[EMAIL PROTECTED]> wrote: > > > ValueError: filedescriptor out of range in select() > > """ > > > > Should I be using a different version of select or something? Or >

Re: ulimit on open sockets ?

2007-04-14 Thread Maxim Veksler
On 4/13/07, Alex Martelli <[EMAIL PROTECTED]> wrote: > > On Apr 12, 2007, at 1:17 PM, Maxim Veksler wrote: > ... > > Now, someone I work with suggested a simple work around "Pass the list > > objects in groups of 1024 each time to the select.select structure&q

Re: Thoughts on using isinstance

2007-01-24 Thread Maxim Sloyko
of print "Hello " + name you could have written print "Hello " + str(name) In this case requirement isinstance() will be too strict. The only thing you have to check is that hasattr(name, "__str__") and callable(name.__str__) In this case you can have validation, while at the same time enjoy full flexibility of dynamic typing. -- Maxim -- http://mail.python.org/mailman/listinfo/python-list

lambda functions ?

2007-02-05 Thread Maxim Veksler
quot;x: 0 + 42" And what is the "f" object? An integer? a pointer? an Object? I'm coming from the C world... Could some please try (if even possible) to implement the above code without using "lambda" I believe it would help me grasp this a bit faster then. Thank you, Maxim. -- Cheers, Maxim Veksler "Free as in Freedom" - Do u GNU ? -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda functions ?

2007-02-05 Thread Maxim Veksler
Wow, Thank you everyone for the help. I am amazed by the motivation people have on this list to help new comers. I hope that I will be able to contribute equally some day. On 05 Feb 2007 14:22:05 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Maxim Ve

Binary search tree

2007-11-09 Thread maxim . novak
Hi, I have to get list of URLs one by one and to find the URLs that I have more than one time(can't be more than twice). I thought to put them into binary search tree, this way they'll be sorted and I'll be able to check if the URL already exist. Couldn't find any python library that implements

Re: ZSI usage

2006-05-04 Thread Maxim Sloyko
There is a typo there in functions name. It is called "session_open" not "open_session", but everything else is as described -- http://mail.python.org/mailman/listinfo/python-list

ZSI usage

2006-05-04 Thread Maxim Sloyko
ction shall match 'uri#method' if present (got '""', expected 'QW/API#open_session' If I look at SOAP packet I see the following: [snip] 1 [snip] SO the question is, why ZSI seem to ignore that NS setting? How to fix that? Thanks in advance! -- Maxim -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Maxim Sloyko
I guess the following standard method will help : class MyLocker(object): def __init__(self, lock): self.lock = lock self.lock.acquire() def __del__(self): self.lock.release() Then whenever you need to acquire a lock: templock = MyLocker(self.__mutex) del tem

py2exe and distutils

2009-02-07 Thread Maxim Demenko
_Distribution = _get_unpatched(_Distribution) File "C:\Programme\Python25\Lib\site-packages\setuptools\dist.py", line 23, in _get_unpatched "distutils has already been patched by %r" % cls AssertionError: distutils has already been patched by py2exe.Distribution at 0x011B4F90> Any suggestion, how to fix this issue? Best regards Maxim -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe and distutils

2009-02-07 Thread Maxim Demenko
Thomas Heller schrieb: Maxim Demenko schrieb: Hi, i have installed Python 2.5.4 on WinXP, setuptools-0.6c9 and py2exe 0.6.9 Now i can't list installed modules, here is the stacktrace: [...] Any suggestion, how to fix this issue? Thomas Heller schrieb: Looks like a setuptools problem

Re: py2exe and distutils

2009-02-09 Thread Maxim Demenko
Gabriel Genellina schrieb: En Sat, 07 Feb 2009 18:39:19 -0200, Thomas Heller escribió: Maxim Demenko schrieb: Hi, i have installed Python 2.5.4 on WinXP, setuptools-0.6c9 and py2exe 0.6.9 Now i can't list installed modules, here is the stacktrace: [...] Any suggestion, how to fix

Strange array.array performance

2009-02-19 Thread Maxim Khitrov
Hello all, I'm currently writing a Python <-> MATLAB interface with ctypes and array.array class, using which I'll need to push large amounts of data to MATLAB. Everything is working well, but there was one strange performance-related issue that I ran into and wanted to ask about. Here's some exam

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 2:35 PM, Robert Kern wrote: > On 2009-02-19 12:52, Maxim Khitrov wrote: >> >> Hello all, >> >> I'm currently writing a Python<-> MATLAB interface with ctypes and >> array.array class, using which I'll need to push large a

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 2:23 PM, Gabriel Genellina wrote: > En Thu, 19 Feb 2009 16:52:54 -0200, Maxim Khitrov > escribió: > >> input = array('B', range(256) * 1) >> >> # Case 1 >> start = clock() >> data1 = array('B', input) >>

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 7:01 PM, Scott David Daniels wrote: > Maxim Khitrov wrote: >> >> On Thu, Feb 19, 2009 at 2:35 PM, Robert Kern >> wrote: >> I have, but numpy is not currently available for python 2.6, which is >> what I need for some other fea

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 7:01 PM, Scott David Daniels wrote: > Maxim Khitrov wrote: >> >> On Thu, Feb 19, 2009 at 2:35 PM, Robert Kern >> wrote: >> I have, but numpy is not currently available for python 2.6, which is >> what I need for some other fea

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 9:34 PM, David Cournapeau wrote: > On Fri, Feb 20, 2009 at 4:53 AM, Maxim Khitrov wrote: >> On Thu, Feb 19, 2009 at 2:35 PM, Robert Kern wrote: >>> On 2009-02-19 12:52, Maxim Khitrov wrote: >>>> >>>> Hello all, >>&

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 9:15 PM, John Machin wrote: > On Feb 20, 6:53 am, Maxim Khitrov wrote: >> On Thu, Feb 19, 2009 at 2:35 PM, Robert Kern wrote: >> > On 2009-02-19 12:52, Maxim Khitrov wrote: >> >> >> Hello all, >> >> >> I'm curr

Re: Strange array.array performance

2009-02-19 Thread Maxim Khitrov
On Thu, Feb 19, 2009 at 10:06 PM, David Cournapeau wrote: > On Fri, Feb 20, 2009 at 11:43 AM, Maxim Khitrov wrote: >> >> Yes, I may have a case where one thread is still sending data, while >> another tries to close the connection, or two threads trying to close >>

Re: Strange array.array performance

2009-02-20 Thread Maxim Khitrov
On Fri, Feb 20, 2009 at 2:42 AM, Scott David Daniels wrote: > Maxim Khitrov wrote: >> >> ... Here's the function that I'll be using from now on. It gives me >> exactly the behavior I need, with an int initializer being treated as >> array size. Still not as

Using clock() in threading on Windows

2009-02-20 Thread Maxim Khitrov
Greetings, The threading module uses time.time in _Condition and _Thread classes to implement timeouts. On Windows, time() typically has a resolution of 15.625ms. In addition, if the system clock is changed (though ntp, for example) it would reflect that change, causing the timeout to last longer

What functions, other than sleep(), can be interrupted by Ctrl-C?

2009-02-26 Thread Maxim Khitrov
Greetings, I'm looking for a function in the standard library or pywin32 package that will block until a certain condition is met or it is interrupted by Ctrl-C. For example, time.sleep() would have been perfect for my needs if thread.interrupt_main() could interrupt the call from another thread i

Re: What functions, other than sleep(), can be interrupted by Ctrl-C?

2009-02-27 Thread Maxim Khitrov
On Thu, Feb 26, 2009 at 3:47 PM, Gabriel Genellina wrote: >> I'm looking for a function in the standard library or pywin32 package >> that will block until a certain condition is met or it is interrupted >> by Ctrl-C. For example, time.sleep() would have been perfect for my >> needs if thread.inte

Re: py2exe automatic upgrades of a program while it is running, is that possible?

2009-03-02 Thread Maxim Khitrov
On Mon, Mar 2, 2009 at 9:18 PM, William Heath wrote: > Hi All, > I am using py2exe to create a windows executable.  I am curious if anyone > knows a way to automatically upgrade a py2exe windows executable while it is > running.  Is that possible?  If so how?  If it isn't possible, what is the > n

Style question - defining immutable class data members

2009-03-14 Thread Maxim Khitrov
Very simple question on the preferred coding style. I frequently write classes that have some data members initialized to immutable values. For example: class Test(object): def __init__(self): self.some_value = 0 self.another_value = None Similar effect can be achieved by defi

Re: Style question - defining immutable class data members

2009-03-14 Thread Maxim Khitrov
On Sat, Mar 14, 2009 at 12:50 PM, MRAB wrote: > Maxim Khitrov wrote: >> >> Very simple question on the preferred coding style. I frequently write >> classes that have some data members initialized to immutable values. >> For example: >> >> clas

Re: Style question - defining immutable class data members

2009-03-14 Thread Maxim Khitrov
On Sat, Mar 14, 2009 at 2:07 PM, Gary Herron wrote: > Maxim Khitrov wrote: >> >> Very simple question on the preferred coding style. I frequently write >> classes that have some data members initialized to immutable values. >> For example: >> >> clas

Re: Style question - defining immutable class data members

2009-03-14 Thread Maxim Khitrov
On Sat, Mar 14, 2009 at 4:31 PM, Gary Herron wrote: >> Perhaps a different example would help explain what I'm trying to do: >> >> class Case1(object): >>        def __init__(self): >>                self.count = 0 >>                self.list  = [] >> >>        def inc(self): >>                sel

Re: Style question - defining immutable class data members

2009-03-14 Thread Maxim Khitrov
On Sat, Mar 14, 2009 at 5:38 PM, Matthew Woodcraft wrote: > Gary Herron writes: > I think this code is in poor taste: it's clear that it will confuse > people (which is what Maxim was asking about in the first place). Yes, I see that now, thanks :) - Max -- http://mail.pyth

Re: Script for a project inside own directory

2009-03-22 Thread Maxim Khitrov
2009/3/22 Filip Gruszczyński : > I am having a project built like this: > > project >   module1.py >   module2.py >   packages1/ >     module3.py > > etc. > > I have script that uses objects from those modules/packages. If I keep > this script inside project directory it's ok and it works. But I wo

Re: How Get Name Of Working File

2009-03-22 Thread Maxim Khitrov
On Sun, Mar 22, 2009 at 10:58 AM, Christian Heimes wrote: > Victor Subervi schrieb: >> Hi; >> If I am writing a script that generates HTML, how do I grab the name of the >> actual file in which I am working? For example, let us say I am working in >> test.py. I can have the following code: >> >> i

Re: Relative Imports, why the hell is it so hard?

2009-03-23 Thread Maxim Khitrov
On Mon, Mar 23, 2009 at 10:16 AM, CinnamonDonkey wrote: > Hi All, > > I'm fairly new to Python so I still have a lot to learn. But I'd like > to know how to correectly use relative imports. > > Please, please... please! don't go off on rants about why you think > relative imports should not be use

Re: Relative Imports, why the hell is it so hard?

2009-03-23 Thread Maxim Khitrov
On Mon, Mar 23, 2009 at 11:22 AM, CinnamonDonkey wrote: > Looking at http://www.python.org/dev/peps/pep-0328/#guido-s-decision > would suggest, unless I am completely miss-understanding the example, > that '.' refers to the current level and '..' pops up a level. That is correct, but you cannot j

Re: Relative Imports, why the hell is it so hard?

2009-03-23 Thread Maxim Khitrov
On Mon, Mar 23, 2009 at 12:19 PM, CinnamonDonkey wrote: > My applogies if this is a silly question... but what makes something a > package? and does that mean that what I am trying to do is not > possible ? A package is a directory that has an __init__.py file. That file can be empty, or contain

Re: Relative Imports, why the hell is it so hard?

2009-03-24 Thread Maxim Khitrov
On Tue, Mar 24, 2009 at 5:05 AM, CinnamonDonkey wrote: > Thanx Max - your explanation sorted it :-), and a big thank you to > everyone else also! > > >From the various posts, Python considers any directory containing the > __init__.py file to be a package. The top level package is the highest > di

Re: Unit testing frameworks

2009-03-24 Thread Maxim Khitrov
On Tue, Mar 24, 2009 at 8:06 AM, wrote: > I am looking for a unit testing framework for Python. I am aware of > nose, but was wondering if there are any others that will > automatically find and run all tests under a directory hierarchy. Have you already looked at the unittest module? Below is t

Re: Relative Imports, why the hell is it so hard?

2009-03-24 Thread Maxim Khitrov
On Tue, Mar 24, 2009 at 8:57 PM, Istvan Albert wrote: > Does it not bother you that a module that uses relative imports cannot > be run on its own anymore? $ python --help -m mod : run library module as a script (terminates option list) $ python -m some.module.name Works perfectly fine with re

Re: OpenGL win32 Python

2009-04-17 Thread Maxim Khitrov
On Fri, Apr 17, 2009 at 9:27 AM, gintare statkute wrote: > Hello, > > i found an example for OpenGL in windows. > It is incredibly helpful, but how to rewrite it to be useful in Python. > > How to give address of pfd in Python?: > iFormat = ChoosePixelFormat( hDC, &pfd ); > SetPixelFormat( hDC, iF

Re: Efficient bits manipulation in Python

2009-04-28 Thread Maxim Khitrov
On Tue, Apr 28, 2009 at 7:26 AM, Li Wang wrote: > Hi: > > I have a bit-code :'1011011', how can I reverse it to '1101101'? > > Another question is I know how to transform the string '110' into > integer 6, does anyone know how to transform integer 6 to a string > '110'? > > Thank you very much:)

Re: How to timeout when waiting for raw_input from user ?

2009-12-04 Thread Maxim Khitrov
On Fri, Dec 4, 2009 at 6:55 PM, northof40 wrote: > On Dec 5, 12:52 pm, northof40 wrote: >> Hi - I'm writing a *very* simple program for my kids. It asks the user >> to give it the answer to a maths question and says "right" or "wrong" >> >> They now want a timed version where they would only get

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Maxim Khitrov
On Sat, Dec 5, 2009 at 9:01 AM, Rune Strand wrote: > The easiest wasy is to use the Timer object in the threading module. > > > from threading import Timer Doesn't work on Windows. - Max -- http://mail.python.org/mailman/listinfo/python-list

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Maxim Khitrov
On Sat, Dec 5, 2009 at 9:11 AM, Rune Strand wrote: > On Dec 5, 3:07 pm, Maxim Khitrov wrote: >> >> Doesn't work on Windows. >> >> - Max > > Yes, it does. I've used it a lot, also in Py2Exe apps.  Try the > documentation example yourself > >

Internationalized To:'s and Cc:'s

2009-10-07 Thread Maxim Kuleshov
Hello! How should I correctly construct internationalized base64'ed MIME header? The problem is that 'real name' _should_ be encoded, but the email address - should not. For example, ?utf-8?bla-bla=?= should be the correct format, and ?utf-8?bla-bla-bla-bla=?= - incorrect. But email.Header encod

Inconsistent raw_input behavior after Ctrl-C

2009-10-20 Thread Maxim Khitrov
Hello all, I ran into a rather strange problem when interrupting a raw_input call with Ctrl-C. This is with python 2.6.3 on Windows 7. When the call is interrupted, one of two things happen - either a KeyboardInterrupt exception is raised or raw_input raises EOFError, and KeyboardInterrupt is rais

Re: Inconsistent raw_input behavior after Ctrl-C

2009-10-20 Thread Maxim Khitrov
On Tue, Oct 20, 2009 at 6:09 PM, Maxim Khitrov wrote: > Hello all, > > I ran into a rather strange problem when interrupting a raw_input call > with Ctrl-C. This is with python 2.6.3 on Windows 7. When the call is > interrupted, one of two things happen - either a KeyboardInterrupt

  1   2   >