Mars creature wrote:
Dear Python users,
I just start to use python and love this language. I met this
problem when I try to save my functions in a separate file.
The question is how I can pass a global variable to a function which
is saved in another file. If I save the function I defined in th
understand the point that global variables tends to mess up
programs.
Assume that I have 10 parameters need to pass to the function. If
these parameters are fixed, I can use another module to store these 10
parameters, and import to the module, as suggested by jean-michel. But
what if these 10 param
Medi wrote:
Can I present multiple directories to epydoc to process. For example
epydoc -option -option -option dir_1 dir_2 dir_3
where dir_i is a directory containing some python src codes ?
I am currently running it on two directories with about 10M + 20 Meg
which takes a very long time (mor
Philip Semanchuk wrote:
Hi all,
Our project uses some libraries that were written by 3rd parties (i.e.
not us). These libraries fit into a single Python file and live in our
source tree alongside other modules we've written. When our app is
distributed, they'll be included in the installation.
It doesn't really
matter in the end.
Cheers,
Jean-Michel
--
http://mail.python.org/mailman/listinfo/python-list
Montaseri wrote:
Thank you
It looks like it is possible to feed multiple dirs,
Also, can you explain the --inheritance=STYLE for me. What does the
author mean by values like "grouped", "listed", "included"
I could not find any good document explaining these...
Thanks
Medi
Sorry, I don't reme
Ben Finney wrote:
Scott David Daniels writes:
Scott David Daniels wrote:
class Initialized(ClassBase):
@classmethod
def _init_class(class_):
class_.a, class_.b = 1, 2
super(Initialized, class_)._init_class()
Mea culpa: Here super is
alex23 wrote:
Jean-Michel Pichavant wrote:
a possible answer:
- explicit >> implicit
I'm not sure this is the correct one though :)
To me, the explicit reference to the base class violates DRY. It also
means you need to manually change all such references should the base
OdarR wrote:
hello,
* this is not a troll *
which kind of help you have with your favorite editor ?
personnally, I find emacs very nice, in the current state of my
knowledge, when I need to reindent the code.
you know how this is critical in python...:-)
I don't use other python-mode features
Apart of trolling which is also an activity I like,
what are the features vim proposes to Python ?
Olivier
Many, but none that you won't find with emacs, so when I'm stating it is
just a matter of personal preference, I mean it :o) "Vi or Emacs" is the
same question as "straight or gay"
Chris Jones wrote:
On Wed, Oct 07, 2009 at 07:06:08PM EDT, TerryP wrote:
[..]
I am a freak: I do not use nor want syntax highlighting. I don't want
my editor to understand mail, irc, or the www either, I want it to
edit text efficiently so I can go on with the rest of my life as soon
as pos
alex23 wrote:
Jean-Michel Pichavant wrote:
alex23 wrote:
To me, the explicit reference to the base class violates DRY. It also
means you need to manually change all such references should the base
class ever change, something that using super() avoids.
I found the correct
Dr. Phillip M. Feldman wrote:
I currently have a function that uses a list internally but then returns the
list items as separate return
values as follows:
if len(result)==1: return result[0]
if len(result)==2: return result[0], result[1]
(and so on). Is there a cleaner way to accomplish the s
Emeka wrote:
Hello All,
I am new to python , and my aim is to use it to write sugar-based
applications on XO(OLPC). I am not new to programming in general, I would
want to know the best route to take in learning python. I have
background in FP and Imperative languages.
Regards,
Emeka
Welcom
Antoon Pardon wrote:
I have been looking for pexpect. The links I find like
http://pexpect.sourceforge.net all end up at
http://www.noah.org/wiki/Pexpect which produces a 404 not
found problem.
Does someone know the current location?
maybe they removed the distribution so you may use "subpr
Peng Yu wrote:
Bash is easy to use
+JOTW
:)
JM
--
http://mail.python.org/mailman/listinfo/python-list
Peng Yu wrote:
I have the following python code snippet. I'm wondering what command I
should use to terminate the program if the arguments are not right.
#!/usr/bin/env python
import sys
import os
if len(sys.argv) <= 1:
print "usage:", os.path.basename(sys.argv[0]), ''
return ## what comma
Carl Banks wrote:
On Oct 15, 10:29 pm, Mark Harrison wrote:
What's the magic to allow this? If the value is not specified I
would like to use the default value of 1.
import optparse
p=optparse.OptionParser()
p.add_option("--debug")
(opts, args) = p.parse_args(['--debug=22']); print opts
(
Jean-Michel Pichavant wrote:
Carl Banks wrote:
On Oct 15, 10:29 pm, Mark Harrison wrote:
What's the magic to allow this? If the value is not specified I
would like to use the default value of 1.
import optparse
p=optparse.OptionParser()
p.add_option("--debug")
(opts, args)
Chris Seberino wrote:
What does this line do?...
input_ = re.sub("([a-zA-Z]+)", '"\\1"', input_)
Does it remove parentheses from words?
e.g. (foo) -> foo ???
I'd like to replace [a-zA-Z] with \w but \w makes it blow up.
In other words, re.sub("(\w+)", '"\\1"', input_) blows up.
Why?
cs
jorma kala wrote:
Hi,
I'm using the logging module.
At one point in my code I disable logging like this:
logging.disable(logging.INFO)
But how can I enable the logging again further on?
I've tried the following, which doesn't work for re-enabling the logger:
my_logger.setLevel(logging.INF
Balban wrote:
Hi,
I have a python build script that calls various commands, some using
os.system().
Often, if I want to terminate the script prematurely, I press ctrl-c,
but I have to do this many times before I can kill the script for
good. I was wondering is there a way that I define a signal
Filip Gruszczyński wrote:
optparse module is quite smart, when it comes to validating options,
like assuring, that certain option must be an integer. However, I
can't find any information about validating, that positional arguments
were provided and I can't find methods, that would allow defining
application entry point
file, in python code. I'm not sure I am that concerned. However being a
great fan of this module, I kindly support you for any improvements you
may add to this module and appreciate all the work you've already done
so far.
Cheers,
Jean-Michel
--
http://mail.python.org/mailman/listinfo/python-list
Vinay Sajip wrote:
Wolodja Wentland cl.uni-heidelberg.de> writes:
--
I usually register a logger 'foo' within the application and one logger
for each module in the package, so the resulting logger hierarchy will
look like this:
foo
|__bar
|__baz
|__n
Diez B. Roggisch wrote:
Peng Yu wrote:
I can navigate to the definition of
class and function by vim + ctags,
Start learning a decent editor (emacs is mine) which allows you to deal
with all of your perceived "problems"
Diez
This is a declaration of war against the vi communit
Peng Yu wrote:
With some automated script, I don't think it is a nightmare to change
function names. I can change function names and filenames and their
reference with a simple command.
I'd think that this is the limitation of current version control
system. I don't aware of any version control
Glenn Hutchings wrote:
Rob Briggs mun.ca> writes:
Is there a way to do a repeat formatting command like in Fortran? Rather
that doing this:
print "%s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f" %
(parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7],
tmp[i][8], tmp[i
Scott David Daniels wrote:
Martin P. Hellwig wrote:
Ben Finney wrote:
Chris Rebert writes:
2009/11/16 Yasser Almeida Hernández :
How is the sintaxis for set the TODO and FIXME tags...?
...
There's no widely-followed “syntax” for this convention, though.
Except for _not_ doing what is sugg
Hi python fellows,
I'm currently inspecting my Linux process list, trying to parse it in
order to get one particular process (and kill it).
I ran into an annoying issue:
The stdout display is somehow truncated (maybe a terminal length issue,
I don't know), breaking my parsing.
import subproc
Nobody wrote:
On Wed, 18 Nov 2009 12:25:14 +0100, Jean-Michel Pichavant wrote:
I'm currently inspecting my Linux process list, trying to parse it in
order to get one particular process (and kill it).
I ran into an annoying issue:
The stdout display is somehow truncated (maybe a ter
ileHandler("client.log"))
rootLogger.handlers[-1].setFormatter(logging.Formatter("%(asctime)s
%(name)-12s %(levelname)-8s %(message)s"))
rootLogger.setLevel(logging.DEBUG)
ser = Server()
cli = Client()
ser.util()
cli.client_test()
Happy logging,
Jean-Michel
--
http://mail.python.org/mailman/listinfo/python-list
, cause I will end up handling
with asserts what I should in fact handle properly in what you call the
production code.
Anyway that does not answer your question I'm sorry to be off topic,
'tis just a thought. Simon gave you the proper answer.
Jean-Michel
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
En Fri, 29 Jan 2010 12:54:23 -0300, Thomas Allen
escribió:
I have a script that runs an instance of SimpleXMLRPCServer and in
general it works as expected. In its __del__, it is supposed to clean
up its PID file (written on boot). I have two problems with this
server
Carl Banks wrote:
On Feb 1, 7:33 pm, Tim Chase wrote:
Stephen Hansen wrote:
First, I don't shadow built in modules. Its really not very hard to avoid.
Given the comprehensive nature of the batteries-included in
Python, it's not as hard to accidentally shadow a built-in,
unknown
Masklinn wrote:
When trying to load the following config file, I get an error
``ConfigParser.NoOptionError: No option 'handlers' in section: 'logger_0'`` (in
both Python 2.6.4 and Python 3.1.1 on OSX, obviously ConfigParser is spelled
configparser in 3.1):
[loggers]
keys=root,0
[
Masklinn wrote:
Jean-Michel Pichavant wrote:
To add a custom level, I would proceed that way:
logging.ALERT = 45
logging.addLevelName(logging.ALERT, 'ALERT !!')
logging.getLogger().log(logging.ALERT, 'test')
Passing a string to the log method as you did is incorrect
Carl Banks wrote:
On Feb 2, 2:49 am, Jean-Michel Pichavant
wrote:
Carl Banks wrote:
Name your modules "send_email.py" or "sort_email.py" or if it's a
library module of related functions, "email_handling.py". Modules and
scripts do things (usually)
The reason is that log takes an *int* as first argument that defines the
logging level. You gave a string. So There is definitely a reason for it to be
incorrect.
That's not a reason, that's just what currently happens. I know it doesn't
work, and I know why, I went and checked the code
Masklinn wrote:
On 3 Feb 2010, at 11:50 , Jean-Michel Pichavant wrote:
You don't neeed to check the code for that ! It is written in the
documentation. The logging module designer choose to ask for a level, not a
level name, possibly because 2 different levels can have the same
Adam Tauno Williams wrote:
Yes, it certainly does. Not that you'll get many Pythonistas to confess
to that fact. Somehow those who brag about the readability and
expressiveness of source code just cannot admit that:
class.method(sting name, int count)
- is *obviously* more expressive than -
MRAB wrote:
In other words:
for attempt in range(2):
try:
spanish_field = translate(english_field, lang_to='es',
lang_from='en')
break
except TranslationError:
pass
else:
# Didn't break out of the loop, therefore not successful.
print "Translation failed
News123 wrote:
Yhanks a lot I'll check whether this is the root cause.
Currently my machine could live without IPV6
bye
N
Gabriel Genellina wrote:
En Thu, 04 Feb 2010 19:34:20 -0300, News123 escribió:
I wrote a small xmlrpc client on Windows 7 with python 2.6
srv = xmlrpclib.S
Ethan Furman wrote:
Julian wrote:
Hello,
I've asked this question at stackoverflow a few weeks ago, and to make
it clear: this should NOT be a copy of the stackoverflow-thread
"hidden features of Python".
I want to design a poster for an open source conference, the local
usergroup will have a
mk wrote:
if isinstance(cmd, str):
self.cmd = cmd.replace(r'${ADDR}',ip)
else:
self.cmd = cmd
or
self.cmd = cmd
if isinstance(cmd, str):
self.cmd = cmd.replace(r'${ADDR}',ip)
I would vote for the first one. But I could use the second as well, I
would'nt fight for it.
What is w
Bruno Desthuilliers wrote:
Julian a écrit :
Hello,
I've asked this question at stackoverflow a few weeks ago, and to make
it clear: this should NOT be a copy of the stackoverflow-thread
"hidden features of Python".
I want to design a poster for an open source conference, the local
usergroup wi
mk wrote:
Jean-Michel Pichavant wrote:
What is worrying me the most in your code sample is that self.cmd can
hold diferrent types (str, and something else). That is usually a bad
thing to do (putting None aside).
However, my remark could be totally irrelevant of course, that
depends on the
bradallen wrote:
Hello,
For container class derived from namedtuple, but which also behaves
like a dictionary by implementing __getitem__ for non-integer index
values, is there a special reserved method which allows intercepting %
string formatting operations? I would like for my container type
John Posner wrote:
On 2/5/2010 9:21 AM, mk wrote:
if isinstance(cmd, str):
self.cmd = cmd.replace(r'${ADDR}',ip)
else:
self.cmd = cmd
or
self.cmd = cmd
if isinstance(cmd, str):
self.cmd = cmd.replace(r'${ADDR}',ip)
(lunatic fringe?)
Last August [1], I offered this alternative
Deos anyone knows where to find an code sample describing how to
implement the interface to marshall one object into XMLRPC compliant
structures ?
I googled without any success, and what google does not find does not exist.
Let say I have this very simple class:
class Point:
def __init__(s
mk wrote:
Jean-Michel Pichavant wrote:
If you can change your program interface, then do it, if not then
you're right you don't have much choice as you are suffering from the
program poor interface.
You can fix this problem by explicitly asking for the thing you want
to do,
mk wrote:
W. eWatson wrote:
I'd like to draw something like an animal track. Between each point
is a line. Perhaps the line would have an arrow showing the direction
of motion. There should be x-y coordinates axises. PIL? MatPlotLib, ??
Pycairo?
turtle
http://docs.python.org/library/turtle
Jean-Michel Pichavant wrote:
Deos anyone knows where to find an code sample describing how to
implement the interface to marshall one object into XMLRPC compliant
structures ?
I googled without any success, and what google does not find does not
exist.
Let say I have this very simple class
mk wrote:
Jean-Michel Pichavant wrote:
Why not dump the whole thing and use Pyro, which works beautifully and
handles all the serialization business by itself, you get a Python
object on the other side? Unless xmlrpc has to be at the other end,
that is.
Company stuff. We are all using
Adam Tauno Williams wrote:
On Fri, 2010-02-05 at 18:24 +0100, Jean-Michel Pichavant wrote:
Jean-Michel Pichavant wrote:
Deos anyone knows where to find an code sample describing how to
implement the interface to marshall one object into XMLRPC compliant
structures ?
I googled without
News123 wrote:
Hi JM,
Jean-Michel Pichavant wrote:
import socket
# server
server = SimpleXMLRPCServer((socket.gethostname(), 5000),
logRequests=False, allow_none=True)
# client
xmlrpclib.ServerProxy("http://%s.yourdomain.com:%s"; %
(socket.gethostname(), 5000))
Wel
Michael Torrie wrote:
Gabriel wrote:
On Fri, Feb 5, 2010 at 9:08 PM, William Gaggioli wrote:
I'm working on setting up some software for a Peruvian non-profit to help
them organize their incoming volunteers. One of the features I'd like to add
is a calendar-like view of the different v
Steve Holden wrote:
Shashwat Anand wrote:
LOL
pow(funny, sys.maxint)
Yes, funny, but it overlooks the point that Xah is a nuisance to
multiple communities, not just to ours, and quite often concurrently.
I'm all in favor of tolerance, but I'd like to see some evidence that
rehabilitat
danielx wrote:
Is there a convention for how to document function (or method)
parameters in doc strings? Recently, I've been doing alot of PHP
programming, and in PHPdoc, you'd do it like this:
/*
* @param type $foo Description.
*
* @return type Description.
*/
function bar($foo) {
...
}
Klaus Neuner wrote:
Hello,
I am writing a program that analyzes files of different formats. I
would like to use a function for each format. Obviously, functions can
be mapped to file formats. E.g. like this:
if file.endswith('xyz'):
xyz(file)
elif file.endswith('abc'):
abc(file)
...
Y
Aahz wrote:
In article <0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>,
OdarR wrote:
and with eval(), did you try ?
WARNING: eval() is almost always the wrong answer to any question
Some say that eval is evil !
JM
--
http://mail.python.org/mailman/listinfo/py
Carl Banks wrote:
On Feb 8, 12:20 pm, spike wrote:
Has anyone been able to come across a Python logic map or Python logic
flow chart?
An example can be seen on the right under
History:http://en.wikipedia.org/wiki/Usenet#History
This would be very helpful for all users.
Begin
|
I use this one:
Begin
|
|
V
Start Mail client
|
|
V
Ask python-list <-+
| |
| |
Vwhat a bunch of dumbass wait 2 min|
| |
| | No.
V |
Did you get any answer
Jordan Apgar wrote:
I have a simple tcp server and client where the server sits and waits
for a message and then processes it, my client sends its first message
to the server. On the server I receive:
socket.error: [Errno 107] Transport endpoint is not connected
when calling
msg = self.socket.r
Jordan Apgar wrote:
I found my car ;)
here's the server:
class commServer:
"""Class to hold a tcp server and interact with with it
allows for a wrapper around socket class to keep code clean"""
def __init__ (self, host, hostid, port, buff =1024):
self.host = host
se
CyclingGuy wrote:
Can anyone recommend a PostgreSQL driver for Python that supports
selecting and inserting bytea types?
I'm not looking to write server functions in Python, just client
applications.
Thank you
Eric.
Did you try any ?
I know about pgdb, and since it has a function called esca
Jordan Apgar wrote:
http://docs.python.org/library/socketserver.html
JM
each time a handler is spawned is it client specific? in other words
when two clients send something to the server do handlers spawn for
each of them or does everything just go into a single handler?
docstring of
Grant Edwards wrote:
What's the correct way to measure small periods of elapsed
time. I've always used time.clock() in the past:
start = time.clock()
[stuff being timed]
stop = time.clock()
delta = stop-start
However on multi-processor machines that doesn't work.
Sometimes I get
Jordan Apgar wrote:
thanks JM,
at this point i switched over to this scheme and now I'm getting an
error durring instantiation of the server:
Server.py:
from Crypto.PublicKey import RSA
from ServerNegotiator import ServerNegotiator
from sharedComs import *
f = open("hostid")
tup = stringToTuple
Quin wrote:
s = f.readline()
if 'mystring' in s: print 'foundit'
if 'mystring' not in s: print 'not found'
if 'mystring' in s:
print 'processing'
this generates output:
not found
processing
so, it doesn't find the substring, but goes into processing code anyway.
This is using IronPython
Th
Quin wrote:
Thanks guys, I'm thinking it's a problem with IronPython. I'm
switching to PyScripter and will test tomorrow.
I'm willing to bet money that it is not. If ironPython had a broken if
statement, don't you think we would have known, already ?
There's a rule when test writing/testin
Quin wrote:
Well, now you know!
"Jean-Michel Pichavant" wrote in message
news:mailman.2286.1265797348.28905.python-l...@python.org...
Quin wrote:
Thanks guys, I'm thinking it's a problem with IronPython. I'm
switching to PyScripter and will test tomorrow.
I
Quin wrote:
You know, Jack, that was the point of my original post: to determine
why things weren't working. Do you still want to bet money that it
is? I can screenshot you TD.
Another flaming war starting...
IronPython implements python 2.5 and you're still complaining about your
py3 cod
Vision wrote:
hi all,
I am doing some stuffs with some software, which has similar layout
like this:
Editbox1
Editbox2
Editbox3
_OK_
___
|output|
|output|
|output|
|output|
|output
Jordan Apgar wrote:
I'm trying to right a server that needs specific information for each
client accessing it. The easiest way I could think of doing this is
keeping this information based on ip address (the information is only
valid for a short time). I know there is no was to get the client's
Stephen Hansen wrote:
On Wed, Feb 10, 2010 at 5:36 PM, Jean-Michel Pichavant
mailto:jeanmic...@sequans.com>> wrote:
I don't know exactly what you are trying to do, but if your server
requires informations from the client, it would be better to ask
explicitly the clien
Bob Martin wrote:
in 16 20100212 034121 Paul Rubin wrote:
See http://en.wikipedia.org/wiki/Colossus_computer
That was almost at the end of the war though.
Colossus was working by the end of 1943 - the year that the Americans first
dropped
bombs on Germany ;-)
sept 1939 -
PeroMHC wrote:
Hi All, I have a simple problem that I hope somebody can help with. I
have an input file (a fasta file) that I need to edit..
Input file format
name 1
tactcatacatac
name 2
acggtggcat
name 3
gggtaccacgtt
I need to concatenate the sequences.. make th
Martin wrote:
Hi,
I am trying to come up with a more generic scheme to match and replace
a series of regex, which look something like this...
19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft)
5.0, 4.0, 2.0, 4.0, 1.0 ! lai(1:npft)
Ideally match the pattern to the right of the "!" sign (e.g
Martin wrote:
On Feb 15, 2:03 pm, Jean-Michel Pichavant
wrote:
Martin wrote:
Hi,
I am trying to come up with a more generic scheme to match and replace
a series of regex, which look something like this...
19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft)
5.0, 4.0, 2.0
Benedict Verheyen wrote:
Hi,
i wanted to ask how you guys structure your code.
I mainly have scripts that automate small tasks.
These scripts use a common set of utility code.
My code is structured like this, for example:
script_1.py
script_2.py
script_3.py
tools\
|->__init__.py
|->logu
Paulo Repreza wrote:
Greetings,
I'm having problems with a little script that I'm trying to finish, I
don't know if I'm in the right track but I know somebody is going to
help me.
The script:
# Import modules random for function randint
import random
# Generating a constant.
var = 65
#
mierdatutis mi wrote:
Hi,
I have this:
pe="http://www.rtve.es/mediateca/videos/20100211/saber-comer---patatas-castellanas-costillas-11-02-10/691046.shtml";
I would like to extract this: 691046.shtml
But is dynamically. Not always have the same lenght the string.
Could you help me how could
Arnaud Delobelle wrote:
Leo Breebaart writes:
Chris Rebert writes:
On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote:
I have a base class Foo with a number of derived classes FooA,
FooB, FooC, etc. Each of these derived classes needs to read
(upon initialisation) text
Benedict Verheyen wrote:
sstein...@gmail.com wrote:
On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote:
python_scripts
|
|-->trunk
..|-> my big script 1
|-> setup.py
..|-> my big script 2
|-> setup.py
..|-> database
R (Chandra) Chandrasekhar wrote:
Dear Folks,
I am currently developing a python program, let us call it
"generic.py", and I am testing out the functions therein by testing
them out interactively in the python interpreter by invoking python
and doing
import generic
Once I hit an error, I ne
mk wrote:
Stephen Hansen wrote:
You don't have to (and can't) refer to the class within the body.
Class statements are sort of... odd. They are code which is directly
executed, and the results are then passed into a
metaclass/type/whatever and a class object is created. While within
the clas
Sreejith K wrote:
On Feb 18, 1:57 pm, Steven D'Aprano
wrote:
On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote:
On Feb 17, 10:48 pm, Sreejith K wrote:
Hi everyone,
I need to implement custom import hooks for an application
(http://www.python.org/dev/peps/pep
Sreejith K wrote:
On Feb 18, 3:49 pm, Jean-Michel Pichavant
wrote:
Sreejith K wrote:
On Feb 18, 1:57 pm, Steven D'Aprano
wrote:
On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote:
On Feb 17, 10:48 pm, Sreejith K wrote:
Hi eve
Andrey Fedorov wrote:
It may be intuitive to you, but its not true, written down
anywhere, nor assumed by the language, and the mathematical
meaning of the operators doesn't matter to Python. Python
purposefully does not enforce anything for these methods.
Right, so neither is
SiWi wrote:
On Feb 19, 5:10 pm, "D'Arcy J.M. Cain" wrote:
On Fri, 19 Feb 2010 07:52:59 -0800 (PST)
SiWi wrote:
So I wondered if it was possible to send the Python code I'm
developing on the netbook to the workstation pc via wlan, let the
script execute on the workstation pc and write
Steven D'Aprano wrote:
I have a convention when writing unit tests to put the target of the test
into a class attribute, as follows:
class MyTest(unittest.TestCase):
target = mymodule.someclass
def test_spam(self):
"""Test that someclass has a spam attribute."""
self.fa
Arnaud Delobelle wrote:
lallous writes:
Hello
How can I do something similar to pure virtual functions in C++ ?
Let us consider this:
class C1:
# Pure virtual
def cb(self, param1, param2):
"""
This is a callback
@param param1: ...
@param param2:
Michael Rudolf wrote:
Just a quick question about what would be the most pythonic approach
in this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
>>> def a():
pass
>>> def a(x):
pass
>>> a()
Traceback (most recent call last):
File "", line 1, in
Michael Rudolf wrote:
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
>>> def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and it has its advantages: 1 docstri
Jean-Michel Pichavant wrote:
Michael Rudolf wrote:
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
>>> def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and i
lallous wrote:
I still prefer not to call at all, even if it was an empty function.
Regards,
Elias
Is there any way we could convince you that there is no point caring
about this ? Even if you were trying to optimize speed, it would still
require proof that an empty function is part of th
lallous wrote:
Thank you all for the replies.
The solution using Python 3's syntax look very intuitive.
Thanks Tim, Arnaud for the idea (I am using 2.x)
--
Elias
On Feb 25, 1:28 pm, lallous wrote:
Hello
I am still learning Python, and have a question, perhaps I can shorten
the code:
L =
Joan Miller wrote:
When a package is imported, it gets the dosctring to store it in
*__doc__*.
Does that funcion is built in python? because I would want use it to
get the docstring without import a package
Epydoc, a documentation builder is able to do so with the --parse-only
option. You co
Andreas Waldenburger wrote:
On Thu, 25 Feb 2010 12:51:00 -0800 (PST) John Roth
wrote:
On Feb 24, 1:23 pm, Andreas Waldenburger
wrote:
a company that works with my company writes a lot of of their code
in Python (lucky jerks). I've seen their code and it basically
looks like this:
""
1401 - 1500 of 1973 matches
Mail list logo