Ask wrote:
G'day All,
(snip)
Welcome here...
I must admit to much confusion regarding some of the basics, but I'm sure
time, reading, and good advice will get rid of that. at this stage, it's
just working through some examples and getting my head around things. As an
example, if I
Scott David Daniels wrote:
bruno modulix wrote:
Scott David Daniels wrote:
bruno modulix wrote:
... Another language that failed to make it to the mainstream but is
worth giving a try is Smalltalk - the father of OOPLs (Simula being the
GrandFather).
I would say Simula
beza1e1 wrote:
let me try.
1) ''.join(lots_of_pieces)
2) This doesn't even work, if something is removed, the list is too
short. So:
[x for x in somelist if not isbad(x)]
well, list comprehension is Python 2.4
2.2.x IIRC
and 2.3 is the standard in many
OSes, so it is possibly not
Michael Ekstrand wrote:
On Friday 21 October 2005 07:07, bruno modulix wrote:
Python is more like Java.
troll
Err... Python is more like what Java would have been if Java was a
smart dynamic hi-level object oriented language !-)
/troll
+1. Python is easily applicable to most
Scott David Daniels wrote:
bruno modulix wrote:
... Another language that failed to make it to the mainstream but is
worth giving a try is Smalltalk - the father of OOPLs (Simula being the
GrandFather).
I would say Simula is the forefather of modern OOPLs, and Smalltalk is
the toofather
Alex Martelli wrote:
(snip)
Here's a tiny script showing some similarities and differences:
def f()
i = 0
while i 100
j = 923567 + i
i += 1
end
end
f()
comment out the 'end' statements, and at colons
s/at/add/
at the end of the def
and while statements, and
[EMAIL PROTECTED] wrote:
I don't know if this is the appropriate place to post a Zope question
Nope. You'd better use the zope mailing-list for this.
OT
but I figure many here are familiar with it. I'm confused about the
role of the ZMI when it comes to development.
As it's name implies, the
PyPK wrote:
hmm Thats one thing. Also I was thinking of something like benefites of
python over other languages.
That's fairly context-dependant *and* subjective.
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL
Tom Anderson wrote:
On Thu, 20 Oct 2005, Diez B. Roggisch wrote:
So - _I_ think the better user-experience comes froma well-working
easy to use REPL to quickly give the scripts a try.
I'd agree with that. Which is better, a difficult language with lots of
fancy tools to help you write
Amol Vaidya wrote:
Casey Hawthorne [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
What languages do you know already?
What computer science concepts do you know?
What computer programming concepts do you know?
Have you heard of Scheme?
Ruby is a bit Perl like -- so if you
Bryan wrote:
Amol Vaidya wrote:
Hi. I am interested in learning a new programming language, and have
been debating whether to learn Ruby or Python.
(snip)
why don't you do what i did? download ruby and spend a day or two
reading programming ruby from www.ruby-lang.org/en. the download
Amol Vaidya wrote:
Hi. I am interested in learning a new programming language, and have been
debating whether to learn Ruby or Python. How do these compare and contrast
with one another, and what advantages does one language provide over the
other? I would like to consider as many opinions
Robin Becker wrote:
Bruno Desthuilliers wrote:
Robin Becker a écrit :
Is there a way to override a data property in the instance? Do I need
to create another class with the property changed?
Do you mean attributes or properties ?
I mean property here.
Ok, wasn't sure... And sorry,
James Gan wrote:
I want the object printed in a readable format. For example,
x =[a, b, c, [d e]] will be printed as:
x--a
|_b
|_c
|___d
|_e
I tried pickled, marshel. They do different work.
Is there another
module which do this kind of job?
pprint
--
bruno desthuilliers
Johnny Lee wrote:
Class A:
s/C/c/
def __init__(self):
self.member = 1
def getMember(self):
return self.member
a = A()
So, is there any difference between a.member and a.getMember?
yes : a.member is an integer, a.getMember is a bound method. You could
have found
[EMAIL PROTECTED] wrote:
If you change it to this it works. You should provide a get and a set
function for a property.
The OP did:
- command=property(getCommand, setNothing)
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL
Alex Stapleton wrote:
On 9 Oct 2005, at 19:04, Bruno Desthuilliers wrote:
Laszlo Zsolt Nagy a écrit :
(snip)
Do you want to know how many internal string operations are done inside
the Python interpreter? I believe it is not a useful information. There
are benchmarks testing the *real
Donn Cave wrote:
Quoth Fredrik Lundh [EMAIL PROTECTED]:
| Alex Stapleton wrote
|
| Except it is interpreted.
|
| except that it isn't. Python source code is compiled to byte code, which
| is then executed by a virtual machine. if the byte code for a module is up
| to date, the Python
Laszlo Zsolt Nagy wrote:
I have a program with this code fragment:
print len(data)
print data[:50]
raise SystemExit
This prints:
20381
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN
But if I change 50 to 51
print len(data)
print data[:51]
raise SystemExit
[EMAIL PROTECTED] wrote:
Sorry Fredrik but I don't understand. Just comment out the assert and
you have different results depending on whether an unrelated sort
function is defined.
This seems weird to me !
code snippet:
from random import choice
class OBJ:
def
CppNewB wrote:
I am absolutely loving my experience with Python. Even vs. Ruby, the syntax
feels very clean with an emphasis on simplification.
My only complaint is that there doesn't appear to be a great commercial IDE
Why commercial ?
--
bruno desthuilliers
python -c print
Mike Meyer wrote:
(snip)
Antoon, at a guess I'd say that Python is the first time you've
encountered a dynamnic language. Being horrified at not having
variable declarations,
Mike, being horrified by the (perceived as...) lack of variable
declaration was the OP's reaction, not Antoon's.
--
James A. Donald wrote:
I am contemplating getting into Python, which is used by engineers I
admire - google and Bram Cohen, but was horrified
horrified ???
Ok, so I'll give you more reasons to be 'horrified':
- no private/protected/public access restriction - it's just a matter of
conventions
James A. Donald wrote:
James A. Donald:
Surely that means that if I misspell a variable name, my program will
mysteriously fail to work with no error message.
On Sun, 02 Oct 2005 17:11:13 -0400, Jean-François Doyon
No, the error message will be pretty clear actually :)
Now why,
[EMAIL PROTECTED] wrote:
The easiest way to avoid this problem (besides watching for NameError
exceptions) is to use an editor that has automatic name completion.
Eric3 is a good example. So, even though in theory it could be an
issue, I rarely run into this in practice.
I don't use emacs
Paul Rubin wrote:
Steven D'Aprano [EMAIL PROTECTED] writes:
No, but that is precisely why Python's semi-private variables are
usually better. Names like _X and class.__X are warnings to the developer
use these at your own risk, without preventing developers who need them
from using them. You
Markus Wankus wrote:
Hi All,
Does anyone know of any good Zope3 examples?
Ask the Zope mailing-list. Zope is a world by itself, and is usually not
discussed here.
BTW, Zope3 is a really really new thing, so you won't find much existing
apps. When it's said that it offers 'the best from
Lasse Vågsæther Karlsen wrote:
I am slowly learning Python and I'm already starting to write some minor
modules for myself. Undoubtedly there are better modules available
either built-in or 3rd party that do the same as mine and much more but
I need to learn it one way or another anyway.
Peter Otten wrote:
Bruno Desthuilliers wrote:
2/ functional solution:
---
def make_funcs():
x = 0
def _abc():
x = 1
return x + 1
def _abcd():
return x + 1
return _abc, _abcd
abc, abcd = make_funcs()
print abc()
print abcd()
The
Jeremy Sanders wrote:
Is it possible to implement some sort of lazy creation of objects only
when the object is used, but behaving in the same way as the object?
Smells like a Proxy pattern...
For instance:
class Foo:
def __init__(self, val):
This is really slow.
self.num =
Jeremy Sanders wrote:
Diez B. Roggisch wrote:
It works - in python 2.4!! I tried subclassing dict, but my
__getitem__-method wasn't called - most probably because it's a C-type,
but I don't know for sure. Maybe someone can elaborate on that?
Yes - I tried that (see thread below).
[EMAIL PROTECTED] wrote:
I am very much a beginner to python. I have been working on writing a
very simple program and cannot get it and was hoping someone could help
me out. Basically i need to write a code to print a sin curve running
down the page from top to bottom. The trick is I have
Tor Erik Sønvisen wrote:
Hi
In php I can assign a value to a variable and use this varaible to access a
property in some object:
$var = 'property';
$object-{$var}
This will transelate to $object-property...
Is this possible in Python?
Not directly, but there's a way: getattr(obj,
beza1e1 wrote:
This nails it down, yes. :)
I probably was too deep into OOP thinking-mode to work pythonic. So i
am now rediscovering the python way.
Have you read Paul Grahams On Lisp (or was it one of his essays)? He is
strongly in favor of functional programming.
Yes, but this does
[EMAIL PROTECTED] wrote:
Dear all,
Can anyone point me to a resource that describes the best way of
organising a python project? My project (gausssum.sf.net) is based
around a class, and has a GUI that allows 'easy-access' to the methods
of the class.
Err... Unless it's a *very* simple
Reem Mohammed wrote:
Hi
Suppose we have data file like this one (Consider all lines as strings )
1 2 3 3 4 4 4 4 5 6
2 2 2 5 5 5 6
3 2 1 1 1 3 3 3 4 6
I would like to remove line if its belong to another one, and will be
able to do this if longer line come after a short one.
That's
chuck wrote:
The browser windows do. Why not the editor windows?
I hate to complain but is there any way to get IDLE to run in more of
an MDI mode? Having the floating windows everywhere is rather
confusing to me.
IDLE is open source, so you may want to consider contributing to it !-)
Sakcee wrote:
Hi
I am using mod_python for web development, I am in need of some ide ,
can i use ddd or eclipse with pydev with mod_python.
Don't know, but you may want to check Eric3, a full blown Python IDE
with support for mod_python debugging.
--
bruno desthuilliers
python -c print
Dirk Hagemann wrote:
Hi!
I have a list of lists and in some of these lists are elements which I
want to change.
Here an example:
lists=[('abc', 4102, 3572), ('def', 2707, 'None'), ('ghi', 'None', 4102)]
'None' should be replaced by 0 or NULL or something else.
Your list is a list
Dirk Hagemann wrote:
THANKS! That works :-)
Of course it works. Why wouldn'it it work ?-)
But meanwhile I found another solution that works in my case. Out of
this list of tuples I generated a SQL-Statement which is a simple
string. Then I simply checked this string for 'None'. May be too
Johnny Lee wrote:
Hi,
Look at the follow command in python command line, See what's
interesting?:)
class A:
i = 0
a = A()
b = A()
a.i = 1
print a.i, b.i
1 0
Quite what I would expect. First you declare i as being a *class*
attribute of A, with value 0. Then you create 2
Dave Hansen wrote:
(snip code snippets and sensible explanations)
Again, iterating over an item that is mutating seems like a Bad
Idea(tm) to me.
It as *always* been a bad idea to modify a list in place (I mean adding
or removing items) while iterating over it, whatever the language. If
you
Johnny Lee wrote:
bruno modulix wrote:
I dont see anything interesting nor problematic here. If you understand
the difference between class attributes and instance attributes, the
difference between mutating an object and rebinding a name, and the
attribute lookup rules in Python, you'll find
Adriaan Renting wrote:
In my mind all Python variables are some kind of named pointers,
Technically, they are key/value pairs in a dictionnary, the key being
the name and the value a reference to an object.
I
find that thinking this way helps me a lot in understanding what I'm
doing. I know
[EMAIL PROTECTED] wrote:
I like to keep my classes each in a separate file with the same name of
the class.
Let me guess: you have a C++ or Java background ?-)
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
Jaroslaw Zabiello wrote:
Dnia Mon, 12 Sep 2005 16:51:48 +0200, Jaroslaw Zabiello napisał(a):
Another ZPT file try to fill one slot:
div metal:use-macro=context/base
div metal:fill-slot=goraSearch|Read|Compare|History/div
/div
When I try to open it, I get the error mentioned above. Any
Jaroslaw Zabiello wrote:
I would like to lauch macro from another zpt file.
(snip - tech answer in private)
Please stop posting Zope and ZPT related questions here. There are
mailing-lists dedicated to Zope. That's where you'll get the good answers.
--
bruno desthuilliers
ruby -e print
Rob Conner wrote:
Genius!
Nope. Just common Python idioms...
Thanks guys that was exactly the help I was looking for. I'll be
implementing this later today. I don't forsee any problems, so if I
don't post anything else, thank you so much for the help.
You're welcome.
--
bruno
Rob Conner wrote:
No you don't need to know Zope to help me. The whole reason I'd even
want to do this is because of Zope though. I made a Zope product, and
now want to perfect it.
some simple example code...
code
class User:
def View(self):
# play with data here
Jaroslaw Zabiello wrote:
I got strange errors in Zope 2.7.
2.7.?
METALError
macro 'context/base' has incompatible version None, at line 1, column 1
(snip)
When I try to open it, I get the error mentioned above. Any idea?
yes : try posting on a Zope/Plone related mailing-list.
Frank Millman wrote:
Hi all
I am writing a multi-user accounting/business system. Data is stored in
a database (PostgreSQL on Linux, SQL Server on Windows). I have written
a Python program to run on the client, which uses wxPython as a gui,
and connects to the database via TCP/IP.
The
FAN wrote:
I want to define some function in python script dynamicly and call
them later, but I get some problem. I have tried the following:
##
# code
##
class test:
def __init__(self):
exec(def
D H wrote:
(snip)
Go with Rails. Django is only like a month old.
Please take time to read the project's page. Django has in fact three
years of existence and is already used on production websites, so it's
far from pre-alpha/planning stage.
--
bruno desthuilliers
python -c print
Paul McGuire wrote:
(snip)
(This is a quick-and-dirty example, but it works. A proper iterator
s/iterator/decorator/
(snip)
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
--
D H wrote:
bruno modulix wrote:
D H wrote:
(snip)
Go with Rails. Django is only like a month old.
Please take time to read the project's page. Django has in fact three
years of existence and is already used on production websites, so it's
far from pre-alpha/planning stage
Terry Reedy wrote:
Brock Filer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
countries['us']['Colorado']['Denver']['@population']
This is going to be used in user-input formulae, so I'm willing to do a
lot of work for minor beautifications. I'd like to be able to say (I
know, the
DENG wrote:
(snip same post as two days ago)
ot
In case you don't know, google.groups is just a web interface (and
archive) to usenet groups. No need to repost the same question twice...
/ot
BTW, for what you want to do (which is mostly a waste of time IMHO, but
what, that's your time, not
wen wrote:
due to the work reason, i have to learn python since last month. i have
spent 1 week on learning python tutorial and felt good. but i still don't
understand most part of sourcecode of PYMOL(http://pymol.sourceforge.net/)
as before.
it sucks.
joking
I have spent 1 week on
DENG wrote:
I know very well Tidy, sir
Tidy do a nice job but it is writen in Java,
Seems like we're not talking about the same program here. Tidy (aka
HTMLTidy) is written in C. You must be talking about it's Java port JTidy.
and have Python ported
my aim is to learn Python, learn how
Mike Meyer wrote:
bruno modulix [EMAIL PROTECTED] writes:
Devan L wrote:
Kevin Little wrote:
I want to dynamically add or replace bound methods in a class.
(snip)
I'm not an expert, but why do you need to dynamically add or replace
bound methods?
To modify the behaviour at runtime
Devan L wrote:
Kevin Little wrote:
I want to dynamically add or replace bound methods in a class.
(snip)
I'm not an expert, but why do you need to dynamically add or replace
bound methods?
To modify the behaviour at runtime ?-)
There are a lot of idioms/patterns in dynamic languages
matt wrote:
(snip)
I'd like to hear other's experiences with refactoring in python. Most
of the projects I work on are quite small relative to some of the Java
projects I've worked on.
Python being much less verbose and much more dynamic than Java, the
LOCs/functionnalities ratio can be
cfgauss wrote:
I am having a strange problem with classes. I'm fairly sure the
problem is with classes, anyway, because when I re-write the program
without them, it works like I'd expect it to.
When I run this program, at first, L[0].z[1] is 0, because z=[0,0].
But after I run that loop to
Nx wrote:
Thanks for the many replies
here is an example for what it will be used for , in this case
fixed at 31 fieldvalues:
inputvalues=(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,
s26,s27,s28,s29,s30,s31)
[EMAIL PROTECTED] wrote:
Hey, if the man wants to write it that way, let the man write it that
way. If it works for him, great... he's sure confused the heck out of
all of us, and that translates into job security for him! As you can
see, the name of the post is 'variable hell' and that is
Terry Hancock wrote:
On Tuesday 23 August 2005 05:35 am, bruno modulix wrote:
(snip)
ot
If you hope to be taken seriously, please abandon the sms-talk style here.
/ot
I think it's reasonably clear that neither poster hoped to be taken
seriously. :-D
Err... I guess that to be taken
Johnny Lee wrote:
Here is the source:
(snip)
class TestCaseTest(TestCase):
def testRunning(self):
print testRunning in TestCaseTest
test = WasRun(testMethod)
assert(not test.wasRun)
test.run()
assert(test.wasRun)
Mohammed Altaj wrote:
Thanks a lot for your valuable answer, i like the way you code ,
Thanks.
but i
would like to use my own, so if it is possible for you and if you have
time, please could you fix my code, so that i can do what i want.
Because i am using the this out put to another
Laszlo Zsolt Nagy wrote:
Try this:
gclas = raw_input(What is the class:)
def Princlas():
count = 0
while count != 1000:
count = count + 1
return Admin forceclass %s %s % ( count , gclas )
have you tried your code ? Obviously, no, else you would have seen that
it
Joe T. wrote:
Hello group, I'm new to Python and have a couple of beginner questions that
I'm hoping someone can answer.
1. Is python something that you would recommend using for server side web
programming?
Definitively yes.
Something like C# or Java?
Far better IMHO.
If so, are
Terry Reedy wrote:
Benjamin Niemann [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
(snip)
In that case, you are interested in IO performance. The time spent
handling
the loop is not significant compared to the time spent executing the
'print' statement - which is a very complex
Steve Holden wrote:
(snip)
If you want a fast language, try Holden. I've just invented it.
Unfortunately it gets the answer to every problem wrong unless the
answer is 42, but boy it runs quickly. The code for the whole
interpreter (it's written in Python) follows:
print 42
keyboard !
km wrote:
If you want a fast language, try Holden. I've just invented it.
Unfortunately it gets the answer to every problem wrong unless the
answer is 42, but boy it runs quickly. The code for the whole
interpreter (it's written in Python) follows:
print 42
great ! u can use it for ur
Mohammed Altaj wrote:
Dear All
What i want to do is , my input is like
0 2
0 3
0 4
1 2
1 4
2 3
3 4
I am comparing and put the number in group , like ,the first three lines
, all has zero as first input for each line, so the out put should look
like
0 2 3 4
and so on
1 2 4
2 3
Mohammed Altaj wrote:
Dear all
Sorry , I confused between two things , what i said in the last e-mail i
already managed to do using C code , But what i need to do using python
is : my input data :
0 2 3 4
1 2 4
2 3
3 4
what i suppose to do is , using the first line and start
Mohammed Altaj wrote:
Dear All
This is my problem again ,
(snip)
I managed to do all these things , but i did it in the way that i am
reading my data as strings ( no space between numbers) something like
0124
124
23
34
what i would like to know or to do is , how can i deal with
max(01)* wrote:
hi.
(snip)
it doesn't work, since *do_something* and *do_something_more* are
always executed (it seems like
MYPIPE = os.popen(*some_system_command*, r)
does not raise any exception even if *some_system_command* does not
exist/work...
any help?
Mike C. Fletcher wrote:
(snip)
Though the don't go into extreme detail on decorators (they are
basically syntactic sugar for a particular type of descriptor).
Err... Could you elaborate on this ? Decorators are syntactic sugar for
function wrapping, while descriptors are a 'protocol' to hook
km wrote:
Hi all,
Why is it that the implementation of empty loop so slow in python when
compared to perl ?
#i did this in python (v 1.5)
Python 1.5.2 was released in april 1999. Current Python version is 2.4.1.
Please consider upgrading - unless of course you just want to troll...
[EMAIL PROTECTED] wrote:
anyone know of any college/school that is teaching the python language?
Bordeaux University (France) uses Python in a programming 101 course.
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL
wen wrote:
on my system(win2k server, python 2.3.5),
import sys
print sys.path
['C:\\', 'C:\\WINNT\\system32\\python23.zip',
'C:\\Python23\\lib\\site-packages\\Pythonwin',
'C:\\Python23\\lib\\site-packages\\win32',
'C:\\Python23\\lib\\site-packages\\win32\\lib',
Fredrik Lundh wrote:
Jon Bowlas wrote:
(snip)
But I get the following error- Line 5: Yield statements are not allowed.
umm. I might be missing something, but I cannot find any trace of that
error message in the Python interpreter source code. it doesn't even look
like a Python
Magnus Lycka wrote:
bruno modulix wrote:
Magnus Lycka wrote:
N.Davis wrote:
Functions existing in a module? Surely if everything is an object
(OK thats Java-talk but supposedly Python will eventually follow this
too)
int too? ;)
Yes, int too.
I was talking about everything
Devan L wrote:
Talin wrote:
I want to make a dictionary that acts like a class, in other words,
supports inheritance:
(snip)
Dictionaries aren't classes?
They are.
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL
Talin wrote:
I want to make a dictionary that acts like a class, in other words,
supports inheritance:
I must be missing your point here, since dict is a class and as such
support inheritence:
class MyDict(dict):pass
...
d = MyDict()
d.items()
[]
If you attempt to find a key that isn't
yaffa wrote:
dear folks,
Dear Yaffa,
i'm trying to append a semicolon to my addr string
Python strings don't have a 'append' method.
and am using the
syntax below. for some reason the added on of the ; doesn't work.
doesn't work is the worst possible description of a problem.
Please
Ray wrote:
Hello,
I've been learning Python in my sparetime. I'm a Java/C++ programmer by
trade. So I've been reading about Python OO, and I have a few questions
that I haven't found the answers for :)
1. Where are the access specifiers? (public, protected, private)
object.name = public
Devan L wrote:
Fausto Arinos Barbuto wrote:
Ray wrote:
1. Where are the access specifiers? (public, protected, private)
AFAIK, there is not such a thing in Python.
---Fausto
Well, technically you can use _attribute to mangle it,
__attribute would work better !-)
but technically
Ray wrote:
Fausto Arinos Barbuto wrote:
Ray wrote:
1. Where are the access specifiers? (public, protected, private)
AFAIK, there is not such a thing in Python.
So everything is public? I know that you can prefix a member with
underscores to make something private,
The 2 leadings
Ray wrote:
Hello guys,
OK, I've been reading some more about Python. There are some things
about Python exception that I haven't been able to grasp:
1. This is a small thing, but why is object spelled object, and the
mother of all exception Exception (with capital E)? Why is not object
Neil Benn wrote:
(snip)
Suppose you have a logistics tracking system available on every install
in your company - there are 55 installs throughout the company. You
wish to push through a patch because of a problem. If you have one
class per file you can push that class through onto the
Magnus Lycka wrote:
N.Davis wrote:
Functions existing in a module? Surely if everything is an object
(OK thats Java-talk but supposedly Python will eventually follow this
too)
int too? ;)
Yes, int too.
i = 42
i.__class__
type 'int'
i.__class__.__name__
'int'
dir(i)
['__abs__',
Daniel Schüle wrote:
Hello
I wrote a simple module, which is also supposed to be used as standalone
program
after considering how to avoid multiple if's I came up with this idea
if __name__ == __main__:
if len(sys.argv) not in (3,4):
print usage: prog arg1 argv2 [-x]
#
Neil Benn wrote:
(snip)
If you don't have a class how can you combine functionality with data
and hold state
In Python, functions can hold state in various ways: closures,
generators, and - Python functions being instances of the function class
- attributes.
- that is one of the points of a
Roy Smith wrote:
Andy Leszczynski leszczynscyATnospam.yahoo.com.nospam writes:
(snip)
It's not a true statement. Nothing in the language enforces LSP. In
fact, there's not even a [way?] when a function/method is invoked to make
sure the type passed in is a subtype of the type you expect
Tito wrote:
[1] 'aName' = public, '_aName' = protected, '__aName' = private
I didn't know this one, as I am quite new to Python. Is it really
general use?
Yes, it's the convention.
Well, to be more exact, this is:
name = interface (intended for public use)
_name = implementation (not
Roy Smith wrote:
Robert Wierschke [EMAIL PROTECTED] wrote:
a scripting language or a normal language like C++ etc.
It is difficult to define exactly what a scripting language is and isn't,
You can tell buy the most common use. bash is a scripting language,
javascript is a scripting
Jon Hewer wrote:
I do use Vim a lot. I am currently using it for some PHP development
i'm doing. I'm been using it so much recently that i keep pressing
ESC and typing vi commands out of vi.
But, if i use Vi, then whenever i want to test some code i have to
open up python, import the
anthonyberet wrote:
This is the first time I have tried out functions (is that the main way
of making subroutines in Python?)
A function is allowed to change it's arguments and to return None, so
yes, you can consider it as a 'subroutine'.
Anyway, my function, mutate, below
#make a child
None wrote:
Hello,
I am just starting to look into python.I have been prog with php for
several years.My question is:
Can/Is Python used as a web scripting language
Yes, definitively.
There are in fact almost too many web-programming solutions in Python,
from the good ole cgi to the
1 - 100 of 209 matches
Mail list logo