On Feb 8, 2:49 am, Jean-Michel Pichavant jeanmic...@sequans.com
wrote:
danielx wrote:
Is there aconventionfor 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
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) {
...
}
Is there an
On Oct 10, 12:28 pm, Paul Hankin [EMAIL PROTECTED] wrote:
On Oct 10, 7:41 pm, wink [EMAIL PROTECTED] wrote:
I would like to know what would be considered the most
Pythonic way of handling errors when dealing with files,
solutions that seem reasonable using 2.5:
The best way to handle
I would really like to highlight something Tal has already said: Python
strings are immutable. That means if you construct a string object, you
don't have to worry about someone else going in and changing that
object. What might happen, however, is that someone might reassign a
variable you have
Mark E. Fenner wrote:
Paul McGuire wrote:
Mark E. Fenner [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello all,
snip
Here's my class of the objects being copied:
class Rule(list):
def __init__(self, lhs=None, rhs=None, nClasses=0, nCases=0):
Steven D'Aprano wrote:
On Wed, 16 Aug 2006 13:39:10 -0700, danielx wrote:
Steven D'Aprano wrote:
On Tue, 15 Aug 2006 09:00:16 -0700, Ben Sizer wrote:
Yes, in much the same way that there is no point ever locking your
doors or installing burglar alarms, as a determined thief
Paul Boddie wrote:
danielx wrote:
But we have only considered the economics of such a decision. Even if
there is no market value to a work, a person has an understandable
desire to exercise the rights of ownership over a work, given the
amount of personal investment one makes
Mark E. Fenner wrote:
Mark E. Fenner wrote:
John Machin wrote:
Mark E. Fenner wrote:
Here's my class of the objects being copied:
Here's a couple of things that might help speed up your __init__
method, and hence your copy method:
class Rule(list):
def
Steven D'Aprano wrote:
On Tue, 15 Aug 2006 09:00:16 -0700, Ben Sizer wrote:
Yes, in much the same way that there is no point ever locking your
doors or installing burglar alarms, as a determined thief will
eventually steal your belongings.
That's an utterly pointless and foolish analogy.
KraftDiner wrote:
I have a class that is defined in a file called MyClass.py
How do I use that class in another python script..
import MyClass ? (Does it need to be in a specific location?)
MyClass.py has to be on your python path. Your python path is a list
of directories python will
Fuzzyman wrote:
Bayazee wrote:
hi
can we hide a python code ?
if i want to write a commercial software can i hide my source code from
users access ?
we can conver it to pyc but this file can decompiled ... so ...!!
do you have any idea about this ...?
Jackson wrote:
Thanks for the reply.
danielx wrote the following on 2006-08-13 19:49:
Is your declaration of ABC supposed to have some_super as one of the
base classes? Your constructor has some_super as a parameter. What is
this supposed to mean in light of the declaration for ABC
Jackson wrote:
Maric Michaud wrote the following on 2006-08-14 01:26:
In [28]: class Animal(object) :
: _types = {}
:
:
In [29]: class Worker(object) :
: def work(self) : print 'hard'
:
:
[snip]
What you are trying to
Is your declaration of ABC supposed to have some_super as one of the
base classes? Your constructor has some_super as a parameter. What is
this supposed to mean in light of the declaration for ABC?
If you are trying to customize the base class of ABC by passing an
argument to the constructor of
len wrote:
Hi all
I have a file that I receive from another party which is basicly a csv
file containing the following type of information;
Python has a csv module. I'm not sure if you're already using that or
if it would be useful to you:
http://docs.python.org/lib/module-csv.html
Is there an equivalent in windows?
Jon wrote:
Perhaps using os you could work with lsof
[http://www.linuxcommand.org/man_pages/lsof8.html]
Jon
Thomas Bartkus wrote:
This may be more of a Linux question, but I'm doing this from Python. .
How can I know if anything (I don't care who
I'm surprised no one has mentioned neat-er, more pythonic ways of doing
this. I'm also surprised no one mentioned regular expressions. Regular
expressions are really powerful for searching and manipulating text.
Here is where I learned most of the stuff I know about regular
expressions:
Gerhard Fiedler wrote:
On 2006-08-05 09:30:59, Antoon Pardon wrote:
But this means that C variables are not analog to Python variables,
[...]
Yes they are.
Nobody so far has been able to create a simple table with analog operations
Python vs C that operates on C /variables/ (not
No offense. I didn't mean there was anything wrong with your way, just
that it wasn't neat. By that, I meant, you were still using lots of
for loops and if blocks.
Justin Azoff wrote:
danielx wrote:
I'm surprised no one has mentioned neat-er, more pythonic ways of doing
this. I'm also
Gerhard Fiedler wrote:
On 2006-07-30 09:54:14, Antoon Pardon wrote:
Aren't you looking too much at implementation details now?
Possibly, but at this point I'm still trying to understand how Python does
these things, and what the useful abstraction level is for me. I also still
have very
OriginalBrownster wrote:
I am using a class called UploadedFile.
I want to create a for loop to itterate through the objects within file
name
class UploadedFile(SQLObject):
filename = StringCol(alternateID=True)
abspath = StringCol()
uniqueid = IntCol()
I'll show you a
[EMAIL PROTECTED] wrote:
Here is my script:
from mechanize import *
from BeautifulSoup import *
import StringIO
b = Browser()
f = b.open(http://www.translate.ru/text.asp?lang=ru;)
b.select_form(nr=0)
b[source] = hello python
html = b.submit().get_data()
soup = BeautifulSoup(html)
print
Bruno Desthuilliers wrote:
Gerhard Fiedler wrote:
On 2006-07-25 04:06:24, Steve Holden wrote:
Dennis Lee Bieber wrote:
On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler [EMAIL PROTECTED]
declaimed the following in comp.lang.python:
It is surprising in the sense that binding
Gerhard Fiedler wrote:
On 2006-07-23 14:53:33, danielx wrote:
I can't figure out why Josiah's breakLine function won't work either. I
know Josiah has had his problem resolved, but I'd still like to know
why his func won't work. I'd like to redirect this discussion in that
direction, if I
W. D. Allen wrote:
I want to write a retirement financial estimating program. Python was
suggested as the easiest language to use on Linux. I have some experience
programming in Basic but not in Python.
I have two questions:
1. What do I need to be able to make user GUIs for the program,
Bruno Desthuilliers wrote:
Josiah Manson a écrit :
I found that I was repeating the same couple of lines over and over in
a function and decided to split those lines into a nested function
after copying one too many minor changes all over. The only problem is
that my little helper
Boris Borcic wrote:
does
x.sort(cmp = lambda x,y : cmp(random.random(),0.5))
pick a random shuffle of x with uniform distribution ?
Intuitively, assuming list.sort() does a minimal number of comparisons to
achieve the sort, I'd say the answer is yes. But I don't feel quite
confortable
David G. Wonnacott wrote:
From: danielx [EMAIL PROTECTED]
Date: 22 Jul 2006 01:43:30 -0700
Boris Borcic wrote:
does
x.sort(cmp = lambda x,y : cmp(random.random(),0.5))
pick a random shuffle of x with uniform distribution ?
...
Let e be the element which
Bruno Desthuilliers wrote:
danielx wrote:
Bruno Desthuilliers wrote:
danielx wrote:
(snip)
Obviously, such things would be omitted from your docs, but users also
learn by interacting with Python, which is really one of Python's great
virtues. When supporting documents aren't
Gerhard Fiedler wrote:
On 2006-07-20 18:10:21, danielx wrote:
When supporting documents aren't sufficient to learn an api (I'm sure
this never happens, so just humor me), you can always turn to
interactive Python.
...and source code...
*shudders* What happened to all the goodness
fuzzylollipop wrote:
danielx wrote:
Bruno Desthuilliers wrote:
danielx wrote:
At first I was going to post the following:
!-- beginning of my original post --
(snip)
!-- end of my original post, with ending censored --
but then I tried this:
res
Bruno Desthuilliers wrote:
danielx a écrit :
Bruno Desthuilliers wrote:
danielx wrote:
Bruno Desthuilliers wrote:
danielx wrote:
(snip)
Obviously, such things would be omitted from your docs, but users also
learn by interacting with Python, which is really one of Python's
Bruno Desthuilliers wrote:
Antoon Pardon wrote:
On 2006-07-21, fuzzylollipop [EMAIL PROTECTED] wrote:
danielx wrote:
(snip)
if you prefix with a single underscore, that tells the user, DON'T MESS
WITH ME FROM OUTSIDE! I AM AN IMPLEMENTATION DETAIL!
Personnaly I don't like
Bruno Desthuilliers wrote:
danielx wrote:
(snip)
Python's lambda really can't be as powerful as Lisp's because Python
does not have expressions that do case analysis (this is not lambda's
fault, of course ;). The reason is that you really want to put each
case on its own set of lines
Bruno Desthuilliers wrote:
danielx wrote:
Bruno Desthuilliers wrote:
danielx wrote:
(snip)
which gets me thinking again about
the stuff I self-censored. Since the dot syntax does something special
and unexpected in my case,
unexpected ? Did you ever wondered how the instance
[EMAIL PROTECTED] wrote:
Hey there,
i have been learning python for the past few months, but i can seem to
get what exactly a lamda is for. What would i use a lamda for that i
could not or would not use a def for ? Is there a notable difference ?
I only ask because i see it in code samples on
Bruno Desthuilliers wrote:
danielx wrote:
At first I was going to post the following:
!-- beginning of my original post --
(snip)
!-- end of my original post, with ending censored --
but then I tried this:
res = Foo.__dict__['func']
res is dan
True
And it all
Leif K-Brooks wrote:
danielx wrote:
This is still a little bit of magic, which gets me thinking again about
the stuff I self-censored. Since the dot syntax does something special
and unexpected in my case, why not use some more dot-magic to implement
privates? Privates don't have
Duncan Booth wrote:
danielx wrote:
Foo.func = dan# -- Appearantly, something magical happens here,
because...
Foo.func
unbound method Foo.dan
f = Foo.func
f is dan # -- things begins to look suprising here.
False
ismethod(f)
True
Imagine my surprise. Why
Bruno Desthuilliers wrote:
ZeD wrote:
Bruno Desthuilliers wrote:
I decided to change the name of an attribute. Problem is I've used the
attribute in several places spanning thousands of lines of code. If I
had encapsulated the attribute via an accessor, I wouldn't need to do
an
At first I was going to post the following:
!-- beginning of my original post --
I just discovered the inspect module, which contains the isfunction and
ismethod functions. For some reason, I used to be under the impression
that Python methods are no different from Python functions. Naturally,
I
41 matches
Mail list logo