Re: Relatively prime integers in NumPy

2024-07-12 Thread Popov, Dmitry Yu via Python-list
Thank you very much. List comprehensions make code much more concise indeed. Do list comprehensions also improve the speed of calculations? From: avi.e.gr...@gmail.com Sent: Friday, July 12, 2024 6:57 PM To: Popov, Dmitry Yu ; 'Popov, Dmitry Yu via Python

Re: Relatively prime integers in NumPy

2024-07-12 Thread Popov, Dmitry Yu via Python-list
)   hkl_list.append(hkl_local) hkl=np.array(hkl_list, dtype=np.int64) This code will generate a two-dimensional ndarray of h,k,l indices but is it possible to make a faster routine with NumPy? Regards, Dmitry From: Python-list on behalf of Popov

Re: Relatively prime integers in NumPy

2024-07-12 Thread Popov, Dmitry Yu via Python-list
vely prime integers h,k,l pass to this block of the code From: avi.e.gr...@gmail.com Sent: Thursday, July 11, 2024 1:22 PM To: Popov, Dmitry Yu ; 'Popov, Dmitry Yu via Python-list' Subject: RE: Relatively prime integers in NumPy Дмитрий, You may think you explained what you

Relatively prime integers in NumPy

2024-07-11 Thread Popov, Dmitry Yu via Python-list
ctors along axis 0: [1,2,3]. Those triples of numbers along axis 1 with the factor of1 or -1 would be relatively prime integers. Regards, Dmitry Popov Argonne, IL USA -- https://mail.python.org/mailman/listinfo/python-list

Re: Version of NymPy

2024-05-15 Thread Popov, Dmitry Yu via Python-list
Thank you. From: Larry Martell Sent: Wednesday, May 15, 2024 1:55 PM To: Popov, Dmitry Yu Cc: Popov, Dmitry Yu via Python-list Subject: Re: Version of NymPy On Wed, May 15, 2024 at 2: 43 PM Popov, Dmitry Yu via Python-list wrote: > > What would be the e

Version of NymPy

2024-05-15 Thread Popov, Dmitry Yu via Python-list
What would be the easiest way to learn which version of NumPy I have with my Anaconda distribution? -- https://mail.python.org/mailman/listinfo/python-list

Re: Use of statement 'global' in scripts.

2024-05-08 Thread Popov, Dmitry Yu via Python-list
Thank you! From: Python-list on behalf of Greg Ewing via Python-list Sent: Wednesday, May 8, 2024 3:56 AM To: python-list@python.org Subject: Re: Use of statement 'global' in scripts. On 8/05/24 1: 32 pm, Popov, Dmitry Yu wrote: > The stat

Use of statement 'global' in scripts.

2024-05-07 Thread Popov, Dmitry Yu via Python-list
modules? If there are any differences, I would really appreciate any comments on this. Regards, Dmitry Popov Lemont, IL USA -- https://mail.python.org/mailman/listinfo/python-list

Re: dash/underscore on name of package uploaded on pypi

2022-06-01 Thread Dmitry Labazkin
On Friday, March 1, 2019 at 12:08:00 AM UTC+3, Terry Reedy wrote: > On 2/28/2019 11:09 AM, ast wrote: > > Hello > > > > I just uploaded a package on pypi, whose name is "arith_lib" > > > > The strange thing is that on pypi the package is renamed "arith-lib" > > The underscore is substitued wi

SmallTalk-like interactive environment on base of cPython 2.7.x + wx

2016-08-14 Thread Dmitry Ponyatov
Does anybody can recomend some links on tutorials on making custom dynamic languages or objects systems on top of cPython2 ? I want some interactive dynamic object environment with SmallTalk look&feel but with Python syntax. Other tutorials I'm interested in are reflection, dynamic bytecode (d

Re: Bugfixing python 3.5 asyncio

2015-11-04 Thread Dmitry Panteleev
Hello, Yes, the fix has been merged. If 3.5.1 gets released in a month, it should not be a problem. And looks like it dpends on http://bugs.python.org/issue25446 . Thank you for the information. Dmitry On Wed, Nov 4, 2015 at 5:52 PM, Terry Reedy wrote: > On 11/3/2015 8:24 PM, Dmitry Pantel

Bugfixing python 3.5 asyncio

2015-11-04 Thread Dmitry Panteleev
can think of: 1. Copy asyncio.queues into our package so it has a different name 2. Override sys.path Both look really strange. Is there anything else? Thanks, Dmitry Panteleev -- https://mail.python.org/mailman/listinfo/python-list

Re: A strange statement in the bisect documentation?

2015-03-09 Thread Dmitry Chichkov
beceuse they don't expect the container to ever become large. On Friday, March 6, 2015 at 6:24:24 PM UTC-8, Steven D'Aprano wrote: > Dmitry Chichkov wrote: > > > I was looking over documentation of the bisect module and encountered the > > following very strange statemen

A strange statement in the bisect documentation?

2015-03-06 Thread Dmitry Chichkov
I was looking over documentation of the bisect module and encountered the following very strange statement there: >From https://docs.python.org/2/library/bisect.html ...it does not make sense for the bisect() functions to have key or reversed arguments because that would lead to an inefficient

[ANN] ErlPort (library to connect Erlang to Python) 1.0.0alpha released

2013-06-11 Thread Dmitry Vasilev
;} 2> python:call(P, roll, roll, [5]). Hello from 7747 Hello from 7749 Hello from 7751 Hello from 7753 Hello from 7755 [<0.34.0>,<0.37.0>,<0.40.0>,<0.43.0>,<0.46.0>] -- Dmitry Vasiliev http://hlabs.org http://twitter.com/hdima -- http://mail.python.org/mailman/listinfo/python-list

python+libxml2+scrapy AttributeError: 'module' object has no attribute 'HTML_PARSE_RECOVER'

2012-08-15 Thread Dmitry Arsentiev
Hello. Has anybody already meet the problem like this? - AttributeError: 'module' object has no attribute 'HTML_PARSE_RECOVER' When I run scrapy, I get File "/usr/local/lib/python2.7/site-packages/scrapy/selector/factories.py", line 14, in libxml2.HTML_PARSE_NOERROR + \ AttributeError: 'm

Re: True lists in python?

2010-12-18 Thread Dmitry Groshev
On Dec 19, 9:48 am, Vito 'ZeD' De Tullio wrote: > Dmitry Groshev wrote: > > Is there any way to use a true lists (with O(c) insertion/deletion and > > O(n) search) in python? For example, to make things like reversing > > part of the list with a constant time. &

Re: True lists in python?

2010-12-18 Thread Dmitry Groshev
On Dec 19, 9:18 am, Dmitry Groshev wrote: > Is there any way to use a true lists (with O(c) insertion/deletion and > O(n) search) in python? For example, to make things like reversing > part of the list with a constant time. I forgot to mention that I mean *fast* lists. It's trivia

True lists in python?

2010-12-18 Thread Dmitry Groshev
Is there any way to use a true lists (with O(c) insertion/deletion and O(n) search) in python? For example, to make things like reversing part of the list with a constant time. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some syntactic sugar proposals

2010-12-01 Thread Dmitry Groshev
On Nov 22, 2:21 pm, Andreas Löscher wrote: > >     if x in range(a, b): #wrong! > > it feels so natural to check it that way, but we have to write > >     if a <= x <= b > > I understand that it's not a big deal, but it would be awesome to have > > some optimisations - it's clearly possible to det

Re: Some syntactic sugar proposals

2010-11-15 Thread Dmitry Groshev
On Nov 15, 12:03 pm, alex23 wrote: > On Nov 15, 5:50 pm, Dmitry Groshev wrote: > > > On Nov 15, 10:30 am, alex23 wrote: > > > Personally, I like keeping object attribute references separate from > > > dictionary item references. > > > Your Python doe

Re: Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
On Nov 15, 10:30 am, alex23 wrote: > On Nov 15, 4:39 pm, Dmitry Groshev wrote: > > > First of all: how many times do you write something like > >     t = foo() > >     t = t if pred(t) else default_value > > ? Of course we can write it as > >     t = foo

Re: Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
On Nov 15, 9:48 am, Chris Rebert wrote: > On Sun, Nov 14, 2010 at 10:39 PM, Dmitry Groshev > wrote: > > Here are some proposals. They are quite useful at my opinion and I'm > > interested for suggestions. It's all about some common patterns. > > > Second,

Re: Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
On Nov 15, 9:39 am, Dmitry Groshev wrote: > Here are some proposals. They are quite useful at my opinion and I'm > interested for suggestions. It's all about some common patterns. > First of all: how many times do you write something like >     t = foo() >     t = t if p

Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
Here are some proposals. They are quite useful at my opinion and I'm interested for suggestions. It's all about some common patterns. First of all: how many times do you write something like t = foo() t = t if pred(t) else default_value ? Of course we can write it as t = foo() if pred(f

Re: Selecting k smallest or largest elements from a large list in python; (benchmarking)

2010-09-02 Thread Dmitry Chichkov
wrote: > On 9/1/2010 9:08 PM, Dmitry Chichkov wrote: > > > Your problem is underspecified;-). > Detailed timing comparisons are only valid for a particular Python > version running under a particular OS on particular hardware. So, to > actually run a contest, you would have to

Re: Selecting k smallest or largest elements from a large list in python; (benchmarking)

2010-09-02 Thread Dmitry Chichkov
By the way, improving n-ARG-smallest (that returns indexes as well as values) is actually more desirable than just regular n-smallest: == Result == 1.38639092445 nargsmallest 3.1569879055 nargsmallest_numpy_argsort 1.29344892502 nargsmallest_numpy_argmin Note that numpy array constructor eats aro

Re: Selecting k smallest or largest elements from a large list in python; (benchmarking)

2010-09-02 Thread Dmitry Chichkov
Uh. I'm sorry about the confusion. Last three items are just O(N) baselines. Python min(), Numpy argmin(), Numpy asarray(). I'll update the code. Thanks! > A lot of the following doesn't run or returns incorrect results. > To give but one example: > > > def nargsmallest_numpy_argmin(iter, k): > >

Selecting k smallest or largest elements from a large list in python; (benchmarking)

2010-09-01 Thread Dmitry Chichkov
Given: a large list (10,000,000) of floating point numbers; Task: fastest python code that finds k (small, e.g. 10) smallest items, preferably with item indexes; Limitations: in python, using only standard libraries (numpy & scipy is Ok); I've tried several methods. With N = 10,000,000, K = 10 The

Re: Functional composition in python

2010-08-28 Thread Dmitry Groshev
On Aug 29, 5:14 am, Steven D'Aprano wrote: > On Sat, 28 Aug 2010 21:30:39 +0400, Dmitry Groshev wrote: > > Hello all. Some time ago I wrote a little library: > >http://github.com/si14/python-functional-composition/, inspired by > > modern functional languages like F#.

Functional composition in python

2010-08-28 Thread Dmitry Groshev
Hello all. Some time ago I wrote a little library: http://github.com/si14/python-functional-composition/ , inspired by modern functional languages like F#. In my opinion it is quite useful now, but I would like to discuss it. An example of usage: import os from pyfuncomp import composable, c, _ d

HOW TO build object graph or get superclasses list for self.__class__ ?

2010-04-20 Thread Dmitry Ponyatov
Hello Help please with such problem: I need to build program object graph (data structure) with additional parameters for nodes and edges: include nxgraph # data structure module allowes any py objects for node/edge id # (nxgraph ignores 2+ node/edge adding thus no checking need at node/ edge ad

[gtk+thread] Why worker thread never wakes from time.sleep()?

2010-01-03 Thread Dmitry Teslenko
Hello! I have simple gui gtk app. It has worker thread that populates list with strings and gtk window with main loop which pops strings from this list and shows them in TreeView. Thread runs get_data_from_pcap to populate list with strings. Gtk app calls update_store() with gobject.timeout_add ev

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread Dmitry Teslenko
On Wed, Dec 30, 2009 at 18:25, aspineux wrote: > On Dec 30, 3:07 pm, Dmitry Teslenko wrote: >> On Wed, Dec 30, 2009 at 16:18, aspineux wrote: >> > On Dec 30, 1:34 pm, Dmitry Teslenko wrote: >> >> Hello! >> >> I'm making gui gtk application. I

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread Dmitry Teslenko
On Wed, Dec 30, 2009 at 16:18, aspineux wrote: > On Dec 30, 1:34 pm, Dmitry Teslenko wrote: >> Hello! >> I'm making gui gtk application. I'm using pypcap >> (http://code.google.com/p/pypcap/) to sniff some network packets. >> To avoid gui freezing I put p

call to pypcap in separate thread blocks other threads

2009-12-30 Thread Dmitry Teslenko
Hello! I'm making gui gtk application. I'm using pypcap (http://code.google.com/p/pypcap/) to sniff some network packets. To avoid gui freezing I put pcap call to another thread. Pypcap call looks like: pc = pcap.pcap() pc.setfilter('tcp') for ts, pkt in pc: spkt = str(pkt) ... Sa

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Dmitry A. Kazakov
ral always starts with decimal digit. That makes things simple for a descent recursive parser. I guess this choice was intentional, back in 1983 a complex parser would eat too much resources... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de -- http://mail.python.org/mailman/listinfo/python-list

Re: Advice for a replacement for plone.

2008-10-02 Thread Dmitry S. Makovey
disclaimer: I'm not affiliated with any company selling Plone services ;) I also have nothing against Django and such. Ken Seehart wrote: > I want a new python based CMS. ... One that won't keep me up all night > > > I've been fooling around with zope and plone, and I like plone for some

Re: is decorator the right thing to use?

2008-09-28 Thread Dmitry S. Makovey
George Sakkis wrote: > FYI, in case you missed it the final version doesn't need a Proxy base > class, just inherit from object. Also lowercased ProxyMethod to look > similar to staticmethod/classmethod: I cought that, just quoted the wrong one :) > class A(object): > > def __init__(self, b1

Re: is decorator the right thing to use?

2008-09-27 Thread Dmitry S. Makovey
George Sakkis wrote: > It's funny how often you come with a better solution a few moments > after htting send! The snippet above can (ab)use the decorator syntax > so that it becomes: > > class A(Proxy): > > @ProxyMethod > def bmethod(self): > return self.b1 > > @ProxyMethod

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
George Sakkis wrote: > You seem to enjoy pulling the rug from under our feet by changing the > requirements all the time :) but that's half the fun! ;) Bit more seriously - I didn't know I had those requirements until now :) I'm kind of exploring where can I get with those ideas. Initial post was

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: > That prohibits using a descriptor in the proxied classes, or at least > the proxied functions, since you break descriptor protocol and only > call __get__ once. Better to cache and get by name. It's only slower > by the normal amount, and technically saves space,

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
Bruno Desthuilliers wrote: > Hem... I'm afraid you don't really take Python's dynamic nature into > account here. Do you know that even the __class__ attribute of an > instance can be rebound at runtime ? What about 'once and for all' then ? must've been wrong wording on my part. Dynamic nature is

Re: is decorator the right thing to use?

2008-09-26 Thread Dmitry S. Makovey
Paul McGuire wrote: >> see, in your code you're assuming that there's only 1 property ( 'b' ) >> inside of A that needs proxying. In reality I have several. > > No, really, Diez has posted the canonical Proxy form in Python, using > __getattr__ on the proxy, and then redirecting to the contained

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Dmitry S. Makovey
Diez B. Roggisch wrote: > Well, you certainly want a desktop-orientied Linux for users, so you > chose ubuntu - but then on the server you go with a more stable debian > system. Even though the both have the same technical and even package > management-base, they are still incompatible wrt to packa

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Dmitry S. Makovey
Diez B. Roggisch wrote: > - different OS. I for one don't know about a package management tool > for windows. And while our servers use Linux (and I as developer as > well), all the rest of our people use windows. No use telling them to > apt-get instal python-imaging. that is a very valid poin

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
George Sakkis wrote: > I'm not sure if the approach below deals with all the issues, but one > thing it does is decouple completely the proxied objects from the > proxy: > class _ProxyMeta(type): It smelled to me more and more like metaclass too, I was just trying to avoid them :) Your code

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Dmitry S. Makovey
Scott Sharkey wrote: > Any insight into the best way to have a consistent, repeatable, > controllable development and production environment would be much > appreciated. you have just described OS package building ;) I can't speak for everybody, but supporting multiple platforms (PHP, Perl, Pytho

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: >> I kept this part of the problem out of this discussion as I'm pretty sure >> I can fill those in once I figure out the basic problem of >> auto-population of proxy methods since for each class/method those are >> going to be nearly identical. If I can autogenerate

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: > You should write it like this: > > class B(object): > @A.proxy > def bmethod(self,a): > > Making 'proxy' a class method on A. makes sense. > In case different A instances (do > you have more than one BTW?) yep. I have multiple instances of class

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Thanks Bruno, your comments were really helpful (so was the "improved" version of code). My replies below: Bruno Desthuilliers wrote: >> So decorators inside of B just identify that those methods will be >> proxied by A. On one hand from logical standpoint it's kind of weird to >> tell class th

Re: is decorator the right thing to use?

2008-09-25 Thread Dmitry S. Makovey
Diez B. Roggisch wrote: > Dmitry S. Makovey schrieb: >> Dmitry S. Makovey wrote: >>> In my real-life case A is a proxy to B, C and D instances/objects, not >>> just one. >> >> forgot to mention that above would mean that I need to have more than one >

Re: is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
Dmitry S. Makovey wrote: > In my real-life case A is a proxy to B, C and D instances/objects, not > just one. forgot to mention that above would mean that I need to have more than one decorator function like AproxyB, AproxyC and AproxyD or make Aproxy smarter about which property of

Re: is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
Aaron "Castironpi" Brady wrote: > It might help to tell us the order of events that you want in your > program. You're not using 'mymethod' or 'mymethod2', and you probably > want 'return fnew' for the future. Something dynamic with __getattr__ > might work. Any method call to A, that is an A

Re: is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
[EMAIL PROTECTED] wrote: > Your code below is very abstract, so it's kind of hard to figure out > what problem you're trying to solve, but it seems to me that you're > using the B proxy class to decorate the A target class, which means > you want one of these options: Sorry for unclarities in orig

is decorator the right thing to use?

2008-09-24 Thread Dmitry S. Makovey
Hi, after hearing a lot about decorators and never actually using one I have decided to give it a try. My particular usecase is that I have class that acts as a proxy to other classes (i.e. passes messages along to those classes) however hand-coding this type of class is rather tedious, so I decid

Re: file locked for writing

2008-05-14 Thread Dmitry Teslenko
On Wed, May 14, 2008 at 11:04 AM, Dmitry Teslenko <[EMAIL PROTECTED]> wrote: > When I've rewrite code something like that: >with open(backup_file_name, 'w') as backup_file: >. > >filter.parse('

Re: file locked for writing

2008-05-14 Thread Dmitry Teslenko
On Wed, May 14, 2008 at 8:18 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 13 May 2008 11:57:03 -0300, Dmitry Teslenko <[EMAIL PROTECTED]> > Is the code above contained in a function? So all references are released > upon function exit? Yes, it's a function

file locked for writing

2008-05-13 Thread Dmitry Teslenko
Hello! I use some script in python 2.5 from vim editor (it has python bindings) that updates some file and then launches another program (ms visual studio, for example) to do something with updated file. I faced problem when updated file is locked for writing until vim editor is closed. launch vim

Re: pygtk + threading.Timer

2008-04-14 Thread Dmitry Teslenko
2008/4/14 Jarek Zgoda <[EMAIL PROTECTED]>: > > I have simple chat application with pygtk UI. I want some event (for > > example update user list) to have place every n seconds. > > What's the best way to archive it? > > I tried threading.Timer but result is following: all events wait till > >

pygtk + threading.Timer

2008-04-14 Thread Dmitry Teslenko
Hello! I have simple chat application with pygtk UI. I want some event (for example update user list) to have place every n seconds. What's the best way to archive it? I tried threading.Timer but result is following: all events wait till exit of gtk main loop and only then they occur. Thanks in adv

Re: PyGTK localisation on Win32

2008-03-27 Thread Sukhov Dmitry
> > I had no problem with using standard gettext way of doing i18n on > Windows with PyGTK an Glade, apart some quirks with LANG environment > variable. Basically, the code that works looks like this: > > import gettext, locale > locale.setlocale(locale.LC_ALL, '') > if os.name == 'nt':

Re: draining pipes simultaneously

2008-03-05 Thread Dmitry Teslenko
On Wed, Mar 5, 2008 at 3:39 PM, <[EMAIL PROTECTED]> wrote: > time.sleep() pauses ony the thread that executes it, not the > others. And queue objects can hold large amount of data (if you have > the RAM), > so unless your subprocess is outputting data very fast, you should not > have data los

Re: draining pipes simultaneously

2008-03-05 Thread Dmitry Teslenko
On Wed, Mar 5, 2008 at 1:34 PM, <[EMAIL PROTECTED]> wrote: > The Queue.get method by default is blocking. The documentation is not > 100% clear about that (maybe it should report > the full python definition of the function parameters, which makes > self-evident the default value) but if you d

draining pipes simultaneously

2008-03-05 Thread Dmitry Teslenko
Hello! Here's my implementation of a function that executes some command and drains stdout/stderr invoking other functions for every line of command output: def __execute2_drain_pipe(queue, pipe): for line in pipe: queue.put(line) return def execute2(command, out_f

list classes in package

2008-01-16 Thread Dmitry
Hi All, I've trying to develop one Python application, and neet to solve one problem. I need to list all classes defined in one package (not module!). Could anybody please show me more convinient (correct) way to implement this? Thanks, Dmitry -- http://mail.python.org/mailman/listinfo/p

xml-filter with XMLFilterBase() and XMLGenerator() shuffles attributes

2007-12-20 Thread Dmitry Teslenko
Hello! I've made a trivial xml filter to modify some attributes on-the-fly: ... from __future__ import with_statement import os import sys from xml import sax from xml.sax import saxutils class ReIdFilter(saxutils.XMLFilterBase): def __init__(self, upstream, downstream):

Re: Need help with "with-statement-compatible" object

2007-12-19 Thread Dmitry Teslenko
On Dec 19, 2007 12:14 PM, Peter Otten <[EMAIL PROTECTED]> wrote: > def __enter__(self): > # ... > return self > > should help. That helps. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Need help with "with-statement-compatible" object

2007-12-19 Thread Dmitry Teslenko
Hello! I've made some class that can be used with "with statement". It looks this way: class chdir_to_file( object ): ... def __enter__(self): ... def __exit__(self, type, val, tb): ... def get_chdir_to_file(file_path): return chdir_to_file(file_path) ... Snippet with obj

Cookie expiration time

2007-12-17 Thread dmitry . ema
Hi All ! I'm using httplib2 library in my python script for interactions with remote web-server. Remote server responses me cookies with the set expiration time. I'd like to extend this time. Does anybody know how can I do it using this library ? -- http://mail.python.org/mailman/listinfo/pytho

Re: spawn background process and detach it w/o problems

2007-11-09 Thread Dmitry Teslenko
Hello! On 08/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Take a look at the subprocess module. Big thanks! It's interesting what's happening with subprocess.Popen instance after it has been instatiated and script's main thread exits leaving Popen'ed application open. -- http://mail.

[win32] spawn background process and detach it w/o problems

2007-11-08 Thread Dmitry Teslenko
Hello! How to write portable (win32, unix) script that launches another program and continues its execution? I've looked at spawn*() but it doesn't look in PATH dirs on windows so it's totally unusable when you don't know where exactly program is. I've looked at fork() way but there's no fork for

Re: python 2.5 scripting in vim on windows: subprocess problem

2007-10-24 Thread Dmitry Teslenko
On 22/10/2007, Andy Kittner <[EMAIL PROTECTED]> wrote: > >> Are you running this on vim or gvim? If you are running on gvim, my > >> guess is that the handles that you are passing are not valid. In > >> either case, try creating explicit handles that are valid (such as for > >> /dev/null) and creat

python 2.5 scripting in vim on windows: subprocess problem

2007-10-22 Thread Dmitry Teslenko
Hello! I'm using subprocess.Popen in python script in vim. It called this way: def some_func(): p = subprocess.Popen( command , stdout = subprocess.PIPE, stderr = subprocess.STDOUT) while True: s = p.stdout.readline()

Re: os.popen and lengthy operations

2007-09-26 Thread Dmitry Teslenko
Hello! On 24/09/2007, Tommy Nordgren <[EMAIL PROTECTED]> wrote: >Your problem is that you are not reading the standard output and > standard error streams in the correct way. > You need to do the reading of standard out and standard err in > parallell rather than sequentially. > The called

Re: [ANN] Release 0.65.1 of Task Coach

2007-09-25 Thread Dmitry Balabanov
> http://mail.python.org/mailman/listinfo/python-announce-list > > Support the Python Software Foundation: > http://www.python.org/psf/donations.html > -- Regards, Dmitry. -- http://mail.python.org/mailman/listinfo/python-list

os.popen and lengthy operations

2007-09-19 Thread Dmitry Teslenko
Hello! I'm using os.popen to perform lengthy operation such as building some project from source. It looks like this: def execute_and_save_output( command, out_file, err_file): import os def execute_and_save_output( command, out_file, err_file): (i,o,e) = os.popen3( command ) try:

Re: Basic question

2007-05-12 Thread Dmitry Dzhus
> Actually I'm trying to convert a string to a list of float numbers: > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] str="53,20,4,2" map(lambda s: float(s), str.split(',')) Last expression returns: [53.0, 20.0, 4.0, 2.0] -- Happy Hacking. Dmitry &qu

Re: Basic question

2007-05-12 Thread Dmitry Dzhus
ariable(s) in the target list; this > does not affect the next item assigned to it. In C you do not specify all the values the "looping" variable will be assigned to, unlike (in the simplest case) you do in Python. -- Happy Hacking. Dmitry "Sphinx" Dzhus http://sphinx.net.ru -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-11 Thread Dmitry V. Gorbatovsky
sychological claim" in that context. It is obvious that different medium of information exchange provides different levels of readability for humans. And accordingly easier/harder to learn/use. Regards, Dmitry -- http://mail.python.org/mailman/listinfo/python-list

Can't detect EOF from stdin on windows console

2006-04-03 Thread Dmitry Anikin
I want to read stdin in chunks of fixed size until EOF I want to be able (also) to supply data interactively in console window and then to hit Ctrl+Z when finished So what I do is: while True: s = sys.stdin.read(chunk_size) if not s: break # do something with s if stdin is standar

cmp() on integers - is there guarantee of returning only +-1 or 0?

2006-03-19 Thread Dmitry Anikin
doc says that it must be > 0, or < 0, but it seems that it returns +1 or -1. Can it be reliably used to get the sign of x: cmp(x, 0) like pascal Sign() function does? I mean, I'm pretty sure that it can be used, but is it mentioned somewhere in language spec, or it may be implementation defined? If

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Dmitry Anikin
Some example (from real life). def ChooseItems(StartDate, EndDate, Filter): #function returns a set of some items in chronological order #from required interval possibly using filter ChooseItems() #get everything ChooseItems('01.01.2000', ,SomeFilter) #get everything after a date using filter Choo

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Dmitry Anikin
Some example (from real life). def ChooseItems(StartDate, EndDate, Filter): #function returns a set of some items in chronological order #from required interval possibly using filter ChooseItems() #get everything ChooseItems('01.01.2000', ,SomeFilter) #get everything after a date using filter Choo

Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Dmitry Anikin
I mean, it's very convenient when default parameters can be in any position, like def a_func(x = 2, y = 1, z): ... (that defaults must go last is really a C++ quirk which is needed for overload resolution, isn't it?) and when calling, just omit parameter when you want to use defaults: a_func(,

Re: Python CGI discussion Group

2005-03-15 Thread Dmitry A.Lyakhovets
> > Regards, > > Fuzzy > http://www.voidspace.org.uk/python/cgi.shtml > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Best regards, Dmitry A. Lyakhovets mailto:[EMAIL PROTECTED] visit http://www.aikido-groups.ru -- Aikido Dojo site -- http://mail.python.org/mailman/listinfo/python-list

Re: brand new to python

2005-03-13 Thread Dmitry A.Lyakhovets
lines = string.split(servers, "\n") > servers = [] > for line in lines: > parts = string.split(string.strip(line)) > if not parts: continue > servers.append(parts[0], parts[1]) > rec.servers = servers > > m = > re.search("((?:(?:Administrative|Billing|Technical|Zone) > Contact,?[]*)+:)\n", page) > if m: > i = m.start() > m = re.search("Record last updated on", > page) j = m.start() > contacts = string.strip(page[i:j]) > > rec.contacts = > _ParseContacts_NetworkSolutions(contacts) > > return rec > > > ## > ## > - > - > ## > > def ParseWhois(page): > if string.find(page, "Registrar..: Register.com > (http://www.register.com)") != -1: > return ParseWhois_RegisterCOM(page) > else: > return ParseWhois_NetworkSolutions(page) > > > ## > ## > - > - > ## > > def usage(progname): > version = _version > print __doc__ % vars() > > def main(argv, stdout, environ): > progname = argv[0] > list, args = getopt.getopt(argv[1:], "", ["help", > "version", > "test"]) > > for (field, val) in list: > if field == "--help": > usage(progname) > return > elif field == "--version": > print progname, _version > return > elif field == "--test": > test() > return > > > for domain in args: > try: > page = whois(domain) > print page > except NoSuchDomain, reason: > print "ERROR: no such domain %s" % domain > > if __name__ == "__main__": > main(sys.argv, sys.stdout, os.environ) > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Best regards, Dmitry A. Lyakhovets mailto:[EMAIL PROTECTED] visit http://www.aikido-groups.ru -- Aikido Dojo site -- http://mail.python.org/mailman/listinfo/python-list

some question about tp_basicsize

2005-02-10 Thread Dmitry Belous
Hi, All I use C++ to create new types(inherited from PyTypeObject) and objects(inherited from PyObject) and virtual destructor to destroy objects. sizeof() is different for different objects and therefore i don't know what i must do with tp_basicsize. Will the following source code work? Must i s

Re: MP3 - VBR - Frame length in time

2004-12-08 Thread Dmitry Borisov
mp3 and all the layers. > > Tooling or links also really welcome. My own googling has helped me some but > on the subject of VBR I get stuck. Try mmpython. It has something to deal with the VBR tags( XING header ). Dmitry/ -- http://mail.python.org/mailman/listinfo/python-list