within this environment. So I intend to embed CPython
access in the program.
The basic embedding of CPython seems straight forward. But since I have
multiple users, each needs their own Python sandbox, so if they all compile
programs with variable 'spam', it doesn't collide. Of
When I do:
datetime.datetime.now().isoformat(' ')
I get the time with the microseconds. The docs says:
"if microsecond is 0 -MM-DDTHH:MM:SS+HH:MM".
How do I set microsecond to 0?
>>> datetime.datetime.microsecond = 0
Traceback (most recent call last):
File "", line 1, i
Is there a better way to convert int to bytes then going through strings:
x=5
str(x).encode()
Thanks.
--
Yves. http://www.SollerS.ca/
http://blog.zioup.org/
--
http://mail.python.org/mailma
I'm looking for an easy way to display simple line graphs generated by
a python program in Windows. It could be done from within the
program, or I could write the information out to a file and call an
external program. Either is fine.
Does anybody have any recommendations for a good program from
I didn't explain my problem, chose a terrible example. This is more
what I'm trying to do:
Basically the subclass I want to use is based on some of the data I extract
from a blob of data. If I use a function to extract the data before I create
the objects, then I need to do a bunch of assignme
I didn't explain my problem, chose a terrible example. This is more what I'm
trying to do:
class thingy:
def __init__(self, athingy):
self.basic_extract()
if self.typeof = A
.../...
def basic_extract(self):
# complicated logic to extract data out of the thingy here
On 11-02-15 07:45 PM, alex23 wrote:
Firstly, does MyNumbers _have_ to be a class? Or would a function
acting as a class factory be sufficient?
Yes it does. I didn't explain my problem, chose a terrible example. This is
more what I'm trying to do:
class thingy:
def __init__(self, athingy):
How can I do something like this in python:
#!/usr/bin/python3.1
class MyNumbers:
def __init__(self, n):
self.original_value = n
if n <= 100:
self = SmallNumers(self)
else:
self = BigNumbers(self)
class SmallNumbers:
def __init__(self, n):
self.size = 'small'
cl
This is with python 3.1.2 (r312:79147). I have not tried with 2.7.
When I create an attachment with email.mime.image.MIMEImage, by default it
uses email.encoders.encode_base64 for the encoder, but that results in a
single line base64 string, instead of the recommended multiple 76-chars lines.
This is with python 3.1.2 (r312:79147). I have not tried with 2.7.
When I create an attachment with email.mime.image.MIMEImage, by default it
uses email.encoders.encode_base64 for the encoder, but that results in a
single line base64 string, instead of the recommended multiple 76-chars lines.
Steven D'Aprano wrote:
On Mon, 19 Oct 2009 00:30:30 -0700, dheeraj wrote:
Hi, a program of mine is being terminated by the OS as it uses too much
memory. I guess this is due to static memory allocation
I've also tried to use "del" but in vain. Is there any other function
that performs the abov
Hi,
anyone can give a simple example or a link on how to use 'drop' with
pyqt.
what I'm looking for is drop a file to main widget then program get
the path\filename
something like: main_widget set to accept 'drop event', set filename
when 'drop event happens' then the filename is path\filename o
On Sep 18, 1:48 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote:
> On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > It seems that another solution is gobject.io_add_watch, but I don't
> > see how it tells me how much I can read from the file - if I don't
> > know that, I won't know the
Ok, I could have researched this before posting, but here's an
explanation how to do it with twisted:
http://unpythonic.blogspot.com/2007/08/spawning-subprocess-with-pygtk-using.html
It seems that another solution is gobject.io_add_watch, but I don't
see how it tells me how much I can read from t
Hello,
I want to write a terminal program in pygtk. It will run a subprocess,
display everything it writes in its standard output and standard
error, and let the user write text into its standard input.
The question is, how can I know if the process wrote something to its
output, and how much it
Matimus wrote:
> > Can someone please explain why I get the following error:
>
> The following line:
> threading.Thread.__init__()
> Should be written as:
> threading.Thread.__init__(self)
Thank you!
--
http://mail.python.org/mailman/listinfo/python-list
I'm a novice at Python, and found some code samples on how to use
threads. My script is being run by a product that contains a Jython
interpreter. Can someone please explain why I get the following error:
Traceback (innermost last):
File "/full/path/to/file/GenerateData.py", line 104, in ?
F
Emma wrote:
> Successful candidates meet the following requirements:
> · A burning desire to build rock-solid apps that people will be
> unable
> to live without
I use to have a burning desire to cleverly answer questionnaires for
companies which either don't exist or, if they do, don't tell you
Kay Schluehr wrote:
> val bykoski wrote:
>> Peter Wang wrote:
>>> Edward,
>>>
>>> This isn't in response to any specific one of the 100+ posts on this
>>> thread, but I justed wanted to encourage you to continue your
>>> investigation into Python component models and maybe looking for some
>>> comm
Peter Wang wrote:
> Edward Diener wrote:
>> It looks as if traits is an attempt to create a "property" in the
>> component terminology which I originally specified. I will take a look
>> at it.
>
> Traits is frighteningly similar to the requirements that you laid out
> in your post (the example fo
Fredrik Lundh wrote:
> fumanchu wrote:
>
>>> 4) Custom property and component editors: A component editor can present
>>> a property editor or an editor for an entire component which the visual
>>> design-time RAD environment can use to allow the programmer end-user of
>>> the component to set or
Kay Schluehr wrote:
> fumanchu wrote:
>
>>> 4) Custom property and component editors: A component editor can present
>>> a property editor or an editor for an entire component which the visual
>>> design-time RAD environment can use to allow the programmer end-user of
>>> the component to set or g
fumanchu wrote:
> Edward Diener No Spam wrote:
>> OK, here is my idea of what such a component model envisages as a list
>> of items. After this, unless I get some intelligent comments from people
>> who might be interested in what I envision, or something very similar
Paul Boddie wrote:
> [EMAIL PROTECTED] wrote:
>> Edward> My OP was just to query whether a component model existed for
>> Edward> Python, like JavaBeans for Java or .Net for C#, C++/CLI
>> Edward> etc.
>>
>> For those of us who've never used Java, .Net or C++/CLI, a more concrete
>> description of
Fredrik Lundh wrote:
> Edward Diener No Spam wrote:
>
>> There's no doubt that Python's excellent introspection mechanism allows
>> an outside RAD-like tool to inspect the workings of any Python object.
>> But that does not make it a component model in my o
Tim Chase wrote:
>> There's no doubt that Python's excellent introspection mechanism
>> allows an outside RAD-like tool to inspect the workings of any Python
>> object. But that does not make it a component model in my original use
>> of the term on this thread. A RAD tool needs to know what pro
Diez B. Roggisch wrote:
>> While I understand dynamic typing, I still think it is possible to
>> create attributes in a Python component model which could tell a RAD
>> tool what type the attribute will encompass for the purpose of
>> properties and events. Obviously a "name, type" tuple, among oth
Fredrik Lundh wrote:
> "Edward Diener No Spam" wrote:
>
>> A RAD IDE tool to hook up components into an application or library (
>> module in Python ) has nothing to do with terseness and everything to do
>> with ease of programming.
>
> python alread
Richard Brodie wrote:
> "Edward Diener No Spam" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>> "Thinking in Java or C++" as opposed to Python does not mean anything to me
>> as a general
>> statement. I am well aware of
Michael Sparks wrote:
> Edward Diener No Spam wrote:
>> Michael wrote:
>>> Edward Diener No Spam wrote:
>>>
>>>> Has there ever been, or is there presently anybody, in the Python
>>>> developer community who sees the same need and is working t
Fredrik Lundh wrote:
> Nick Vatamaniuc wrote:
>
>> At the same time one could claim that Python already has certain
>> policies that makes it seem as if it has a component model.
>
> every Python object surely qualifies as a component, for any non-myopic
> definition of that word, and everything
Steve Holden wrote:
> Diez B. Roggisch wrote:
> [...]
>>> Just the same, one can use IronPython to call components written in
>>> other languages. And, I believe, vice versa.
>>
>>
>> Sure, as I can do it in jython. But the key point is: can your ordinary
>> python-object be published as a componen
Diez B. Roggisch wrote:
> Paul Rubin schrieb:
>> "Nick Vatamaniuc" <[EMAIL PROTECTED]> writes:
>>> Python does not _need_ a component model just as you don't _need_ a RAD
>>> IDE tool to write Python code. The reason for having a component model
>>> or a RAD IDE tool is to avoid writing a lot of bo
Paul Rubin wrote:
> "Nick Vatamaniuc" <[EMAIL PROTECTED]> writes:
>> Python does not _need_ a component model just as you don't _need_ a RAD
>> IDE tool to write Python code. The reason for having a component model
>> or a RAD IDE tool is to avoid writing a lot of boiler plate code.
>
> It's also
Nick Vatamaniuc wrote:
> Edward Diener No Spam wrote:
>> Michael wrote:
>
> Python does not _need_ a component model just as you don't _need_ a RAD
> IDE tool to write Python code. The reason for having a component model
> or a RAD IDE tool is to avoid writing a lot of b
Michael wrote:
> Edward Diener No Spam wrote:
>
>> Has there ever been, or is there presently anybody, in the Python
>> developer community who sees the same need and is working toward that
>> goal of a common component model in Python, blessed and encouraged by
>>
goon wrote:
>> or IBM's Eclipse for Java
>
> Or Eclipse for Python using PyDev? [0]
Those are very nice features but there is no re-usable Python bean
support like there is a Java bean. That was my initial point.
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> Edward Diener No Spam wrote:
>
>> There's nothing wrong with Python's introspection. In fact Python's
>> facilities in this area and its support for metadata are stronger than
>> any of these other languages ! However there is no com
Chaz Ginger wrote:
> Edward Diener No Spam wrote:
>> [EMAIL PROTECTED] wrote:
>>> Edward> The definition of a component model I use below is a class
>>> which
>>> Edward> allows properties, methods, and events in a structured way
>>> which
Echo wrote:
> On 10/9/06, Edward Diener No Spam <[EMAIL PROTECTED]>
> wrote:
>> The definition of a component model I use below is a class which allows
>> properties, methods, and events in a structured way which can be
>> recognized, usually through some form of
[EMAIL PROTECTED] wrote:
> Edward> The definition of a component model I use below is a class which
> Edward> allows properties, methods, and events in a structured way which
> Edward> can be recognized, usually through some form of introspection
> Edward> outside of that class. Thi
The definition of a component model I use below is a class which allows
properties, methods, and events in a structured way which can be
recognized, usually through some form of introspection outside of that
class. This structured way allows visual tools to host components, and
allows programme
Hello,
I would like to present a module that I have wrote, called byteplay.
It's a Python bytecode assembler/disassembler, which means that you can
take Python code object, disassemble them into equivalent objects which
are easy to play with, play with them, and then assemble a new,
modified, code
George Sakkis wrote:
> [EMAIL PROTECTED] wrote:
>
> > However, I'm designing another library for
> > managing multi-dimensional arrays of data. Its purpose is similiar to
> > that of a spreadsheet - analyze data and preserve the relations between
> > a source of a calculation and its destination.
>
Hello,
Following Fredrik's suggestion, I wrote a pre-PEP. It's available on
the wiki, at http://wiki.python.org/moin/EmptySubscriptListPEP and I
also copied it to this message.
Have a good day,
Noam
PEP: XXX
Title: Allow Empty Subscript List Without Parentheses
Version: $Revision$
Last-Modified
Hello,
Fredrik Lundh wrote:
> (but should it really result in an empty tuple? wouldn't None be a bit
> more Pythonic?)
I don't think it would. First of all, x[()] already has the desired
meaning in numpy. But I think it's the right thing - if you think of
what's inside the brackets as a list of
Hello,
Sybren Stuvel wrote:
> I think it's ugly to begin with. In math, one would write simply 'x'
> to denote an unsubscribed (ubsubscripted?) 'x'. And another point, why
> would one call __getitem__ without an item to call?
I think that in this case, mathematical notation is different from
pyth
Hello,
Terry Reedy wrote:
> So I do not see any point or usefulness in saying that a tuple subcript is
> not what it is.
I know that a tuple is *constructed*. The question is, is this,
conceptually, the feature that allows you to ommit the parentheses of a
tuple in some cases. If we see this as t
Hello,
Terry Reedy wrote:
> > In a few more words: Currently, an object can be subscripted by a few
> > elements, separated by commas. It is evaluated as if the object was
> > subscripted by a tuple containing those elements.
>
> It is not 'as if'. 'a,b' *is* a tuple and the object *is* subcript
Hello,
I discovered that I needed a small change to the Python grammar. I
would like to hear what you think about it.
In two lines:
Currently, the expression "x[]" is a syntax error.
I suggest that it will be evaluated like "x[()]", just as "x[a, b]" is
evaluated like "x[(a, b)]" right now.
In a
[EMAIL PROTECTED] a écrit :
> Hi Folks,
>
> I'm thinking about writing a script that can be run over a whole site
> and produce a report about broken links etc...
>
> I've been playing with the urllib2 and httplib modules as a starting
> point and have found that with urllib2 it doesn't seem poss
this message was originally posted by someone else and closed without a
proper answer. i'm reposting it in hopes that someone will provide a
solution.
Begin Quote:
"I'm attempting to play an mp3 file on OSX, but am running into some
difficulty. When using py-mad and py-ao, I only get static wit
It seems to me that both Mike's and Fuzzyman's objections were that
sometimes you want the current behaviour, of saying that two objects
are equal if they are: 1. the same object or 2. have the same value
(when it's meaningful). In both cases this can be accomplished pretty
easily: You can do it w
> Can you provide a case where having a test for equality throw an > exception
> is actually useful? Yes. It will be useful because: 1. The bug of not
> finding a key in a dict because it was implicitly hashed by identity and not
> by value, would not have happened. 2. You wouldn't get the wei
Hello,
Guido has decided, in python-dev, that in Py3K the id-based order
comparisons will be dropped. This means that, for example, "{} < []"
will raise a TypeError instead of the current behaviour, which is
returning a value which is, really, id({}) < id([]).
He also said that default equality c
Hello,
What is the convention for writing C functions which don't return a
value, but can fail?
If I understand correctly,
1. PyArg_ParseTuple returns 0 on failure and 1 on success.
2. PySet_Add returns -1 on failure and 0 on success.
Am I correct? What should I do with new C functions that I wr
brainsucker wrote:
> Python 2.4 | 7.3 The for statement:
> ---
>
> for_stmt ::= "for" target_list "in" expression_list ":"
> suite ["else" ":" suite]
>
>
> New for statement:
> --
>
> for_stmt ::= "for" target_list "in" expression_list
> [ "and"
57 matches
Mail list logo