d to worry
about older code. Thanks.
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
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
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
bunch of methods on the generated subclasses, so I'm hoping so...
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
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
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
e rest of the app is translated with.
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
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
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
, '에', '요', '내',
'면', '금', '이', '얼', '마', '지',
'잠']
>>> 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
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
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
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
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
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
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
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
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
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
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
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
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
the past - it might be a good idea to search the archives.
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
#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
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
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
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'
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
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
work, but still probably not a big deal.
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
's just
a stab in the dark, but perhaps it might be.
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
et) than Python in this case anyway. This is
probably not the right place.
--
Craig Ringer
--
http://mail.python.org/mailman/listinfo/python-list
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:
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 (
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
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
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
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
>>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
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
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
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
enjoy. Thanks, Craig
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
> 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-
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
> 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
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
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).
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
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
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
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
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
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
>
> 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
> 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
>
> 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
> article:http://www.linuxjournal.com/article/3882
interesting read, thanks
--
http://mail.python.org/mailman/listinfo/python-list
> article:http://www.linuxjournal.com/article/3882
even if it is by Eric Raymond
--
http://mail.python.org/mailman/listinfo/python-list
>
> 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
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
> 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
> 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
> 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
> >> * 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
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
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
> 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
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
> 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
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
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
> 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
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,
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
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
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
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
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
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
> >
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
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
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
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
> >
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
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
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
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
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:
> 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
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
> 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
101 - 200 of 861 matches
Mail list logo