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 possib
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 fat
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
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 PROTECTED]'.split('@
[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.
> 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
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 st
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
Michael Ekstrand wrote:
> On Friday 21 October 2005 07:07, bruno modulix wrote:
>
>>>>Python is more like Java.
>>
>>
>>Err... Python is more like what Java would have been if Java was a
>>smart dynamic hi-level object oriented language !-)
>>
&g
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 bi
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 yo
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 opinio
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
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, was
Chris Lasher wrote:
> Hello,
> Is there a Python-sensitive, Linux compatible IDE out there with
> standard bells and whistles (source browser, symbolic debugger, etc.)
> but with the action-per-keystroke editing capabilities of Vim? I have
> failed to turn up such an IDE in my Googling and IDE pr
[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 PRO
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
hav
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 des
Laszlo Zsolt Nagy wrote:
> I have a program with this code fragment:
>
>print len(data)
>print data[:50]
>raise SystemExit
>
> This prints:
>
> 20381
>
> But if I change 50 to 51
>
>print len(data)
>print data[:51]
>raise SystemExit
>
> then it prints
>
> 20381
> !DO
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, t
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 tes
[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 __init__(self,i
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 '@'.j
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.
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
[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
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 :)
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
conventi
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 P
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
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 belo
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."""
>
[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 ha
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: geta
[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* simp
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 d
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
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.
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
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
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 "prin
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
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
>>at
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:
> 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
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 desthuill
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 '[EM
Jaroslaw Zabiello wrote:
> Dnia Mon, 12 Sep 2005 16:51:48 +0200, Jaroslaw Zabiello napisał(a):
>
>
>>Another ZPT file try to fill one slot:
>>
>>
>> Search|Read|Compare|History
>>
>>
>>When I try to open it, I get the error mentioned above. Any idea?
>
>
> Solution was trivial
>
>
Duh ! I s
[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('@')
Frank Millman wrote:
> Peter Hansen wrote:
>
>>Frank Millman wrote:
>>
(snip)
>>>The only truly secure solution I can think of would involve a radical
>>>reorganisation of my program
>>
>>Please define what "truly secure" means to you.
>>
>
>
> Fair question. I am not expecting 'truly' to mean 1
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.
>
>
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 mailin
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...
>
>
> class User:
>
> def View(self):
> # play with data here
>
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:
> 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 i
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('@')])"
--
http://mail.python.org/mailma
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 '@'.join
DENG wrote:
(snip same post as two days ago)
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...
BTW, for what you want to do (which is mostly a waste of time IMHO, but
what, that's your time, not mine), the
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 sa
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)
>>
>>
&
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
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.
>
I have spent 1 week on learn
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 v
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 language
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 lo
[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
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)
>MYINS
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 t
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 anoth
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(
Terry Hancock wrote:
> On Tuesday 23 August 2005 05:35 am, bruno modulix wrote:
>
(snip)
>>
>>If you hope to be taken seriously, please abandon the sms-talk style here.
>>
>
>
> I think it's reasonably clear that neither poster hoped "to be taken
>
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?
http://
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
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
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 o
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
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
>
keyboar
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 v
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,
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..
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
[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 PROTECTED]'.sp
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',
> 'C:\\Pytho
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 tr
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.
Pleas
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
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 PROTECT
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 s
Ray wrote:
> Roy Smith wrote:
>
>>Quick answer; there are none, all attributes are public.
>>
(snip)
>
> Well yeah... if you really want it, in Java you can do that too via
> reflection. Just that I'm not used to it yet so I feel a bit jittery
> with so much power on my hands!
Then wait until yo
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
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,
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
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 =>
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
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__
>>> i.__class__.__name__
'int'
>>> dir(i)
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
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
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 => implementati
Roy Smith wrote:
> Andy Leszczynski 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
>
>
> Well, that's not entirely t
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
1 - 100 of 218 matches
Mail list logo