Stargaming [EMAIL PROTECTED] wrote in news:46b6df49$0$26165
[EMAIL PROTECTED]:
On Sun, 05 Aug 2007 23:50:24 -0700, Lee Fleming wrote:
Hello,
I have a simple question. Say you have the following function:
def f(x, y = []):
y.append(x)
return y
print f(23) # prints [23]
print
Steve Holden [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Sonu wrote:
hello all ,
I want to watch my TV, but it's not working. Can you tell me how to
fix it? ...
I can help you... but only with a couple of channels :-).
i need to run psql from my py file,,
for that i am using :
Robert Rawlins - Think Blue [EMAIL PROTECTED]
wrote in news:[EMAIL PROTECTED]:
This is a multipart message in MIME format.
--=_NextPart_000_00B0_01C7D5B0.02EB8BA0
Hello Guys,
I'm looking for some advice on how best to handle file read/write
errors with try/except as i'm a
Robert Rawlins - Think Blue [EMAIL PROTECTED]
wrote in news:[EMAIL PROTECTED]:
Thanks for your ideas guys,
I'm unfortunately tied to 2.4 so don't have the full try except
status, but I'm now working with the following code:
def addApp(self, event):
try:
james_027 [EMAIL PROTECTED] wrote in news:1186036331.304916.304020
@e9g2000prf.googlegroups.com:
hi
for example I have this dictionary
dict = {'name':'james', 'language':'english'}
value = 'sex' in dict and dict['sex'] or 'unknown'
is a right pythonic of doing this one? I am trying
[EMAIL PROTECTED] (Alex Martelli) wrote in news:1i26u6o.pthuan2j7nufN%
[EMAIL PROTECTED]:
Alex Popescu [EMAIL PROTECTED] wrote:
...
Have you seen/heard of Jim lately? Cause I haven't. By the time he
was
the lead of the AspectJ team his charismatic presence was everywhere
(at
least
Bruno Desthuilliers [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Steven D'Aprano a écrit :
(snip)
Instead of doing:
if callable(function): function()
you should do:
try:
function()
except TypeError:
pass
There are time where you may want to know if you have a
[EMAIL PROTECTED] (Alex Martelli) wrote in news:1i27mku.1sc8l3x1dda3crN%
[EMAIL PROTECTED]:
Bruno Desthuilliers [EMAIL PROTECTED]
wrote:
Alex Popescu a écrit :
[... snip ...]
The mere check of whether an object possesses some important special
method is best accomplished through
[EMAIL PROTECTED] (Alex Martelli) wrote in news:1i23wyk.avc945i4dwsiN%
[EMAIL PROTECTED]:
NicolasG [EMAIL PROTECTED] wrote:
...
The problem is that I would like to work as a Python programmer but
all the job vacancies I can find requires a couple of years of
professional experience ...
Robert Dailey [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
--=_Part_51775_19953536.1185988361742
Hi,
I'm currently interested in creating an __add__() operator for one of
my classes. This class handles both integers and objects its own type,
however I don't know how I can
[EMAIL PROTECTED] (Alex Martelli) wrote in news:1i25pjo.1mo5uqc1yxqsjkN%
[EMAIL PROTECTED]:
Alex Popescu [EMAIL PROTECTED] wrote:
...
and you will both learn a lot _and_ acquire professional
experience
that any enlightened employer will recognize as such.
It depends :-). In my
Gabor Urban [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
--=_Part_36089_18686793.1185871599583
Hullo,
I have started to use Python's logging, and got a problem. I have
created some loggers and wrote some lines in the log. The problem is,
that most of the lines appear doubled in
Wingware [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi,
I'm happy to announce the first beta release of Wing IDE 3.0. It is
available from http://wingware.com/wingide/beta
[snip...]
There is one feature that I would like to suggest: open module in project.
Currently you need
Steven D'Aprano [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On Sat, 28 Jul 2007 15:17:56 +, Alex Popescu wrote:
Hi all!
From another thread (and the pointed PEP) I have found that execfile
will not be present in Py3k. So, I am wondering what will be its
replacement
[EMAIL PROTECTED] (John J. Lee) wrote in news:[EMAIL PROTECTED]:
Alex Popescu [EMAIL PROTECTED] writes:
Zentrader [EMAIL PROTECTED] wrote in
news:1185041243.323915.161230 @x40g2000prg.googlegroups.com:
On Jul 21, 7:48 am, Duncan Booth [EMAIL PROTECTED]
wrote:
[snip...]
From the 2.6
Hi all!
From another thread (and the pointed PEP) I have found that execfile will
not be present in Py3k. So, I am wondering what will be its replacement?
Considering that most probably Py3k will keep eval and exec, this will
still be possible (indeed requiring manual loading of the file
Kevin T. Ryan [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi All -
I'm having a problem and I hope you can help. I can't seem to import
packages from within the package substructure as I think I should be
able to. For example, I create a directory structure as follows:
testpkg
Neal Becker [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]:
import exceptions
class nothing (exceptions.Exception):
def __init__ (self, args=None):
self.args = args
if __name__ == __main__:
raise nothing
Traceback (most recent call last):
File stdin, line 1, in
Ben Finney [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
[EMAIL PROTECTED] writes:
from . import *
from .sibiling import *
from .. import *
from ..parent_sibling import *
...and so on. The same error occurs:
SyntaxError: 'import *' not allowed with 'from .'
Neal Becker [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Alex Popescu wrote:
Neal Becker [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
[snip...]
You can pass to the exception:
a) a string (it will become the message)
b) a tuple of values (can it be a list also
Stef Mientki [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
hello,
I want to remove some items from a dictionary,
so I would expect this should work:
Nets = {}
... fill the dictionary Nets
for net in Nets:
if net.upper() in Eagle_Power_Nets :
del Nets [ net
Steve Holden [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Alex Popescu wrote:
Alex Popescu [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Diez B. Roggisch [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
[snip...]
If, that is, work means Raise an AttributeError due
Alex Popescu [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi all!
I am trying to use the os.path.walk function, but I am getting a weird
error:
def _walk(dir_name):
def selector(arg, dirname, fnames):
print selector
os.path.walk(dir_name, selector, None)
File C
Alex Popescu [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi all!
I am trying to use the os.path.walk function, but I am getting a weird
error:
def _walk(dir_name):
def selector(arg, dirname, fnames):
print selector
os.path.walk(dir_name, selector, None)
File C
Hi all!
I am trying to use the os.path.walk function, but I am getting a weird
error:
def _walk(dir_name):
def selector(arg, dirname, fnames):
print selector
os.path.walk(dir_name, selector, None)
File C:\zengarden\python\python25\lib\ntpath.py, line 325, in walk
names =
Bruno Desthuilliers [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Alex Popescu a écrit :
[snip...]
I don't have the book, so if you don't post the code, I just give up
trying to guess what the problem can be.
I've sent the original code and 2 different variants a long time ago
Hi all!
I was reading through Python Cookbook the Singleton recipe. At this moment
I am a bit puzzled as the example in the book is not working resulting in:
TypeError: type.__new__(SingleSpam): SingleSpam is not a subtype of type
(I haven't presented the original code as I am not sure about
Diez B. Roggisch [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Alex Popescu schrieb:
Hi all!
I was reading through Python Cookbook the Singleton recipe. At this
moment I am a bit puzzled as the example in the book is not working
resulting in:
TypeError: type.__new__(SingleSpam
Alex Popescu [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Diez B. Roggisch [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Alex Popescu schrieb:
Hi all!
I was reading through Python Cookbook the Singleton recipe. At this
moment I am a bit puzzled as the example in the book
G [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
--=_Part_187401_13883248.1185238999144
Hi,
I am trying to subclass int to allow a constructor to accept None.
I am
trying the following
class INT(int):
def __init__(self, x):
if x is None:
Neil Cerutti [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On 2007-07-24, Alex Popescu [EMAIL PROTECTED] wrote:
Bruno Desthuilliers [EMAIL PROTECTED]
wrote in news:[EMAIL PROTECTED]:
[snip...]
class MyClass(object):
class_list = ['a', 'b']
def instance_method(self
Steven D'Aprano [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On Tue, 24 Jul 2007 21:35:58 +, Alex Popescu wrote:
Neil Cerutti [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On 2007-07-24, Alex Popescu [EMAIL PROTECTED] wrote:
Bruno Desthuilliers
[EMAIL PROTECTED] wrote
Neil Cerutti [EMAIL PROTECTED] wrote in news:eRwpi.36813$G23.28496
@newsreading01.news.tds.net:
On 2007-07-25, Alex Popescu [EMAIL PROTECTED] wrote:
As a matter of style, how do you figure out that class_list is
a class attribute and not an instance attribute? (I don't
remember seeing
Zentrader [EMAIL PROTECTED] wrote in news:1185041243.323915.161230
@x40g2000prg.googlegroups.com:
On Jul 21, 7:48 am, Duncan Booth [EMAIL PROTECTED] wrote:
[snip...]
From the 2.6 PEP #361 (looks like dict.has_key is deprecated)
Python 3.0 compatability: ['compatibility'--someone should use
On 7/22/07, Ryan Ginstrom wrote:
Hi Alex:
Do you develop for Windows? Are you looking to automate a build
process?
The standard library's build module is distutils:
http://docs.python.org/lib/module-distutils.html
As I mentioned in my post, I use a variety of third-party modules
Bruno Desthuilliers [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Alex Popescu a écrit :
Jakub Stolarski [EMAIL PROTECTED] wrote in
[snip...]
d = dict()
answer = d.get('answer', 42)
answer in d
= False
Thanks. I think to make the 3rd approach completely equivalent I should
Ryan Ginstrom [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On Behalf Of Paul Rubin
I'm wondering how other projects go about this.
I develop an automated build system from the very beginning. Running
the build script:
* Creates the API documentation (epydoc)
* Creates the help
Nathan Harmston [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Hi,
I have being thinking about this and was wondering with built in types
you can do things like
float(1) or str(200)
is there way I can define conversion functions like this:
say i have a class A and a class B
Hi all!
I am pretty sure this has been asked a couple of times, but I don't seem
to find it on the archives (Google seems to have a couple of problems
lately).
I am wondering what is the most pythonic way of dealing with missing
keys and default values.
According to my readings one can take
Neil Cerutti [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On 2007-07-20, Alex Popescu [EMAIL PROTECTED] wrote:
Hi all!
I am pretty sure this has been asked a couple of times, but I
don't seem to find it on the archives (Google seems to have a
couple of problems lately).
I am
Jakub Stolarski [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Version 1 and 2 do different thing than version 3. The latter doesn't
add value to dict.
As it was mentioned before, use:
1 - if you expect that there's no key in dict
2 - if you expect that there is key in dict
I may
[EMAIL PROTECTED] wrote in news:1184970471.146819.86280
@r34g2000hsd.googlegroups.com:
I am not sure about your scenario, but as you discovered the sort() method
is modifying the in place list (and doesn't return a new one).
If you just want to iterate over your dict in an ordered manner than
Miles [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
On 7/20/07, Alex Popescu [EMAIL PROTECTED] wrote:
If you just want to iterate over your dict in an ordered manner than
all you have to do is:
for k in my_dict.keys().sort():
# rest of the code
I think you meant sorted
On Jul 17, 4:41 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
[EMAIL PROTECTED] escribió:
On Jul 17, 1:44 am, Stef Mientki [EMAIL PROTECTED]
wrote:
I want to have a (dynamically) list of all classes defined in a py-file.
Is there a way
On Jul 17, 4:41 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
[EMAIL PROTECTED] escribió:
On Jul 17, 1:44 am, Stef Mientki [EMAIL PROTECTED]
wrote:
I want to have a (dynamically) list of all classes defined in a py-file.
Is there a way
Sanjay skpatel20 at gmail.com writes:
Hi All,
I tried posting in this group twice since last week, but the messages
did not appear in the forum. Don't know why. Trying this message
again...
Sanjay
Something similar seemed to happen to me too, but when checking with gmane I've
Alex Popescu the.mindstorm.mailinglist at gmail.com writes:
On Jul 17, 4:41 am, Gabriel Genellina gagsl-... at yahoo.com.ar
wrote:
En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
the.mindstorm.mailingl... at gmail.com escribi
I apologize for posting the previous message a couple
On Jul 17, 4:41 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
[EMAIL PROTECTED] escribió:
On Jul 17, 1:44 am, Stef Mientki [EMAIL PROTECTED]
wrote:
I want to have a (dynamically) list of all classes defined in a py-file.
Is there a way
On Jul 17, 1:44 am, Stef Mientki [EMAIL PROTECTED]
wrote:
I want to have a (dynamically) list of all classes defined in a py-file.
Is there a way of getting this list, without manually parsing the file ?
thanks,
Stef Mientki
I have written something that does something like this, but I am
On Jul 13, 6:02 am, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Alex Popescu a écrit :
(snip)
You are defining the list in the class context and so it becomes a
class field/member.
'attribute' is the pythonic term.
Thanks! I'm just a couple of weeks Python old, so I am still fighting
I read in this thread lots of different (hopefully personal) opinions
on the question of Java vs Python,
so I thought I will post mines too (with the amendment that I am a
Java guy, spending there more than 10 years).
I don't think you can do a performance comparison upfront (without
having it
On Jul 14, 6:27 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Fri, 13 Jul 2007 13:24:57 -0300, bvdp [EMAIL PROTECTED] escribió:
Seehttp://effbot.org/zone/import-confusion.htm
Try to move the circular references later in the code (maybe inside a
function, when it is required), or
On Jul 15, 3:00 pm, Steve Holden [EMAIL PROTECTED] wrote:
Alex Popescu wrote:
On Jul 14, 5:55 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
So, as always, one should measure in each specific case if optimization is
worth the pain [...].
I hope I am somehow misreading the above
On Jul 15, 10:08 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Sun, 15 Jul 2007 08:49:54 -0300, Alex Popescu
[EMAIL PROTECTED] escribió:
But, I still don't understand how python can access a function in a
file I have NOT included. In this case, to get things to work, I DO
On Jul 14, 5:55 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
So, as always, one should measure in each specific case if optimization is
worth the pain [...].
I hope I am somehow misreading the above sentence :-). IMO synonim
language contructs
should result in the same performance or at
On Jul 12, 6:23 pm, Jeremy Lynch [EMAIL PROTECTED] wrote:
Hello,
Learning python from a c++ background. Very confused about this:
class jeremy:
list=[]
def additem(self):
self.list.append(hi)
return
temp = jeremy()
On Jul 12, 5:24 pm, Andre Engels [EMAIL PROTECTED] wrote:
2007/7/12, Andre Engels [EMAIL PROTECTED]:
I forgot to include
import urllib2, re
here
def textonly(url):
# Get the HTML source on url and give only the main text
f = urllib2.urlopen(url)
text = f.read()
r =
On Jul 11, 1:25 pm, Stefan Behnel [EMAIL PROTECTED] wrote:
rvr wrote:
On Jul 11, 1:28 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Wed, 11 Jul 2007 01:06:04 +, rvr wrote:
Is there a way to edit the file in place? The best I seem to be able to
do is to use your second solution to
On Jul 11, 4:15 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote:
Forgive my newbie ignorance, but I am wondering why the other method
would not work? I mean it may not be very safe,
but I guess it may perform a lot better, than having to read the whole
file just to cut out the first byte.
On Jul 11, 7:45 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote:
Alex Popescu wrote:
On Jul 11, 4:15 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote:
Forgive my newbie ignorance, but I am wondering why the other method
would not work? I mean it may not be very safe,
but I guess it may
On Jul 10, 5:07 pm, Daniel Nogradi [EMAIL PROTECTED] wrote:
I have an issue I think Python could handle. But I do not have the knowledge
to do it.
Suppose I have a class 'myClass' and instance 'var'. There is function
'myFunc(..)'. I have to add (or bind) somehow the function to the
On Jul 9, 6:42 pm, Rob Cakebread [EMAIL PROTECTED] wrote:
On Jul 9, 7:54 am, [EMAIL PROTECTED] wrote:
snip
code
mod = modulefinder.ModuleFinder()
mod.run_script(path/to/python_script.py)
mod.report()
/code
Mike
Nope. All of those tools and the code above show *all* imports/
On Jul 9, 6:31 pm, brad [EMAIL PROTECTED] wrote:
When I use idle or a shell to execute a python script, the script
executes in the directory it is currently in (in this case, my desktop).
However, when using GNOME and right clicking the py script and selecting
'open with python', the execution
On Jul 6, 4:20 am, Christoph Zwerschke [EMAIL PROTECTED] wrote:
Alex Popescu wrote:
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 6, 4:20 am, Christoph Zwerschke [EMAIL PROTECTED] wrote:
Alex Popescu wrote:
Probably the simplest solution would be to create a new exception and
wrapping the old one and the additional info. Unfortunately, this
may have a huge impact on 3rd party code that was catching
On Jul 6, 6:19 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
Alex Popescu [EMAIL PROTECTED] wrote:
...
frameworks (TestNG is not a unit testing framework,
but a full flavored testing framework that fits perfectly functional
testing, integration testing, and with some of the
very
On Jul 5, 11:17 am, Michele Simionato [EMAIL PROTECTED]
wrote:
On Jul 5, 3:41 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
snip
Alex already explained everything beautifully. I will just add a link
to
the definite guide to
descriptors:http://users.rcn.com/python/download/Descriptor.htm
On Jul 5, 3:32 pm, Steve Holden [EMAIL PROTECTED] wrote:
Alex Popescu wrote:
On Jul 5, 11:17 am, Michele Simionato [EMAIL PROTECTED]
wrote:
On Jul 5, 3:41 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
snip
Alex already explained everything beautifully. I will just add a link
On Jul 6, 12:21 am, Christoph Zwerschke [EMAIL PROTECTED] wrote:
Kay Schluehr wrote:
If you are sure that the exception isn't caught on another level just
use the following showtraceback() function, manipulate it's output
slightly and terminate your program with sys.exit()
That's what I
On Jul 5, 5:46 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Kay Schluehr wrote:
On Jul 3, 8:12 pm, [EMAIL PROTECTED] (Cameron Laird) wrote:
Python is simply easier than C++; you might
well find that a debugger, for example, doesn't feel as essential
as it is for you with C++.
On Jul 5, 5:01 pm, Michele Simionato [EMAIL PROTECTED]
wrote:
On Jul 5, 3:17 pm, Alex Popescu [EMAIL PROTECTED]
wrote:
The true story is that
while working on Groovy (I am a committer on this dynlang meant to run
on the Java VM:http://groovy.codehaus.org) and reading some Python
Hi all!
I am pretty new to Python, so please excuse me if I am missing
something. Lately, I've been playing with decorators and I am a bit
confused about some behavior. Here is the code that puzzles me:
in python shell:
def function():
pass
class A(object):
def method(self):
pass
from
On Jul 5, 1:52 am, Alex Popescu [EMAIL PROTECTED]
wrote:
Hi all!
I am pretty new to Python, so please excuse me if I am missing
something. Lately, I've been playing with decorators and I am a bit
confused about some behavior. Here is the code that puzzles me:
in python shell:
def function
73 matches
Mail list logo