Re: Class methods in Python/C?

2004-11-30 Thread Craig Ringer
d to worry about older code. Thanks. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Run an python method from C++

2004-11-30 Thread Craig Ringer
PyMapping_GetItemString(globals, "errorMsg") QString errorMsg = PyString_AsString(errorMsgPyStr); (I'd love to be told there's a nicer way to do this). This could easily be the wrong way to go about things, buggy, or just stupid, so be warned. It does work well here, however. I would be interested in knowing how to tell Python what encoding is used for program text passed using PyRun_String() if anybody knows. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Help] (fwd)

2004-12-05 Thread Craig Ringer
t;>> x [1] >>> x.append(5) >>> x [1,5] >>> sum(x) 6 >>> sum(x) / len(x) 3 As you can see, it's much easier to work with data in lists. Some of the other methods, like list.sort() and list "slices" will also be useful to you, but I'll let

Writing class factories with the Python/C API?

2004-12-05 Thread Craig Ringer
bunch of methods on the generated subclasses, so I'm hoping so... -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing class factories with the Python/C API?

2004-12-05 Thread Craig Ringer
wouldn't have guessed what I was looking for would be in the exception code. Much appreciated. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Craig Ringer
dict__[varname] = 'unwise' >>> obj.fred 'unwise' This, however, won't do you much good if you don't know what you'll be modifying. I know the locals() and globals() functions exist, but have always been leery of the idea of modifying their contents, an

Unicode docstrings in PyMethodDef?

2004-12-07 Thread Craig Ringer
e rest of the app is translated with. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Class Variable Inheritance

2004-12-08 Thread Craig Ringer
variable is still there, and unmodified, but the name search finds the copy each instance has in its dict before the class one. >>> a.__class__.name 'fred' >>> a.__class__.name = "Albert" >>> a.__class__.name 'fred' >>> a.name &#x

Re: Possible to insert variables into regular expressions?

2004-12-09 Thread Craig Ringer
You could also end up inserting ?s , *s etc, resulting in some rather frustrating bugs. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: converting html escape sequences to unicode characters

2004-12-10 Thread Craig Ringer
, '에', '요', '내', '면', '금', '이', '얼', '마', '지', '잠'] >>> def unescape(escapeseq): ... return ("\\u%x" % int(escapeseq[2:-1])).decode("unicode_escape") ... >>> print ' '.join([ unescape(x) for x in entities ]) 비 행 기 로 보 낼 거 에 요 내 면 금 이 얼 마 지 잠 -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: converting html escape sequences to unicode characters

2004-12-10 Thread Craig Ringer
On Fri, 2004-12-10 at 16:09, Craig Ringer wrote: > On Fri, 2004-12-10 at 08:36, harrelson wrote: > > I have a list of about 2500 html escape sequences (decimal) that I need > > to convert to utf-8. Stuff like: > > I'm pretty sure this somewhat horrifying code doe

Re: Read a gzip file from inside a tar file

2004-12-13 Thread Craig Ringer
hat does require the entire thing to be loaded (or anything that means you have to seek around the file), I'd say you're SOL. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: how do I "peek" into the next line?

2004-12-13 Thread Craig Ringer
Assuming there's a good reason, such as monster lines, not to just read the next line anyway, I'd suggest read()ing the next character then seek()ing back by one character to restore the file position. def peekChar(fileobj): ch = fileobj.read(1) fileobj.seek(-1,1) r

Re: How can i send 8-bit data or binary data with pyserial?

2004-12-13 Thread Craig Ringer
exstring2 = "\x5b\xbd" >>> hexstring2 '[\xbd' and you can convert them all to strings. Just remember that you can work with a string as a buffer of 8-bit blocks and you'll be fine. In your specific example: >>> byte = '00100' >>> byte_chr = chr(int(byte,2)) >>> byte_chr '@' -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Import trouble

2004-12-15 Thread Craig Ringer
e into the current namespace: > the function scope(instead of file scope as I want). Is there any solution to > my problem? Or should I solve it in another way? def import_xml: try: import libxml except ImportError,err: # handle the error return libxml libxml

Re: Import trouble

2004-12-15 Thread Craig Ringer
On Wed, 2004-12-15 at 21:44, Craig Ringer wrote: > def import_xml: >try: >import libxml >except ImportError,err: ># handle the error >return libxml > > libxml = import_xml() Though my personal approach would actually be: try: import l

Re: Unicode docstrings in PyMethodDef?

2004-12-10 Thread Craig Ringer
On Wed, 2004-12-08 at 13:43, Craig Ringer wrote: > Hi folks > > I'm currently working on a fairly well internationalised app that embeds > a Python intepreter. I'd like to make the docstrings translatable, but > am running into the issue that the translation function ret

Re: lies about OOP

2004-12-14 Thread Craig Ringer
doesn't extend as far as: instance = Constructor(*args) though if anybody knows how to do this in C++ I would be overjoyed to hear from them. Qt _does_ provide a pleasant (if somewhat limited) of the Python getattr() and setattr() calls. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression for javadoc style comment

2004-12-18 Thread Craig Ringer
It would be good if you could post some of the things you've tried, and perhaps a little more detail about what you're trying to match. Are you trying to match the comment as a whole, eg "this is a javadoc comment", or are you trying to extract parts of it? -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: A completely silly question

2004-12-18 Thread Craig Ringer
it's probably worth just using curses, but if you have a fairly basic app that just needs to read raw characters sometimes this approach should be fine. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing

2004-12-20 Thread Craig Ringer
M is an option. > Or to do a DOS directory and send it directly to a file to be accessed > as needed? I'm afraid I just don't understand that. "Do" a DOS directory? If you want to list the contents of a directory, see help(os.listdir) . -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing

2004-12-21 Thread Craig Ringer
tdir) . I strongly recommend you read the Python tutorial if you haven't already, and have a browse over the documentation for some of the key modules like os and sys. Google and Google Groups are also often very helpful - you can use Google Groups to search comp.lang.python (this list/newsgroup). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Killing a python thread with a signal

2004-12-22 Thread Craig Ringer
the past - it might be a good idea to search the archives. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP vs. Python

2004-12-22 Thread Craig Ringer
#x27;ll be faster or slower than PHP, I just can't guess. I think it'd certainly be well worth a try, especially if you're writing any more complex applications. That said, for 90% of users development time matters more than execution speed, and that's another matter entirely. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda going out of fashion

2004-12-22 Thread Craig Ringer
em. Of course, all these are just my opinion in the end, but I'd still have to argue that using Python from C could be a lot nicer than it is. The API is still pretty good, but the solution of these issues would make it a fair bit nicer again, especially for people embedding Python in apps (a place were it can seriously excel as a scripting/extension/glue language). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda going out of fashion

2004-12-22 Thread Craig Ringer
rivial) difference in syntax. I'd be interested in knowing if there is in fact more to it than this. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda going out of fashion

2004-12-23 Thread Craig Ringer
Fredrik Lundh wrote: Craig Ringer wrote: It's hard to consistently support Unicode in extension modules without doing a lot of jumping through hoops. Unicode in docstrings is particularly painful. This may not be a big deal for normal extension modules, but when embedding Python it'

Re: Multiple Inheritance __slots__ problem

2004-12-25 Thread Craig Ringer
need to define slots in these classes and also need to inherit them in > Derived class. If I recall correctly, the standard advice in this situation is "don't use __slots__. If you think you need __slots__, still don't use __slots__." I've made use of __slots__ once my

Re: Clearing the screen

2004-12-25 Thread Craig Ringer
r pythonrc ( ${HOME}/.pythonrc on UNIX , NFI on windows ). On a side note, it'd be easier to read your post if you'd use the shift key more often :-P -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

DB-API format string conventions

2004-12-28 Thread Craig Ringer
work, but still probably not a big deal. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: DB-API format string conventions

2004-12-28 Thread Craig Ringer
On Tue, 2004-12-28 at 18:29, Craig Ringer wrote: > Would there be any interest in releasing a DB-API 2.1 with one > parameter style made MANDATORY, and a tuple of other supported styles in > .paramstyles ? I think existing modules implemented in Python could be > retrofi

Re: DB-API format string conventions

2004-12-28 Thread Craig Ringer
t still need to have a look for other API revision proposals. I thought it best to ask here to find out how much interest there would be in clarifying the API and adding a required format style before going ahead with actually writing a few patches and a draft PEP for comments. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Reference behavior through C (was: Lambda going out of fashion)

2004-12-28 Thread Craig Ringer
On Wed, 2004-12-29 at 02:08, Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Craig Ringer <[EMAIL PROTECTED]> wrote: > . > . > . > > IMO the reference behaviour of functions in the

Re: what would you like to see in a 2nd edition Nutshell?

2004-12-29 Thread Craig Ringer
s sense once you already understand it. It wouldn't hurt to point C extension authors at things like the 'es' encoded string format for PyArg_ParseTuple to help them make their code better behaved with non-ascii text. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: justifying text...and also...correct use of classes...

2004-12-30 Thread Craig Ringer
ize in advance if I > am, but I just can't figure it out. "%20s: %s" % (leftstring, rightstring) or "%20s: %-40s" % (leftstring, rightstring) That's Python's 'printf' style string formatting. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Updating file objects automatically

2004-12-30 Thread Craig Ringer
's just a stab in the dark, but perhaps it might be. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread Craig Ringer
et) than Python in this case anyway. This is probably not the right place. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed ain't bad

2004-12-31 Thread Craig Ringer
oited. True; however, it's my understanding that compressing individual files also means that in the case of damage to the archive it is possible to recover the files after the damaged file. This cannot be guaranteed when the archive is compressed as a single stream. -- Craig Ringer -- http:

Re: How to install pip for python3 on OS X?

2013-11-20 Thread Craig Yoshioka
Mavericks? Homebrew all the way. Google Homebrew and install it brew install python3 pip3 install pyserial Craig reporting from the road 10550 N Torrey Pines Rd La Jolla CA 92037 work: 858 784 9208 cell: 619 623 2233 > On Nov 19, 2013, at 10:55 PM, Travis Griggs wrote: > > OSX (

Need assistance

2015-07-16 Thread craig . sirna
ust display the full name rearranged in Last, First Middle order. I tried to use the search function in Python to locate any spaces in the input. It spot back the index 5 (I used Craig Daniel Sirna) That is correct for the first space, but I can't figure out how to get it to continue to t

Re: Need assistance

2015-07-16 Thread craig . sirna
I am in bed, on my phone, gotta be up in 4 hours for work. I will get back with you guys tomorrow after I take care of my Math class stuff. I need to step away from this for a day lol. Worst part...this is the C assignment and it's driving me crazy. I do recall the list fuction. But isn't it

Re: Need assistance

2015-07-19 Thread craig . sirna
On Thursday, July 16, 2015 at 9:16:01 PM UTC-5, craig...@gmail.com wrote: > I need help writing a homework program. > > I'll write it, but I can't figure out how to incorporate what I have read in > the book to work in code. > > The assignment wants us to take a

Single-stepping through a python script

2007-07-17 Thread Craig Howard
Hello All: Is is possible to compile a code object and single-step through its execution? Craig -- http://mail.python.org/mailman/listinfo/python-list

Single-stepping through a python script

2007-07-17 Thread Craig Howard
>>Craig Howard schrieb: >> Hello All: >> >> Is is possible to compile a code object and single-step through its >> execution? >import pdb; pdb.set_trace() > >Look up the pdb module documentation. > >Diez Sorry, I didn't give enough deta

Re: unit testing

2007-10-05 Thread Craig Howard
is sent to the plant operator's pager. Because of the nature of the alarm system, extensive field testing was out of the question. Unit testing was the only way to ensure it worked without disrupting the plant operation. Craig -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create a file on users XP desktop

2007-10-07 Thread Craig Howard
On Oct 6, 2007, at 11:31 PM, goldtech wrote: > Can anyone link me or explain the following: > > I open a file in a python script. I want the new file's location to be > on the user's desktop in a Windows XP environment. fileHandle = open > (., 'w' ) what I guess I'm looking for is an enviro

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread craig wickesser
well the problem I have only occurs when my python app. is running as a Windows Service. if I run the python app. as a process (i.e. from the command line) it works as epxected via Remote Desktop. still not sure what's going on. On 2/28/07, Sick Monkey <[EMAIL PROTECTED]> wrote: I have just

Thought you would enjoy some funny math cartoons!!!

2007-12-06 Thread craig . snodgrass
enjoy. Thanks, Craig -- http://mail.python.org/mailman/listinfo/python-list

newbie question regarding int(input(:))

2008-01-11 Thread Craig Ward
Hi experts! I am trying to write a menu script that will execute bash scripts. Everything is fine until the script executes and I want to see if there are any more options to run before quitting. Example: def menu(opt1 = "something", opt2 = "something else"): -- Computers are like air condition

Fwd: newbie question regarding int(input(:)) - sorry for the spam

2008-01-11 Thread Craig Ward
have a second input and I can't put the int(input(":") in the function because I get the error 'int' is not callable plus my choice variable is not defined. can someone please enlighten me? :-) -- Forwarded message -- From: Craig Ward <[EMAIL PROTEC

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-02-02 Thread Craig Allen
th tangible problems, but we are not starting a commune. "Uses a langague with sense of community that advocates for their language over others" is never in a spec. -craig -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading and tkinter

2009-02-20 Thread Craig Allen
> The statement > >     x=x+1 > > (which, by the way, should stylistically be written > >     x = x + 1 > yes I was wondering what "x=x+1" meant until you translated it... oh, "x = x + 1" of course! I thought to myself. Oh wait no I'm sarcastic. -- http://mail.python.org/mailman/listinfo/python-

Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread Craig Allen
I would never tell someone what editor to use in the same way I wouldn't tell someone what religion to believe in. Which is to say, I would tell my kids or other trusting soul... I used emacs for years, I was eventually convinced to start using nedit, which is quite nice. For an IDE, which I need

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread Craig Allen
> Just remember thought that if you threat Python like a > hammer, suddenly everything will look like a bail. > don't you mean if you use Python like a pitchfork? -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about class relationships

2008-12-02 Thread Craig Allen
what you have is a totally acceptable factory system. Not sure why you are using a generator, but that's another matter. I agree with the previous replies regarding inheritance... this is not a case for inheritance. You could, however, have Bar be a borg with the Bar factory built in as a class

Re: [Python.NET] Where does the clr in IronPython look the dll

2008-12-12 Thread Craig Farrow
The dll needs to be on the Python path (sys.path). You can either add to the path with sys.path.append("c:\") or put your dll in a folder in the Python site-packages directory and add a .pth file (for Python.NET, but not IronPython -- it doesn't recognise the .pth files).

Re: How to modify a program while it's running?

2008-12-16 Thread Craig Allen
On Dec 16, 10:25 am, Joe Strout wrote: > Here's my situation: I'm making an AIM bot, but the AIM server will > get annoyed if you log in too frequently (and then lock you out for a > while). So my usual build-a-little, test-a-little methodology doesn't > work too well. > > So I'd like to restruct

Re: Python is slow

2008-12-16 Thread Craig Allen
On Dec 14, 6:38 pm, cm_gui wrote: > hahaha, do you know how much money they are spending on hardware to > make > youtube.com fast??? > > > By the way... I know of a very slow Python site called YouTube.com. In > > fact, it is so slow that nobody ever uses it. less than they'd spend to implement i

Re: I always wonder ...

2008-12-24 Thread Craig Allen
this is one of the most subtle trolls I've ever read. you sir, are a master! On Dec 22, 7:53 am, s...@pobox.com wrote: > ... shouldn't people who spend all their time trolling be doing something > else: studying, working, writing patches which solve the problems they > perceive to exist in the t

Re: Python 2.6, GUI not working on vista?

2008-10-09 Thread Craig Allen
as a 20 year observer of microsoft, I have to say this is not amazing at all... and I do not mean that as a random put down of Microsoft. Microsoft often develops things in response to demand... but they don't always fit in their system well, and thus are not really used in the spirit of the demand

Re: IDE Question

2008-10-15 Thread Craig Allen
it's commercial, but I like WingIDE enough to recommend... I run it on Linux and Mac and it works well. -craig On Oct 15, 7:19 am, "Steve Phillips" <[EMAIL PROTECTED]> wrote: > Hi All, > I am just wondering what seems to be the most popular IDE. The reason > I ask

Re: dictionary

2008-10-24 Thread Craig Allen
when I was a baby programmer even vendors didn't have documentation to throw out... we just viewed the dissassembeled opcodes to find out how things worked... we never did find out much but I could make the speak click, and we were happy with it. -- http://mail.python.org/mailman/listinfo/python-li

Re: How to examine the inheritance of a class?

2008-10-24 Thread Craig Allen
> > Developer. NOT User. I go around and around on this issue, and have ended up considering anyone using my code a user, and if it's a library or class system, likely that user is a programmer. I don't really think there is a strong distinction... more and more users can do sophisticated configu

Re: How to examine the inheritance of a class?

2008-10-24 Thread Craig Allen
> Thank you, Chris. Class.__bases__ is exactly what I wanted to see. > And I thought I had tried isinstance(), and found it lacking -- but I > just tried it again, and it does what I hoped it would do. While isinstance is no doubt the proper way to access this information, you may have run into

Re: Structures

2008-11-03 Thread Craig Allen
> > Care to say more about what they are, not what they're like? > I'm not the OP and I may be biased by C++, I can imagine the complaints when I say, classes are just structures with function members for working on the structure. -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON WORKING WITH PERL ??

2008-11-03 Thread Craig Allen
> article:http://www.linuxjournal.com/article/3882 interesting read, thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON WORKING WITH PERL ??

2008-11-03 Thread Craig Allen
> article:http://www.linuxjournal.com/article/3882 even if it is by Eric Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-11-04 Thread Craig Allen
> > If the assert statement fails (and it does), then no copy was made and > Python is not call-by-value. > > So Python is not call-by-value, and it's not call-by-reference, so ... > either Python doesn't exist, or it uses a different calling convention. > coming from C/C++ Python seemed to me cal

Re: Finding the instance reference of an object

2008-11-04 Thread Craig Allen
On Nov 4, 11:06 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 4, 2008, at 7:42 AM, Craig Allen wrote: > > > coming from C/C++ Python seemed to me call by reference, for the > > pragmatic reason you said, modificaitons to function arguments do > > affect th

Re: Finding the instance reference of an object

2008-11-12 Thread Craig Allen
> arguably even older than that to Lisp. > Firstly, thanks to those that have responded to my part in this debate, I have found it very informative and interesting as I have the entire thread. However, with regard to comments that I led myself astray, I want to reiterate the one thing I find det

Re: duck-type-checking?

2008-11-13 Thread Craig Allen
> This is better achived, not by littering the functional code unit with > numerous assertions that obscure the normal function of the code, but > rather by employing comprehensive unit tests *separate from* the code > unit. that doesn't seem to work too well when shipping a library for someone el

Re: duck-type-checking?

2008-11-13 Thread Craig Allen
> since both are equally informative when it comes to tracing the faulty > assignment. > steve, they are not equally informative, the assertion is designed to fire earlier in the process, and therefore before much mischief and corruption can be done compared to later, when you happen to hit the m

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-17 Thread Craig Allen
> >> * Do all objects have values? (Ignore the Python > >> docs if necessary.) > > > If one allows null values, I am current thinking yes. > > I don't see a difference between a "null value" > and not having a value. > I think the difference is concrete... an uninitialized variable in C has no va

Re: Finding the instance reference of an object

2008-11-19 Thread Craig Allen
I've just come to the conclusion it's not possible to call functions in python, to do so is undefined and indeterminate, like dividing by zero. Henceforth no calling functions for me as clearly it's the devil's playground. -- http://mail.python.org/mailman/listinfo/python-list

Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Craig Allen
On Mar 3, 10:17 am, Cool Dude wrote: > Hello , > This is Aniket from Techclique, a New Jersey based software > development and IT consulting firm providing top quality technical and > software professionals on a permanent and contractual basis to > Government and commercial customer including fort

Re: Why is lambda allowed as a key in a dict?

2009-03-10 Thread Craig Allen
> I think the point is that function objects compare by object identity, > so the two lambdas you use above are not equal even though they have the > same code. it raises an interesting question about why doesn't it. I can think of practical answers to that, obviously, but in principle, if a fun

Re: Is python worth learning as a second language?

2009-03-10 Thread Craig Allen
ainable. Honestly, I've become more of a Python fan than I am really comfortable with... it can't be as good as I think. -craig -- http://mail.python.org/mailman/listinfo/python-list

Re: Ban Xah Lee

2009-03-11 Thread Craig Allen
> There you go: a 30-second psychological diagnosis by an > electrical engineer based entirely on Usenet postings.  It > doesn't get much more worthless than that... > > -- > Grant rolf but interesting post nonetheless. I have been really somewhat fascinated by AS since I heard of it about a dec

Re: Why is lambda allowed as a key in a dict?

2009-03-11 Thread Craig Allen
On Mar 10, 1:39 pm, Paul Rubin <http://phr...@nospam.invalid> wrote: > Craig Allen writes: > > it raises an interesting question about why doesn't it.  I can think > > of practical answers to that, obviously, but in principle, if a > > function compiles to

packaging

2009-03-17 Thread Craig Allen
cto standards for this sort of thing (especially from the user pov but also from the developer's)... so any comment are appreciated. I've been using python for a few years now but this is the first time we are forming it in the shape of a proper package. cheers and thanks. -craig -- http://mail.python.org/mailman/listinfo/python-list

Re: packaging

2009-03-18 Thread Craig Allen
> andrew thanks andrew, good advice, I should probably use that throughout our code. btw, hope the world is treating you well, long time no see... -craig -- http://mail.python.org/mailman/listinfo/python-list

Re: Beazley on Generators

2009-04-01 Thread Craig Allen
this is great, thanks... we have used generators to create something akin to a cooperative tasking environment... not to implement multitasking, but to be able to control low level data processing scripts. These scripts, written as generators, yield control to a control loop which then can pause,

Re: Help me on Backspace please

2008-06-26 Thread Craig Radcliffe
Something like this might do the trick: import re f = open("file.txt") old_text = f.readlines() f.close() new_text = [re.sub(r'.\b', '', i) for i in old_text] f = open("file_modified.txt", "w") f.writelines(new_text) I don't know how necessary the separate read and writes are, but it'll be good

singletons

2008-07-16 Thread Craig Allen
Hey, forgive me for just diving in, but I have a question I was thinking of asking on another list but it really is a general question so let me ask it here. It's about how to approach making singletons. Background: I've been programming in python seriously for about a year now, maybe a little lon

Re: singletons

2008-07-16 Thread Craig Allen
al is still that tl = TehLibrary() would always return the same object. -craig On Jul 16, 2:00 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Jul 16, 5:20 pm, Craig Allen <[EMAIL PROTECTED]> wrote: > > > > > Hey, forgive me for just diving in, but I have a question I was &g

Re: singletons

2008-07-17 Thread Craig Allen
On Jul 16, 7:01 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, Craig > > Allen wrote: > > ... the ideal is still that > > > tl = TehLibrary() would always return t

Re: singletons

2008-07-17 Thread Craig Allen
On Jul 17, 2:15 am, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > On 17 Jul., 00:20, Craig Allen <[EMAIL PROTECTED]> wrote: > > > > > I have several classes in our system which need to act like > > singletons, they are libraries of data classifications, and other

Re: singletons

2008-07-18 Thread Craig Allen
On Jul 17, 9:04 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Jul 16, 11:20 pm, Craig Allen <[EMAIL PROTECTED]> wrote: > > > Hey, forgive me for just diving in, but I have a question I was > > thinking of asking on another list but it really is a general question > >

Re: Python Written in C?

2008-07-21 Thread Craig Allen
it's clear to me that the perfect language should exist a priori, coming to being causa sui. Having to actually implement a language is disgusting and unnatural. -- http://mail.python.org/mailman/listinfo/python-list

when does the GIL really block?

2008-07-31 Thread Craig Allen
I have followed the GIL debate in python for some time. I don't want to get into the regular debate about if it should be gotten rid of (though I am curious about the status of that for Python 3)... personally I think I can do multi-threaded programming well, but I also see the benefits of a multi

Re: when does the GIL really block?

2008-08-01 Thread Craig Allen
On Aug 1, 12:06 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On Jul 31, 7:27 pm, Craig Allen <[EMAIL PROTECTED]> wrote: > > > > > I have followed the GIL debate in python for some time. I don't want > > to get into the regular debate about if it should

Re: when does the GIL really block?

2008-08-04 Thread Craig Allen
On Aug 1, 2:28 pm, John Krukoff <[EMAIL PROTECTED]> wrote: > On Thu, 2008-07-31 at 18:27 -0700, Craig Allen wrote: > > I have followed the GIL debate in python for some time. I don't want > > to get into the regular debate about if it should be gotten rid of > >

python-list@python.org

2008-05-02 Thread CRAIG DALTON
t;): g=open(os.path.join(r+,files)) shutil.copyfileobj(g,f) g.close() f.close() Any help would be great. Thanks, Craig Dalton Business Applications Systems Analyst Sentara Healthcare Systems Information Technology [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is my thinking Pythonic?

2008-08-21 Thread Craig Allen
generally, I name the members in the Class definition and set them to None there... class Car: speed = None brand = None def __init__(): self.speed = defaultspeed #alternately, and more commonly, get this speed as a initializer argument self.brand = defaultbrand That solves

Re: When to use try and except?

2008-08-29 Thread Craig Allen
On Aug 29, 7:23 am, cnb <[EMAIL PROTECTED]> wrote: > If I get zero division error it is obv a poor solution to do try and > except since it can be solved with an if-clause. > > However if a program runs out of memory I should just let it crash > right? Because if not then I'd have to write exceptio

Re: How to record audio from Python on Mac?

2008-09-09 Thread Craig Allen
I want to do this as well, and also some other audio processing via python. I have not tried yet, but much of my research points to pyaudio, PortAudio bindings for python, which is supposed to be multi- platform including Mac OS X, but as I say, I've not tried it yet. Related to this are some exa

Re: Adding environment variables to bash.

2008-09-11 Thread Craig Allen
On Sep 11, 10:25 am, nntpman68 <[EMAIL PROTECTED]> wrote: > >> doesn't exactly work for Python scripts, though: > > >> $ cat env.py > >> #!/usr/bin/env python > >> import os > >> os.environ["TEST"] = "hello" > > >> $ . ./env.py && env | grep TEST > >> import: unable to open X server `'. > >> bash:

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Craig Allen
> Snce when are "users" ever involved > in programming problems or programming > languages ? > since the begining, the first users are programmers, users of your libraries. -- http://mail.python.org/mailman/listinfo/python-list

Re: Not fully OO ?

2008-09-22 Thread Craig Allen
It is clear to me that Python is a multiparadigmed object oriented language. It is clearly possible to write procedural code... that is, Python does not force object oriented syntax or concepts on you and insist you define everything in such a structure. Is the OO it allows full OO, I think so, an

Re: Not fully OO ?

2008-09-23 Thread Craig Allen
> if they want to, but it is *fully* OO in that it includes everything > required to do OO. But maybe the original blogger meant by "fully OO" > what I mean by "Pure OO"? it seems to me this is what was meant... pure OO, AND forced to use it. My personal feeling is that python is multiparadigmed

<    1   2   3   4   5   6   7   8   9   >