On Fri, Oct 24, 2008 at 2:58 PM, [EMAIL PROTECTED] wrote:
maybe id(x) can get it ,but how to cast it back into a object
You can't. Python is NOT C/C++/Java or whatever.
If you have a variable, x, and you want to copy it
to another variable, y. Use assignment.
Most (if not all) objects in
On Wed, Oct 22, 2008 at 8:21 PM, Amie [EMAIL PROTECTED] wrote:
I would like to know if it's possible to display a message using
python, if so can you show me an example.
I saw something like: from twisted.python import log
log.msg in some programs but am not too sure how it works
Define
Lave,
If you're doing this btw, you may want to look at
the curses module or urwid (3rd-party).
cheers
James
On Wed, Oct 22, 2008 at 9:17 PM, Lave [EMAIL PROTECTED] wrote:
Yes, it's what i want. Many thanks.
BTW,python-list 's reply is so quick. I love it. I like you all guys.
On 10/22/08,
On Wed, Oct 22, 2008 at 9:19 PM, Simon Strobl [EMAIL PROTECTED] wrote:
#!/usr/bin/
python
import os
os.system(export NLTK_DATA=/opt/nltk/data/)
Try:
os.environ[NLTK_DATA] = /opt/nltk/data/
if that doesn't work, consider wrapping up NLTK
in a bash script that contains the shell statement:
On Wed, Oct 22, 2008 at 9:50 PM, ryan fox [EMAIL PROTECTED] wrote:
I guess its a firewall problem... How do i go abt it?
any help?
See as it's most likely a firewall issue and a firewall
that I'm not familiar with, I can't help here :/ Sorry.
cheers
James
--
--
-- Problems are solved by
On Wed, Oct 22, 2008 at 9:23 PM, Amie [EMAIL PROTECTED] wrote:
for example, I wanna display a message that contains a persons age
from the database like so: Your age is 25. kind of like a messagebox
Amie, you're just picking random behavioral
examples that you've seen in the software
world and
On Thu, Oct 23, 2008 at 1:49 PM, ryan [EMAIL PROTECTED] wrote:
any ideas?
As mentioned before, try:
* Turning _off_ _all_ _firewalls_.
cheers
James
--
--
-- Problems are solved by method
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Oct 22, 2008 at 10:32 AM, gita ziabari [EMAIL PROTECTED] wrote:
Is is possible to import a function from bash to python? If so, what is the
syntax and how should I pass the input parameters?
The only possibility is to use the subprocess module
and this is a more general problem, one
On Mon, Oct 20, 2008 at 5:31 AM, sokol [EMAIL PROTECTED] wrote:
from circuits.core import Manager, Component, Event, listener
from circuits.timers import Timer
what is circuits?
If you're interested:
An event framework with a focus on Component architectures.
It can be downloaded currently
On Sat, Oct 18, 2008 at 10:09 PM, qvx [EMAIL PROTECTED] wrote:
[ ... ]
Is there a better way or some library that does that?
How about this ?
$ ./timerexamples.py
Time: 1224375945.336958
Timer 2 fired at: 1224375945.840600
Timer 1 fired at: 1224375955.336889
code
#!/usr/bin/env python
On Sun, Oct 19, 2008 at 1:30 PM, Steven D'Aprano
[EMAIL PROTECTED] wrote:
for x in (2**i for i in xrange(10)):
print x
This is by far the most concise solution I've seen so far.
And it should never be about conserving code.
Also, Python IS NOT C (to be more specific: Python
is not a C-class
On Sun, Oct 19, 2008 at 1:44 PM, James Mills
[EMAIL PROTECTED] wrote:
On Sun, Oct 19, 2008 at 1:30 PM, Steven D'Aprano
[EMAIL PROTECTED] wrote:
for x in (2**i for i in xrange(10)):
print x
This is by far the most concise solution I've seen so far.
And it should never be about conserving
On 10/7/08, James Mills [EMAIL PROTECTED] wrote:
I shall do some latency benchmarks ok :)
Out of curiosity I modifed my bench marking tool
for my event/component library (pymills) and here
are the results:
~/pymills/examples/event
$ ./bench.py -m latency -t 10
Setting up latency Test
Does anyone have any simple examples
of using Python 2.6/3.0's epoll with a
simpler socket (tcp) server ?
Thanks,
cheers
James
--
--
-- Problems are solved by method
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 9, 2008 at 4:19 AM, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Marc 'BlackJack' Rintsch a écrit :
On Wed, 08 Oct 2008 10:59:44 -0500, skip wrote:
Though of course there is decompyle to consider, assuming Joe's client
is truly paranoid.
Simply don't tell the client. All he has
On Thu, Oct 9, 2008 at 2:26 PM, Warren DeLano [EMAIL PROTECTED] wrote:
JSON rocks! Thanks everyone.
Yes it does :)
Ben wrote:
More generally, you should never execute (via eval, exec, or whatever)
*any* instruction from an untrusted path; especially not arbitrary
data from an input stream.
On Tue, Oct 7, 2008 at 4:02 PM, Gabriel Genellina
[EMAIL PROTECTED] wrote:
There was an experiment (Unununium), now abandoned: http://unununium.org/
Yeah does anyone have or know where one
can get the source code and any other
materials relating to Unununium ? It not only
seems to be abandoned,
On Tue, Oct 7, 2008 at 6:42 PM, [EMAIL PROTECTED] wrote:
AFAIK, the requirement for hard real time, is that response time have
to be predictable, rather than
generally 'fast'.
Very high level languages like python use many features which are by
their nature unpredictable or
difficult to
On Tue, Oct 7, 2008 at 7:27 PM, Kurt Mueller [EMAIL PROTECTED] wrote:
To be more helpful, we should know what you mean by HARD REAL TIME.
Do you mean:
- Handle at least 70 interrupt per second(SPEED)
- If one fails, this is catastrophic for the application (HARD)
- Deliver
On Wed, Oct 8, 2008 at 10:40 AM, Gabriel Genellina
[EMAIL PROTECTED] wrote:
web.archive.org contains the site history:
http://web.archive.org/web/*re_/http://www.unununium.org
Going back to Jan 2007 is enough to discover that their repository was at
http://www.unununium.org/darcs/ - and it's
On Tue, Oct 7, 2008 at 5:18 AM, [EMAIL PROTECTED] wrote:
Has PyFIT been completely abandoned? Is there a better alternative or
other resources to help me integrate fitnesse and python?
I for one am not interested in this kind of framework
for testing - and yet I come from a strict Software
On Tue, Oct 7, 2008 at 9:15 AM, Roy Smith [EMAIL PROTECTED] wrote:
Does there exist a pure Python version of a MySQL module? I've got a data
logging application that needs to run on a whole bunch of OSs, ranging from
Windows to a dozen different unix flavors on all sorts of hardware.
On Tue, Oct 7, 2008 at 9:25 AM, Blubaugh, David A. [EMAIL PROTECTED] wrote:
close to real time constraints? For example is it possible to develop a
python program that can address an interrupt or execute an operation
within 70 Hz or less?? Are there any additional considerations that I
should
On Tue, Oct 7, 2008 at 11:48 AM, Jean-Paul Calderone [EMAIL PROTECTED] wrote:
Indeed, this looks wrong - or at least inconclusive. The benchmark
above demonstrates throughput, not minimum (or maximum, or average,
or any other statistic) response latency, which is what the OP was
really asking
On Tue, Oct 7, 2008 at 2:12 PM, Tino Wildenhain [EMAIL PROTECTED] wrote:
Will you be asking for a pure python implementation of mysql
in the next question? ;) Why not use the proxy approach (for
example via xmlrpc) as suggested by James or just spill to
a file? :-)
You could for example use
On 10/2/08, Phillip B Oldham [EMAIL PROTECTED] wrote:
On Oct 2, 1:32 am, James Mills [EMAIL PROTECTED] wrote:
http://hg.shortcircuit.net.au/index.wsgi/pymills/file/b7498cd4c6a4/ex...
Thanks for the example, but its not loading.
Sorry my VPS has been down for quite
some time today
On Fri, Oct 3, 2008 at 2:13 AM, Daniel [EMAIL PROTECTED] wrote:
Hello,
I can't seem to get my sockets code to work right. Here is what I
have inside my RequestHandler handle() function:
total_data=[]
data = True
logger_server.debug(self.__class__.__name__ + ' set
On 10/2/08, Phillip B Oldham [EMAIL PROTECTED] wrote:
On Oct 2, 1:28 am, James Mills [EMAIL PROTECTED] wrote:
Phillip, I have been developing a rather unique
event-driven and component architecture library
for quite some time that is (not twisted). Actually
it's nothing like twisted
On Wed, Oct 1, 2008 at 6:01 PM, Phillip B Oldham
[EMAIL PROTECTED] wrote:
Are there any python event driven frameworks other than twisted?
Phillip, I have been developing a rather unique
event-driven and component architecture library
for quite some time that is (not twisted). Actually
it's
On Wed, Oct 1, 2008 at 6:55 PM, Phillip B Oldham
[EMAIL PROTECTED] wrote:
I've noticed that. I'm thinking more for a web environment (instead of
MVC) or as a HTTP server. I know Twisted has TwistedWeb, but I'm
looking for alternatives.
Again with pymills, here's an alternative:
On Thu, Oct 2, 2008 at 2:09 AM, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
view doesn't imply (x)html - any valid HTTP response is ok. The whole
point of decoupling controler from view (in web MVC) is to allow the same
controler to return different views.
There is an alternative to the MVC
On Thu, Oct 2, 2008 at 3:34 PM, est [EMAIL PROTECTED] wrote:
wow. It's giga-size file. I need stream reading it, md5 it. It may
break for a while.
So use generators and consume the stream ?
--JamesMills
--
--
-- Problems are solved by method
--
New submission from James Mills [EMAIL PROTECTED]:
Trying to use pydoc in it's webserver mode fails:
$ pydoc3.0 -p 8000
pydoc server ready at http://localhost:8000/
Exception happened during processing of request from ('127.0.0.1', 42939)
Traceback (most
sui,
I am sure you'll find many web services
that you can use to send SMS'. Your
problem would then become one of
learning how to communicate and access
web services in Python. Start with:
* urllib and urllib2
* xmlrpc
There are others...
cheers
James
On Tue, Sep 30, 2008 at 1:47 PM, sui
On Fri, Sep 26, 2008 at 8:20 AM, Lawrence D'Oliveiro
[EMAIL PROTECTED] wrote:
Object orientation IS procedural.
Correction: OOP is Imperative.
--JamesMills
--
--
-- Problems are solved by method
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Sep 26, 2008 at 6:14 AM, [EMAIL PROTECTED] wrote:
Typed parameters. Method-Declaration-filtered-typed parameters. That's what
I'm thinking of.
Why do we need this (rubbish) ?
Seriously. The use-case is far too small.
And don't invent use-cases either.
Instead of coming up with ideas
On 22 Sep 2008 09:07:43 GMT, Steven D'Aprano
But that's precisely what I want to avoid: I don't want the objects to
share *any* state, not even their class. I'm not trying for a Borg or
Singleton: the user can call the factory as many times as they want, but
the objects returned shouldn't
satoru,
I should point out that the normal
approach is to just try whatever it
is that you're doing, and let it fail
where it fails. For example:
def processSeq(x):
for i in x:
print i
processSeq([1, 2, 3])
processSeq(foobar)
processSeq(5) -- This will fail.
cheers
James
On Sat, Sep
Hi,
Wouldn't a normal class called State
suffice for storing state between calls ?
And ... Creating a state instance ?
For example:
class State(object):
State() - new state object
Creates a new state object that is suitable
for holding different states of an application.
Usefull in
On Mon, Sep 22, 2008 at 9:05 AM, Steven D'Aprano
[EMAIL PROTECTED] wrote:
I'm not wedded to the idea, there are alternatives (perhaps the factory
should instantiate the class and return that?) but I assume others have
used this design and have a name for it.
The problem is, I don't see why
On Mon, Sep 22, 2008 at 9:39 AM, Calvin Spealman [EMAIL PROTECTED] wrote:
I call it an obvious misuse and misunderstanding of why you'd use a class in
the first place. Either create an instance and not make these things
classmethods or just share the stuff in a module-level set of variables.
This is wrong. Python _is_ a full OOP language.
Everything form modules, functions to basic data types are an object.
--JamesMills
On Sat, Sep 20, 2008 at 7:23 PM, candide [EMAIL PROTECTED] wrote:
Excerpt quoted from http://www.astro.ufl.edu/~warner/prog/python.html :
About Python: Python is
Hi James,
I can't say I really agree with your
proposal. I tend to keep the help
descriptions of my options short
and concise and to the point.
Also, one must use the language's
features (indentation) to your advantage,
as doing so ensure readability.
For example (from my bhimport tool):
On Fri, Sep 19, 2008 at 6:24 AM, Fredrik Lundh [EMAIL PROTECTED] wrote:
James Matthews wrote:
I am wondering what are the major points of twisted over regular python
sockets. I am looking to write a TCP server and want to know the pros can
cons of using one over the other.
Twisted is a
On Thu, Sep 18, 2008 at 9:02 PM, James Nicolson [EMAIL PROTECTED] wrote:
Perhaps it is better to keep descriptions short and store longer
descriptions elsewhere, but there are many programs that have long
descriptions, for example try: ls --help (at least on my machine a lot
of these
Hi Kelie,
Check out sympy it is capable of doing things like this.
cheers
James
On Thu, Sep 11, 2008 at 5:09 PM, Kelie [EMAIL PROTECTED] wrote:
Hello group,
Is there any packages in Python that will help me solve functions
similar to this:
x = a*(1+bx)**2.5-c where a, b, c is known and
Hi all,
Are there any known alternatives
to the traditional RDBMS (MySQL,
PostgreSQL, SQLite, Oracle, etc0 /
I know of 3 written in Python:
* buzhug
* kirbybase
* PyDbLite
buzhug
-
Although buzhug has a group
membership size of ~60 or so it
has not seen any activity in some
time -
On Thu, Sep 11, 2008 at 12:51 AM, Tino Wildenhain [EMAIL PROTECTED] wrote:
Looks as you didn't mention ZODB yet.
As it is actively developed, it is maybe something
you could consider.
Problem with ZODB is that
I find that anything that comes
out of Zope to be far too
complicated in design and
On Thu, Sep 11, 2008 at 3:40 AM, Daniel Fetchinson
[EMAIL PROTECTED] wrote:
There is also dejavu: http://www.aminus.net/dejavu
This is an ORM. They are
off-topic for this thread :)
cheers
James
--
--
-- Problems are solved by method
--
http://mail.python.org/mailman/listinfo/python-list
Tzury,
You may consider using pymills
to simplify writing your UDP server
and just concentrating on the
behavior of the system.
You can get a copy of the
latest development branch
by cloning it with Mercurial:
hg clone http://hg.shortcircuit.net.au/pymills/
There is an example UDP Server
in
On Thu, Sep 11, 2008 at 10:36 AM, Nick Craig-Wood [EMAIL PROTECTED] wrote:
For UDP I wouldn't thread or, fork, I'd use select and run
asynchronously.
http://docs.python.org/lib/module-select.html
Actually if I really had to do this I'd use twisted. Right tool for
the job!
For anyone
On Thu, Sep 11, 2008 at 12:06 PM, alex23 [EMAIL PROTECTED] wrote:
James Mills [EMAIL PROTECTED] wrote:
This is an ORM. They are
off-topic for this thread :)
Tsk, such an unfounded bias...
To be honest. I have since now
tried both ZODB and Durus and
both seem really nice. I still do
think
Hi,
This is convention only
and typically used to denote
that a particular class attribute
is private. Though note,
there is really no such thing in
Python.
cheers
James
On Tue, Sep 9, 2008 at 7:31 AM, AON LAZIO [EMAIL PROTECTED] wrote:
Hi, Pythoners.
I would like to know that in some
Hi,
Perhaps you might want to
try out using a sample spider
I wrote and base your code of
this ?
See:
http://hg.shortcircuit.net.au/index.wsgi/pymills/file/b9936ae2525c/examples/spider.py
cheers
James
On Tue, Sep 9, 2008 at 2:24 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi,
I can read
Hi,
a = [1,2,3]
b = [3,2,1,4]
a = set(a)
b = set(b)
a.intersection(b)
set([1, 2, 3])
Is this what you want ?
cheers
James
On 9/8/08, mathieu [EMAIL PROTECTED] wrote:
Hi there,
I am trying to write something very simple to test if a list
contains another one:
a = [1,2,3]
b =
Hi,
This is the strangest post I've seen
since I've joined this list (only
recently). What the ?
cheers
James
On Mon, Sep 8, 2008 at 7:00 AM, castironpi [EMAIL PROTECTED] wrote:
I am concerned by the lack of follow-through on some responses to
recent ideas I have described. Do I merely have
Can we stop this thread now? :)
I think we've all seen what the intended
behavior of sum(), max() and other
similar functions.
cheers
James
On Mon, Sep 8, 2008 at 3:30 AM, Mensanator [EMAIL PROTECTED] wrote:
On Sep 6, 11:05�pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
On
Hi,
Here's a (better?) function:
def permutate(seq):
if not seq:
return [seq]
else:
temp = []
for k in range(len(seq)):
part = seq[:k] + seq[k+1:]
for m in permutate(part):
temp.append(seq[k:k+1] + m)
return temp
Hi,
There is a much easier more consistent way:
import locale
locale.setlocale(locale.LC_ALL, en_AU.UTF-8)
'en_AU.UTF-8'
locale.format(%0.2f, 500, True)
'5,000,000.00'
cheers
James
On Mon, Sep 8, 2008 at 5:24 AM, Alan G Isaac [EMAIL PROTECTED] wrote:
On 9/7/2008 12:22 PM SimonPalmer
Hi,
There is never a clever way
of doing anything, but:
$ cat test.py
MAPPING_DICT = {'a': 'A','b': 'B',}
my_dict = {'a': '1','b': '2'}
my_dict = dict((MAPPING_DICT[k], my_dict[k]) for k in my_dict)
print my_dict
$ python test.py
{'A': '1', 'B': '2'}
$
That should do the trick.
cheers
James
On Mon, Sep 8, 2008 at 8:37 AM, John Machin [EMAIL PROTECTED] wrote:
Is this homework?
I hope it's not - or I'll be quite annoyed :)
There seems to be an implicit assumption in the answers so far that
your mapping is a 1:1 mapping of all possible input keys.
If it doesn't include all
On Mon, Sep 8, 2008 at 8:59 AM, John Machin [EMAIL PROTECTED] wrote:
What do you mean by this right? Perhaps the Divine Right of OPs,
managers, examiners, business analysts, etc never to give a complete
spec up front and never to contemplate the consequences of Murphy's
Law?
Now you're being
On Fri, Aug 29, 2008 at 9:28 AM, Paul McNett [EMAIL PROTECTED] wrote:
When confronted with this type of question, I ask the interpreter:
{{{
mac:~ pmcnett$ python
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type help, copyright,
Hi,
If you cannot use a simple data structure/format
like JSON, or CSV, or similar, _don't_
use eval or exec, but use the pickle
libraries instead. This is much safer.
cheers
James
On Fri, Aug 29, 2008 at 7:51 AM, Fett [EMAIL PROTECTED] wrote:
I am creating a program that requires some data
Hi,
You could use generators connected
via a pipe or tcp socket ...
cheers
James
On Fri, Aug 29, 2008 at 10:35 AM, Mohamed Yousef [EMAIL PROTECTED] wrote:
Hello ,
let's say , I'm moving large files through network between devices
what is the fastest way to do this ?
what i came up with :-
Hi,
There is a great set of slides on this topic
available here: http://www.dabeaz.com/generators/
They explain this concept quite well and
walk you through everything you need to
know about generators and how powerful
they can be.
Please read it.
cheers
James
On 8/27/08, Hussein B [EMAIL
On Thu, Aug 28, 2008 at 2:21 PM, ssecorp [EMAIL PROTECTED] wrote:
Also, is there anything like Cpan for Python?
Try the Python Cheese Shop / PyPi
http://pypi.python.org/pypi
cheers
James
--
--
-- Problems are solved by method
--
http://mail.python.org/mailman/listinfo/python-list
501 - 567 of 567 matches
Mail list logo