Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Patrick Stinson
I am writing a python app (using PyQt, but that’s not important here), and want my users to be able to write their own scripts to automate the app’s functioning using an engine API hat I expose. I have extensive experience doing this in a C++ app with the CPython api, but have no idea how to do

unloading a module created with imp.new_module

2014-11-23 Thread Patrick Stinson
If I create a module with imp.new_module(name), how can I unload it so that all the references contained in it are set to zero and the module is deleted? deleting the reference that is returned doesn’t seem to do the job, and it’s not in sys.modules, so where is the dangling reference? Thanks!

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
.. done __del__ I the “__del__" to come between “deleting…” and “done”. This is not being run from the interactive interpreter by via a .py file. > On Nov 23, 2014, at 12:56 AM, Ian Kelly wrote: > > On Sun, Nov 23, 2014 at 2:48 AM, Ian Kelly wrote: >> On Sat, Nov 22, 2014

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
to automate your app? Thanks! > On Nov 23, 2014, at 12:24 AM, Chris Angelico wrote: > > On Sun, Nov 23, 2014 at 4:48 PM, Patrick Stinson > wrote: >> I am writing a python app (using PyQt, but that’s not important here), and >> want my users to be able to write their own sc

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
On Nov 23, 2014, at 5:56 PM, Ned Batchelder wrote: > > On 11/23/14 1:49 AM, Patrick Stinson wrote: >> If I create a module with imp.new_module(name), how can I unload it so that >> all the references contained in it are set to zero and the module is >> deleted?

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
ico wrote: > > On Sun, Nov 23, 2014 at 9:28 PM, Patrick Stinson > wrote: >> Thanks for your great reply. I even augmented the reloading with the same >> dict by clearing all of the non-standard symbols from the dict. This >> effectively resets the dict: > > You may

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
ote: > > > On Nov 23, 2014 4:10 AM, "Patrick Stinson" <mailto:patrickk...@gmail.com>> wrote: > > m = types.ModuleType('mine') > > exec(s, m.__dict__) > > print('deleting...') > > m = None > > print('done') >

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
> On Nov 24, 2014, at 6:12 AM, Ian Kelly wrote: > > > On Nov 24, 2014 1:27 AM, "Patrick Stinson" <mailto:patrickk...@gmail.com>> wrote: > > > > How does the __del__ method have a reference to the module’s globals dict? > > because it refe

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
> On Nov 24, 2014, at 2:44 AM, Ned Batchelder wrote: > > On 11/23/14 5:10 AM, Patrick Stinson wrote: >> I am defining a single class with a destructor method that prints >> ‘__del__’, and running that source code string using exec with the >> module’s dict li

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
> On Nov 23, 2014, at 4:57 AM, Chris Angelico wrote: > > On Mon, Nov 24, 2014 at 12:20 AM, Patrick Stinson > wrote: >> I think this is the way I’ll take it, and for all the same reasons. The only >> way they can break it is if they really want to. I guess anythin

Re: Python and GUI development

2014-12-01 Thread Patrick Stinson
I’ve been using PyQt for 10 years. Absolutely fabulous, fun, and I imagine the others are also excellent as they have all been around long enough to die naturally if they were not very useful. > On Dec 1, 2014, at 3:13 AM, Chris Angelico wrote: > > On Mon, Dec 1, 2014 at 10:55 PM, Ganesh Pal

surprise - byte in set

2015-01-03 Thread patrick vrijlandt
t;>> b'b' in b'abc' True >>> 'b' in set('abc') True >>> b'b' in set(b'abc') False I was surprised by the last result. What happened? (Examples simplified; I was planning to manipulate the set) Patrick --- Dit e-

Re: surprise - byte in set

2015-01-03 Thread patrick vrijlandt
Dear all, Many thanks for your responses. I never realised this difference between 'bytes' and 'string'. Thanks, Patrick --- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread patrick vrijlandt
restart(): > > This may be caused by the code before 'def'. Post the whole program. It may also have to do with having both tabs and spaces in one source file. Python cannot recognise the indentation if you do that. Replace al tabs by 4 spaces. -- patrick -- https://mail.python.org/mailman/listinfo/python-list

personal library

2013-10-29 Thread patrick vrijlandt
brary on a network share and local copies on each computer, but of course I forget to synchronise often enough. As said, python is a hobby, and the solution should be as lightweight as possible! I'm usually on windows (vista, xp or 7). Thanks! -- patrick -- https://mail.python.org/mailman/

Re: personal library

2013-10-30 Thread patrick vrijlandt
e way to go, or is there another "distributed version control system" that I should shortlist? -- patrick -- https://mail.python.org/mailman/listinfo/python-list

Re: personal library

2013-10-31 Thread patrick vrijlandt
gt; enough with the basics to clone someone else's project, pull changes > from upstream, and see where it's at. > > ChrisA Thank you all. I will download and start learning! -- patrick -- https://mail.python.org/mailman/listinfo/python-list

Re: "Backward"-Iterator - Beginners question

2013-11-01 Thread patrick vrijlandt
with Your hints I get what I want. Well, if you want to iterate over a SQL result backwards, I would seriously consider modifying the SELECT to yield the results in the right order. That would avoid keeping the list in memory and makes best use of the database. -- patrick -- https://mail.python

Re: How can I export data from a website and write the contents to a text file?

2015-11-19 Thread Patrick Hess
l vary depending on the operating system, are chosen automatically. with open("test.txt", "w") as textfile: textfile.write("line 1\n") textfile.write("line 2") This produces "line 1\nline 2" on Unix systems and "line 1\r\nline 2" on Windows. Also involves less typing this way. ;-) Patrick -- https://mail.python.org/mailman/listinfo/python-list

Assigning generator expressions to ctype arrays

2011-10-27 Thread Patrick Maupin
Bug or misunderstanding? Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x = 32 * [0] >>> x[:] = (x for x in xrange(32)) >>> from ctypes import c_uint >>> x = (32 * c_uint)() >>> x[:] = xrange(32) >>

Re: Assigning generator expressions to ctype arrays

2011-10-27 Thread Patrick Maupin
On Oct 27, 5:31 pm, Steven D'Aprano wrote: > From the outside, you can't tell how big a generator expression is. It has no > length: I understand that. > Since the array object has no way of telling whether the generator will have > the correct size, it refuses to guess. It doesn't have to gu

Re: __dict__ attribute for built-in types

2011-10-27 Thread Patrick Maupin
On Oct 27, 9:46 pm, candide wrote: > Le 28/10/2011 02:02, MRAB a crit : > > > > > No, built-in classes written in C have certain limitations, but why > > would you want to do that anyway? > > Mainly for learning purpose and Python better understanding. > > Actually, I have a class of mine for draw

Re: Assigning generator expressions to ctype arrays

2011-10-28 Thread Patrick Maupin
On Oct 27, 10:23 pm, Terry Reedy wrote: > I do not think everyone else should suffer substantial increase in space > and run time to avoid surprising you. What substantial increase? There's already a check that winds up raising an exception. Just make it empty an iterator instead. > > It vio

Re: Assigning generator expressions to ctype arrays

2011-10-28 Thread Patrick Maupin
On Oct 28, 3:19 am, Terry Reedy wrote: > On 10/28/2011 3:21 AM, Steven D'Aprano wrote: > > > If the slice has too few elements, you've just blown away the entire > > iterator for no good reason. > > If the slice is the right length, but the iterator doesn't next raise > > StopIteration, you've jus

Re: Assigning generator expressions to ctype arrays

2011-10-28 Thread Patrick Maupin
On Oct 28, 4:51 pm, Patrick Maupin wrote: > On Oct 28, 3:19 am, Terry Reedy wrote: > > > On 10/28/2011 3:21 AM, Steven D'Aprano wrote: > > > > If the slice has too few elements, you've just blown away the entire > > > iterator for no good reason. >

Re: Assigning generator expressions to ctype arrays

2011-10-28 Thread Patrick Maupin
On Oct 28, 8:01 pm, Steven D'Aprano > > ALREADY LOSES DATA if the iterator isn't the right size and it raises an > > exception. > > Yes. What's your point? This fact doesn't support your proposal in the > slightest. You earlier made the argument that "If the slice has too few elements, you've just

Re: Assigning generator expressions to ctype arrays

2011-10-29 Thread Patrick Maupin
On Oct 28, 3:24 pm, Terry Reedy wrote: > On 10/28/2011 2:05 PM, Patrick Maupin wrote: > > > On Oct 27, 10:23 pm, Terry Reedy  wrote: > >> I do not think everyone else should suffer substantial increase in space > >> and run time to avoid surprising you. > >

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Patrick Maupin
On Mon, Oct 31, 2011 at 4:08 PM, Dave Angel wrote: Yes. Actually, you don't even need the split() -- you can pass an optional deletechars parameter to translate(). On Oct 31, 5:52 pm, Ian Kelly wrote: > That sounds overly complicated and error-prone. Not really. > For instance, split() wil

Re: Efficient, built-in way to determine if string has non-ASCII chars outside ASCII 32-127, CRLF, Tab?

2011-10-31 Thread Patrick Maupin
On Oct 31, 9:12 pm, Dave Angel wrote: > I would claim that a well-written (in C) translate function, without > using the delete option, should be much quicker than any python loop, > even if it does copy the data. Are you arguing with me? I was agreeing with you, I thought, that translate would

Re: Question about metaclass

2011-11-01 Thread Patrick Maupin
On Nov 1, 11:02 pm, Makoto Kuwata wrote: > Hi, > > I want to define a special class which groups functions, like: > >     class Greepting(FuncGroup): >         def hello():          # no self, no @staticmethod! >             print("Hello!") >         def goodbye():        # no self, no @staticmeth

Re: match, concatenate based on filename

2011-11-03 Thread Patrick Maupin
On Nov 3, 9:55 pm, Matt wrote: > Hi All, > > I am trying to concatenate several hundred files based on their filename..   > Filenames are like this: > > Q1.HOMOblast.fasta > Q1.mus.blast.fasta > Q1.query.fasta > Q2.HOMOblast.fasta > Q2.mus.blast.fasta > Q2.query.fasta > ... > Q1223.HOMOblast.fasta

Pythonbrew is not installing Python 2.7 successfully

2011-12-05 Thread Patrick Wayodi
ew install --force python27 root@debian:~# The log file build.log was empty. Please help me. Patrick. -- http://mail.python.org/mailman/listinfo/python-list

[JOB] Two opportunities at Decernis

2013-04-28 Thread Patrick Waldo
, cgam...@decernis.com. Best Patrick Project Manager Decernis News & Issue Management *Job Description: Full-Time Senior Software Engineer* We are looking for a highly effective senior software engineer with experience in both development and client interaction. Our company provides gl

Re: Problem overriding sys.excepthook

2006-01-01 Thread Patrick Maupin
Lunchtimemama wrote: > Yo all, I'm getting into Python for the first time and I'm really > having a blast. I've hit a bit of a snag and was wondering if someone > could lend some insight. Here be the code: > > import sys > def myexcepthook(type, value, tb): > import traceback > rawreport = tra

Re: Problem overriding sys.excepthook

2006-01-01 Thread Patrick Maupin
Lunchtimemama wrote: > Forgive my ignorance, but I'm not quite sure what you mean. I tried > importing the traceback module at the beginning of the script, but that > didn't make a difference. Could you provide example code to illustrate > your comment? Thanks. Assume your main module has your ex

Re: Problem overriding sys.excepthook

2006-01-02 Thread Patrick Maupin
Lunchtimemama wrote: > What is the superior method of exception handling: ... For a start, note that the exception hook does not _really_ have to be in the main module, just imported before any "protected" code is to be executed. Having said that, what I personally typically do for exception trap

Re: Translate this to python?

2006-01-03 Thread Patrick Maupin
> for (i = nPoints-1, j = 0; j < nPoints; i = j, j++) A simple translation of this would be: i = npoints-1 for j in range(npoints): ... (your code here) i = j HTH, Pat -- http://mail.python.org/mailman/listinfo/python-list

Re: Translate this to python?

2006-01-03 Thread Patrick Maupin
> for (i = nPoints-1, j = 0; j < nPoints; i = j, j++) Alternatively, if you don't like the initial setup of i and would prefer your setup code at the top of the loop: for j in range(npoints): i = (j-1) % npoints ... (your code here) Finally, you could always do something like this: poin

Re: Calling GPL code from a Python application

2006-01-03 Thread Patrick Maupin
Mike Meyer wrote: .> Note that I'm *not* interpreting the GPL. I'm interpreting what the > FSF says about the GPL. If the goal is to avoid a lawsuit, the latter > is what you have to pay attention to, as they're telling you what > actions you can take without getting sued. The text comes into play

Re: Calling GPL code from a Python application

2006-01-03 Thread Patrick Maupin
Mike Meyer wrote: .> Note that I'm *not* interpreting the GPL. I'm interpreting what the > FSF says about the GPL. If the goal is to avoid a lawsuit, the latter > is what you have to pay attention to, as they're telling you what > actions you can take without getting sued. The text comes into play

Re: Calling GPL code from a Python application

2006-01-03 Thread Patrick Maupin
Mike Meyer wrote: .> Note that I'm *not* interpreting the GPL. I'm interpreting what the > FSF says about the GPL. If the goal is to avoid a lawsuit, the latter > is what you have to pay attention to, as they're telling you what > actions you can take without getting sued. The text comes into play

Re: Translate this to python?

2006-01-03 Thread Patrick Maupin
Peter Hansen wrote: > Though, without knowing what the body does, one can't be sure > that's going to be a faithful translation. The for loop in Python > always iterates over the entire set of items given to it, unless > it's told to break early. But if "j" or "nPoints" is modified in the > body

Re: Occasional OSError: [Errno 13] Permission denied on Windows

2006-01-05 Thread Patrick Maupin
Alec Wysoker wrote: > Using Python 2.3.5 on Windows XP, I occasionally get OSError: > [Errno 13] Permission denied when calling os.remove(). This can > occur with a file that is not used by any other process on the > machine, and is created by the python.exe invocation that is > trying to delete

Re: Occasional OSError: [Errno 13] Permission denied on Windows

2006-01-05 Thread Patrick Maupin
Tim Peters wrote: > In that case, anything that burns some time and tries again > will work better. Replacing gc.collect() with time.sleep() is > an easy way to test that hypothesis; because gc.collect() > does an all-generations collection, it can consume measurable time. An slight enhancemen

Re: Apology Re: Is 'everything' a refrence or isn't it?

2006-01-09 Thread Patrick Maupin
Mike Meyer wrote: > This is where we disagree. I think their understanding of references > is dead on. What's broken is their understanding of what variables are > and what assignments mean. Once you fix that, the rest falls into > place. > > (Steven D'Aprano wrote:) > > The fact that call by objec

Re: Apology Re: Is 'everything' a refrence or isn't it?

2006-01-09 Thread Patrick Maupin
Mike Meyer wrote: > This is where we disagree. I think their understanding of references > is dead on. What's broken is their understanding of what variables are > and what assignments mean. Once you fix that, the rest falls into > place. > > (Steven D'Aprano wrote:) > > The fact that call by objec

Re: Apology Re: Is 'everything' a refrence or isn't it?

2006-01-09 Thread Patrick Maupin
Mike Meyer wrote: > This is where we disagree. I think their understanding of references > is dead on. What's broken is their understanding of what variables are > and what assignments mean. Once you fix that, the rest falls into > place. > > (Steven D'Aprano wrote:) > > The fact that call by objec

Re: Apology Re: Is 'everything' a refrence or isn't it?

2006-01-09 Thread Patrick Maupin
Mike Meyer wrote: > This is where we disagree. I think their understanding of references > is dead on. What's broken is their understanding of what variables are > and what assignments mean. Once you fix that, the rest falls into > place. > > (Steven D'Aprano wrote:) > > The fact that call by objec

How to create a script that list itself ?

2006-01-09 Thread Patrick Allaire
How to create a script that list itself ? I would like to know, where is the script's code is stored once we start it. I know I can achieve that, using files : print file('myscript.py','rb').read() But is there a way / a variable that contains the current file in memory ? Thanks. Xaqc -- htt

filtering DNS proxy

2006-01-14 Thread Patrick Useldinger
Hi all, I am looking to write a filtering DNS proxy which should - receive DNS queries - validate them again an ACL which looks as follows: { 'ip1':['name1','name2',...], 'ip2':['name1','name3'], ... } - if the request is valid (ie. if the sending IP address is allowed to ask for t

Re: Coding style

2006-07-17 Thread Patrick Maupin
PTY wrote: > It looks like there are two crowds, terse and verbose. I thought terse > is perl style and verbose is python style. BTW, lst = [] was not what > I was interested in :-) I was asking whether it was better style to > use len() or not. It's not canonical Python to use len() in this c

Re: wanting

2006-07-18 Thread Patrick Bothe
placid wrote: > this is one of my aims in life, to bloody understand this 1337 speak! 100k h3r3, 8|2o: http://www.1337.net/ Regards, Patrick Ps: The translator might come in handy. -- 2 does not equal 3. Even for large values of 2. -- http://mail.python.org/mailman/listinfo/pyt

Re: Coding style

2006-07-18 Thread Patrick Maupin
Carl Banks wrote: > Here's another reason not to use "if lst". Say you have a function > that looks like this: > > def process_values(lst): > if not lst: > return > do_expensive_initialization_step() > for item in lst: > do_something_with(item)

Re: Coding style

2006-07-18 Thread Patrick Maupin
Daniel Dittmar wrote: > > Premature generalization: the new 'premature optimization'. Premature specialization: the new 'static typing'. -- Pat -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Patrick Maupin
Christophe wrote: > > The perverse wish, expressed in the specific example, that SOME piece > > of code SOMEWHERE should PLEASE throw an exception because some idiot > > passed a generator expression rather than a list into a function, is > > not apt to be well received by an audience which strive

Re: Coding style

2006-07-19 Thread Patrick Maupin
Terry Reedy wrote: > > > Carl Banks wrote: > >> def process_values(lst): > >> if not lst: > >> return > >> do_expensive_initialization_step() > >> for item in lst: > >> do_something_with(item) > >> do_expensive_finalization_step() > > Give

Re: using names before they're defined

2006-07-22 Thread Patrick Maupin
[EMAIL PROTECTED] wrote: > I have a problem. I'm writing a simulation program with a number of > mechanical components represented as objects. When I create instances > of objects, I need to reference (link) each object to the objects > upstream and downstream of it, i.e. > > supply = supply() > c

Re: regex for replacing \r\n

2006-08-07 Thread Patrick Bothe
ith a simple string `.replace`: >>> s = 'This is a message\r\non a new line' >>> print s This is a message on a new line >>> s.replace('\r\n', 'BLAH') >>> print s 'This is a messageBLAHon a new line' Regards, Patri

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Patrick Maupin
Diez B. Roggisch wrote: > Martin Höfling wrote: > > > is it possible to put the methods of a class in different files? I just > > want to order them and try to keep the files small. > > No, its not possible. What you can do is to create several classes and one > that inherits from all of them. > >

Re: Import module with non-standard file name

2006-08-07 Thread Patrick Maupin
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? This is a piece of cake in Python. >>> from types import ModuleType >>> x = ModuleType('myModName') >>> data = open('myfilename').

Re: Question on try/except

2006-08-07 Thread Patrick Maupin
Kirk McDonald wrote: > Dan wrote: > > Is there some particular use in catching an exception and immediately > > re-raising it? Why catch it at all? > > All I can think of is that it changes the traceback to point to the > re-raise and not the original raise. I've used this technique before. It

Re: [OT] why cd ripping on Linux is so slow

2006-08-12 Thread Patrick Useldinger
alf wrote: > Hi, > > I try to ip some music CD and later convert it into mp3 for my mp3 > player, but can not get around one problem. ripping from Linux is > extremely slow like 0.5x of CD speed. > > In contrary, on M$ Windows it takes like a few minutes to have CD ripped > and compresses int

Re: no longer can set breakpoint on 'pass' statement?

2006-08-16 Thread Patrick Maupin
I don't know for sure if this is the issue, but Python _used_ to include line number information in the actual codestream (via instructions), and now I think it's a separate table for speed reasons. So perhaps the previous ability to set breakpoints on pass instructions was merely an artifact of c

Re: It is __del__ calling twice for some instances?

2006-08-18 Thread Patrick Maupin
Duncan Booth wrote: > Duncan Booth wrote: > > > As to why it happens, there is a mechanism in Python to stop unlimited > > stack being used when objects are freed: when the stack gets too deep > > then instead of being released, the Py_DECREF call puts the object > > into a trashcan list and the o

Re: how do you get the name of a dictionary?

2006-08-21 Thread Patrick Maupin
jojoba wrote: > hello > > im quite surprised at the arrogance laid out by some of the above > posters: > > However, does it not seem reasonable to ask python: > > Given a dicitionary, Banana = {} > return one or more strings, > where each string is the name(s) of the reference(s) to Banana. > > wh

Re: setuid root

2006-08-24 Thread Patrick Useldinger
Tiago Simões Batista wrote: > The sysadmin already set the setuid bit on the script, but it > still fails when it tries to write to any file that only root has > write access to. use sudo. -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Patrick Maupin
[EMAIL PROTECTED] wrote: > Aahz> Taking a look at __slots__ is fine as long as you don't actually > Aahz> use them. > > Gabriel> Why? > http://groups.google.com/group/comp.lang.python/browse_thread/thread/451ad25f9c648404/f4ac2dfde32b16fd?lnk=st&q=Python+__slots__+aahz&rnum=2#f4ac2dfde32b16

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Patrick Maupin
fd?lnk=st&q=Python+__slots__+aahz&rnum=2#f4ac2dfde32b16fd > > Patrick> The subject of __slots__ really seems to get some people's > Patrick> dander up, to the extent where the heat/light ratio in the > Patrick> discussion becomes uncomfortably high. Ri

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Patrick Maupin
Jarek Zgoda wrote: > Having that said, should we hope __slots__ would disappear in (some) > future (tomorrow?!, in next 10 microseconds?!)? Please, don't left us > hopeless. > Are you saying you _do_ hope that __slots__ disappear? Why? Regards, Pat -- http://mail.python.org/mailman/listinfo/p

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-27 Thread Patrick Maupin
Jacob Hallen wrote: > Patrick Maupin <[EMAIL PROTECTED]> wrote: > >Also, as I noted, I _do_ use them on occasion, so if there really _are_ > >potential pitfalls there, I would like to understand exactly what they > >are, so my ears perk up whenever I notice a __slots__

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-28 Thread Patrick Maupin
Dieter Maurer wrote: > "Patrick Maupin" <[EMAIL PROTECTED]> writes on 26 Aug 2006 12:51:44 -0700: > > ... > > The only > > problem I personally know of is that the __slots__ aren't inherited, > > "__slots__" *ARE* inherited, although t

Re: OO on python real life tutorial?

2006-09-02 Thread Patrick Thomson
http://wiki.wxpython.org/index.cgi/wxPythonPit_Apps) showcases projects both small and expansive. -- Patrick Thomson -- http://mail.python.org/mailman/listinfo/python-list

Re: Random image downloader for newsgroups (first script)

2006-09-07 Thread Patrick Ellis
Kim wrote: > Random image downloader for specified newsgroup. Hi I'm writing a > small script that will download random images from a specified > newsgroup. I've imported yenc into the script but I can't open the > image or save it. This is my first script so be gentle! > > Heres the script > > > #

Re: Looking for the Perfect Editor

2006-09-15 Thread Patrick Thomson
Personally, I use the non-free but absolutely phenomenal TextMate (http://macromates.com/), but I've enjoyed my work with jEdit (http://www.jedit.org/) and, of course, (X)Emacs. -- http://mail.python.org/mailman/listinfo/python-list

wxPython and threading issue

2006-09-28 Thread Patrick Smith
Hi, I'm hoping someone here will be able to help as I've been struggling with this problem for a few days now. I'm working on an application that is creating a ProgressDialog, and then creating a thread that runs a function from another module in the program. The problem is, when the cancel butto

Re: wxPython and threading issue

2006-09-28 Thread Patrick Smith
Hi, Thanks for your reply. <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Patrick Smith wrote: > > Hi, > > I'm hoping someone here will be able to help as I've been struggling with > > this problem for a few days now. > > > >

Re: wxPython and threading issue

2006-09-29 Thread Patrick Smith
> Well, the problem is that you can't simply kill a thread--it shares > memory with other threads that it could be leaving in an inconsistent > state. Imagine that it was, say, holding a lock when it was forceably > killed. Now any other thread that tries to acquire that lock will > block forever

Re: wxPython and threading issue

2006-09-29 Thread Patrick Smith
"Nick Vatamaniuc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If your thread is long running and it is not possible to easily set a > flag for it to check and bail out, then how does it display the > progress in the progress dialog. How often does that get updated? If > the progr

Modules - Jython Vs Python?

2006-11-24 Thread Patrick Finnegan
How many of the Python modules written in C have been rewritten and and ported to Java to run under Jython? I am talking about SMTP, LDAP, WIN2K,XML etc. Is there a list anywhere ? Thanks Patrick. -- http://mail.python.org/mailman/listinfo/python-list

Re: What is proper way to require a method to be overridden?

2007-01-05 Thread Patrick Down
jeremito wrote: > I am writing a class that is intended to be subclassed. What is the > proper way to indicate that a sub class must override a method? > > Thanks, > Jeremy Decorators to the rescue? def must_override(f): def t(*args): raise NotImplementedError("You must override " +

Re: still struggling, howto use a list-element as a name ?

2007-01-06 Thread Patrick Mullen
You would use setattr to bind a name that you don't know: for pin in self.pin: setattr(self,pin.Name,pin.Value) However, I'm not sure why you're using a dictionary in this way. I don't totally understand the context, so I may be wrong, but I would code it more like this: class Power_Supply(d

Re: list comprehention

2006-01-23 Thread Patrick Maupin
Duncan Booth showed how to solve a problem posed by Mathijs. This is very similar to Duncan's solution, except I (ab)use setdefault on a regular basis... >>> def occurrences(t): ... res = {} ... for item in t: ... res.setdefault(item,[0])[0] += 1 ... return res ... >>> ref = [

Re: list comprehension

2006-01-24 Thread Patrick Maupin
Duncan Booth wrote: > I prefer writing an 'if' statement here, Bryan prefers 'get', that's just a > choice of style. But 'setdefault' here, that has no style. Well, I'm often told I have no style, and I _did_ admit that it's an abuse of setdefault. However, I often use setdefault to populate nes

Re: If - Or statements

2005-06-07 Thread Patrick Down
What about: if True in [thefile.endswith(x) for x in ('mp3','mp4','ogg','aac','wma')]: -- http://mail.python.org/mailman/listinfo/python-list

contract python developer in Campbell is needed at Stratalight

2005-06-14 Thread Patrick Melone
style and the ability to work independently and in a team environment. · Strong organizational and problem solving abilities   If interested please contact:   Patrick Melone StrataLight Communications [EMAIL PROTECTED] ph) 408/961-6250 fax)408/626-9440   -- http

Re: Python in Games (was RE: [Stackless] Python in Games)

2005-06-14 Thread Patrick Down
My understanding is that the upcoming Civilization IV will have python scripting. -- http://mail.python.org/mailman/listinfo/python-list

pictures database project ?

2007-06-20 Thread Patrick Peccatte
Hi, Is anybody knows any pictures database project written in Python ? Search engine and true database needed (preferably MySQL) I am looking for something similar to "Gallery" (written in PHP), see http://gallery.menalto.com/ -- Patrick Peccatte www.softexperience.com

Python in Nashville

2007-07-20 Thread Patrick Altman
Anyone on this group writing Python code in Nashville, TN? -- http://mail.python.org/mailman/listinfo/python-list

Importing * From a Package

2007-08-06 Thread Patrick Doyle
Reading through the Python tutorial, I got to section 6.4.1, "Importing * From a Package", which states: "If __all__ is not defined, the statement from Sound.Effects import * does not import all submodules from the package Sound.Effects into the current namespace; ..." It then goes on to state:

Re: Importing * From a Package

2007-08-07 Thread Patrick Doyle
> There's no reliable way to differentiate between names which you defined > using something other than an import statement, names you defined with an > import statement with the intent of publishing them as part of your external > API, and names you defined with an import statement which you only

Re: Importing * From a Package

2007-08-07 Thread Patrick Doyle
On 7 Aug 2007 13:54:21 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Patrick Doyle" <[EMAIL PROTECTED]> wrote: > > > Why does Python include the submodules that were explicitly loaded by > > previous imports? Does it go out of it's way to do so? If

Re: check if regeular expression has results

2007-08-09 Thread Patrick Doyle
On 8/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > I'm looking for the best way to check if regular expression return > true (it's mean - there is a match). for example, i want "if" that > check if this regular expression: .*born.*to.* has a match. > > What's the way to do that simply?

Re: pure python gaussian blur

2007-08-14 Thread Patrick Doyle
On 8/14/07, Gerdus van Zyl <[EMAIL PROTECTED]> wrote: > Does anyone have a relatively fast gaussian blur implemented in pure > python? Below is my attempt but it takes 2.9 seconds for a 320x240 > image. Image comes from byte string: self.array = > array.array('B',srcstring). Would some sort of matr

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-04 Thread Patrick Useldinger
http://www.serpentine.com/blog/2006/12/22/how-to-build-safe-clean-python-25-rpms-for-fedora-core-6/ -- http://mail.python.org/mailman/listinfo/python-list

httplib/socket problems reading 404 Not Found response

2007-03-12 Thread Patrick Altman
20B4C0D0C48B2EF x-amz-id-2: Content-Type: application/xml Transfer-Encoding: chunked Date: Tue, 13 Mar 2007 02:54:16 GMT Server: AmazonS3 Am I doing something wrong? Is this a known issue? I am an experienced developer, but pretty new to Python and dynamic languages in general. Thanks, Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: httplib/socket problems reading 404 Not Found response

2007-03-13 Thread Patrick Altman
> Yes, it's a known problem. See this message with a > self-response:http://mail.python.org/pipermail/python-list/2006-March/375087.html Are there plans to include this fix in the standard Python libraries or must I make the modifications myself (I'm running Python 2.5)? -- http://mail.python.

Re: httplib/socket problems reading 404 Not Found response

2007-03-14 Thread Patrick Altman
On Mar 13, 3:16 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 13 Mar 2007 10:38:24 -0300, Patrick Altman <[EMAIL PROTECTED]> > escribió: > > >> Yes, it's a known problem. See this message with a > >> self-response:http://mail.p

Re: if __name__ == 'main':

2007-03-20 Thread Patrick Down
On Mar 20, 11:49 am, "gtb" <[EMAIL PROTECTED]> wrote: > Hi, > > I often see the following 'if' construct in python code. What does > this idiom accomplish? What happens if this is not main? How did I get > here if it is not main? A quick example demonstrates the usage: C:\code>type temp.py prin

RE: Python COM Outlook Question

2007-03-21 Thread Patrick Vrijlandt
Hi, It seems that space.Folders["DailyGoodEmails"] might be a valid expression; otherwise you might have experiment with space.GetSharedDefaultFolder() HTH, Patrick -Oorspronkelijk bericht- On Mar 21, 2:15 pm, "liam_herron" <[EMAIL PROTECTED]> wrote: > Say

Simple Text Processing Help

2007-10-14 Thread patrick . waldo
like: kyselina močová I get: 200-720-7|69-93-2|kyselina|močová |C5H4N4O3|200-763-1|71-73-8|nátrium-tiopentál and then it is all off. How can I get Python to realize that a chemical name may have a space in it? Thank you, Patrick So far I have: #take tables in one text file and organize them into lin

<    1   2   3   4   5   6   7   >