Eric Deveaud wrote:
(snip)
>
> sort can take a comparaison function.
The problem with it is that it may slow down things a lot...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/ma
bruce wrote:
> Hi
>
> I've never used Python/Plone, and am wondering if I can talk with anyone
> who's used Plone. I'm trying to determine if Plone could be easily used for
> a potential application.
Then you'd better post this to the plone and/or zope mailing lists.
--
bruno desthuilliers
Larry Bates wrote:
> Fredp wrote:
>
>>Hi
>>I was wondering if it is possible to have the various magic methods,
>>mainly __getattr__ and __setattr__, and @property attributes called
>>when accessing the attribute of a non-intantiated class.
>>
>>Imagin something like this:
>>#
>>class MyClass:
Fredp wrote:
(snip)
> I have something like a simple ORM which objects haven't a fixed number
> of fields, and I need to have properties (or methods) for each of them,
dumbiest possible example, but this should het you started
class Field(object):
# dummy
def __init__(self, **kw):
self._
Edward Elliott wrote:
> Bruno Desthuilliers wrote:
>
>>But then, constructs like:
>>
>>class Obj(object):
>> def method(...): ...
>> method = staticmethod(method)
>>
>>or it's newer syntactic-sugar-version would become somewhat more
>>difficult to parse properly - but I admit that this is beyo
Edward Elliott wrote:
> Bryan wrote:
>
>> >>> keepchars = set(string.letters + string.digits + '-.')
>
>
> Now that looks a lot better. Just don't forget the underscore. :)
>
You may also want to have a look at string.translate() and
string.maketrans()
--
bruno desthuilliers
python -c "print
Carl Friedrich Bolz wrote:
> Bruno Desthuilliers wrote:
>
>> Martin P. Hellwig a écrit :
>>
>>> I created a class which creates a relative unique id string, now my
>>> program just works fine and as expected but somehow I get the feeling
>>> that I misused the __repr__ since I guess people expect
Martin P. Hellwig wrote:
> Bruno Desthuilliers wrote:
>
>
>>
>> Why not just use the call operator instead ? ie:
>>
>> >>> id = IDGenerator(...)
>> >>> id()
>> 01_20060424_151903_1
>> >>> id()
>> 01_20060424_151905_2
>>
>
> Because of:
>
> id = IDGenerator("01",99)
> id()
>>
>> Trace
Ben Finney wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>
>>Ben Finney a écrit :
>>
>>>So now you're proposing that this be a special case when a
>>>function is declared by that particular syntax, and it should be
>>>different to when a function is created outside the class
>>>defin
Edward Elliott wrote:
> Ben Finney wrote:
>
>>As I understand it, the point was not what the code does, but to give
>>a sample input (a Python program) for the "simple text processor" you
>>described to wade through.
>
>
> Ah, well then, there's no need for a full-blown parser. It should suffic
Gary Wessle wrote:
> Ryan Forsythe <[EMAIL PROTECTED]> writes:
>
>
>>Gary Wessle wrote:
>>
>>>the example was an in-accuretlly representation of a the problem I am
>>>having. my apologies.
>>>
(snip)
> I finally was able to duplicate the error with a through away code
> as follows,
>
>
Michael Yanowitz wrote:
> I am still new to Python but have used it for the last 2+ months.
> One thing I'm still not used to is that functions parameters can't
> change as expected.
>
> For example in C, I can have
> status = get_network_info (strIpAddress, &strHostname, &nPortNumber)
You hav
BartlebyScrivener wrote:
> I'm picking this up via clp on Google Groups. I can't tell what Mr.
> Lundh is referring to. The first line of his post is: "Tim Williams
> wrote" but there's nothing that comes before. I had seen the article on
> Django on Digg I think, but what is article Tim Williams i
A.M wrote:
> Hi,
>
> Is there any efficient online resource or book that help experienced Perl
> programmers to Python?
>
My fellow coworker - experimented Perl coder - confirms that the
official tutorial and diveintopython should be enough to get you
started. Also, the Python Cookbook and read
Edward Elliott wrote:
> bruno at modulix wrote:
>
>>Edward Elliott wrote:
>>
>>>Ah, well then, there's no need for a full-blown parser. It should
>>>suffice to recognize a class definition and modify the parameter list of
>>>every def i
TG wrote:
> That's great, thanks !
>
> To put it short, when I create a Stimulus object, it first seek
> __new__() method. But if I don't define it, it looks for the one
> defined in Vector. This raises a problem because the parameters passed
> to Stimulus(params) aren't fitting with Vector parame
Paul Rubin wrote:
> bruno at modulix <[EMAIL PROTECTED]> writes:
>
>>What's wrong with:
>>
>>assert foo and bar and i > 10, \
>> "if foo and bar i must not be greater than 10"
>
>
> It doesn't necessarily do anything. With op
Panos Laganakos wrote:
> I want a class method to take action depending on the type of the
> arguement passed to it.
>
> ie:
> getBook(id) # get the book by ID
> getBook(name) # get the book by name
> ...
>
> Other languages use the term function/method overloading to cope with
> this. And when I
Philippe Martin wrote:
> Hi,
>
> This code works, but is it "appropriate" ?
appropriate for what ?-)
> l_init = False
> # corrected typo, cf other post in this thread
> if True == l_init and 1234 == l_value:
> print 'l_value is initialized'
Do this in production code, and have one of the first
Philippe Martin wrote:
(snip)
>
> l_init really is a boolean parameter and l_value a value that _might_ exist
> in a shelve.
>
> So I just want to have a parameter to a method so if the first value tested
> is false (l_init) then the second (l_value) does not get tested ... because
> it is the se
Philippe Martin wrote:
> bruno at modulix wrote:
>
>
>>Philippe Martin wrote:
>>(snip)
>>
>>>l_init really is a boolean parameter and l_value a value that _might_
>>>exist in a shelve.
>>>
>>>So I just want to have a parameter to
bruce wrote:
> Hi...
>
> Never used python, but I have a question regarding Drop Down Menus. Does
> Python allow me to create a website,
Yes.
> that will permit the user to create
> Drop Down menus that can be initiated with the right mouse click?
Not sure to understand what you mean, but this
Mark Harrison wrote:
> Is there a way to do something equivalent to "import * from self"?
(snip)
>
> Is there a way to get rid of those the "self." references,
No.
> or is this
> just something I need to get my brain to accept?
Yes.
And FWIW, "from somemodule import *" is usually considered bad
Mark Harrison wrote:
> Is there a way to automatically print all the instance
> data in a class? This is for debugging, I would like
> to do something like dump(self) to snapshot the state
> of the object.
def dump(obj):
buf = ['%r %s :' % (obj, str(obj)]
for name in dir(obj):
attr = geta
[EMAIL PROTECTED] wrote:
> Hi!
>
> Thank you for a quick and informative response!
>
>
>>I'd go for 'manually decorating' anyway. Metaclasses can be really handy
>>for framework-like stuff, but for the use case you describe, I think the
>>explicit decorator option is much more, well, explicit -
[EMAIL PROTECTED] wrote:
> I played around with my old code before I saw your post, and I believe
> I've found a solution that's a bit neater than what I had before. I
> thought I could just as well post it if you're interested and have the
> time. This one uses multiple inheritance, but it's legal
John Salerno wrote:
> John Salerno wrote:
>
>> [EMAIL PROTECTED] wrote:
>>
>>> Even if you don't end up referring to self or any instance
>>> attributes within the method
>>
>>
>> Hmm, follow-up: I *do* plan to refer to instance attributes inside
>> these methods (self.something), but does that re
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>
>> I'm having trouble deciphering what this bit means - "but these
>> functions will be called from another method in the class, not from the
>> instance itself", I don't think it makes sense.
>
>
> Yeah, I'm starting to see that as I tried to imp
[EMAIL PROTECTED] wrote:
> John Salerno wrote:
>
>>What I originally meant was that they would not be called from an
>>instance *outside* the class itself, i.e. they won't be used when
>>writing another script, they are only used by the class itself.
>
>
> Yep, so you want to encapsulate the fun
John Salerno wrote:
> John Salerno wrote:
>
>> [EMAIL PROTECTED] wrote:
>>
>>> John Salerno wrote:
>>>
What I originally meant was that they would not be called from an
instance *outside* the class itself, i.e. they won't be used when
writing another script, they are only used by th
Davy wrote:
> Hi all,
>
(snip)
> Does Python support robust regular expression like Perl?
Yes.
> And Python and Perl's File content manipulation, which is better?
>From a raw perf and write-only POV, Perl clearly beats Python (regarding
I/O, Perl is faster than C - or it least it was the last
[EMAIL PROTECTED] wrote:
> I have a python code which is running on a huge data set. After
> starting the program the computer becomes unstable and gets very
> diffucult to even open konsole to kill that process. What I am assuming
> is that I am running out of memory.
>
> What should I do to make
Ángel Gutiérrez Rodríguez wrote:
> I would like to have a list of lists N times deep, and my solution is (in
> pseudocode):
>
> def deep(x):
> a=[x]
> return a
Hint : what's exactly the difference between deep(x) and [x] ?
> mylist=[]
> for N: mylist=deep(mylist)
>
> Is there a more elegant
Lawrence Oluyede wrote:
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
>
>
>>However, I wonder why L.sort() don't return the reference L, the
>>performance of return L and None may be the same.
>
>
> It's not "the same". sort() does not return anything.
Yes it does : it returns the None ob
vbgunz wrote:
> to throw fire on the fuel (:P), you can get the value back to an
> in-place mutable change with a single expression...
>
> mylist = [2,3,4,1]
> print mylist.sort() or mylist
>
> might not be too pythonic or maybe it is. I guess depends on what side
> of the glass you might wish to
John Salerno wrote:
> Gary Herron wrote:
>
>> Gary John Salerno wrote:
>>
>>> How do you make a single string span multiple lines, but also allow
>>> yourself to indent the second (third, etc.) lines so that it lines up
>>> where you want it, without causing the newlines and tabs or spaces to
>>>
Metalone wrote:
> I have a question about the interactive Python shell. Is it possible
> to reload a file and get the new definitions.
>
> For example, if I do
> import xyz
>
> Then I find a bug in some function in xyz.
> So, I edit xyz.py
>
> I would like to reload the definitions in xyz.py wi
Heavy wrote:
> Sorry,
> you got reason, I thought I can write in my language, cause this is the
> first time that I post a question in this group...
usually, the comp.* usenet hierarchy is english-speaking.
> My problem is that I
> have to receive parameters from a POST method, i try to read th
[EMAIL PROTECTED] wrote:
(top-post corrected)
>
> bruno at modulix wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>I have a python code which is running on a huge data set. After
>>>starting the program the computer becomes unstable and gets very
>>>dif
Gary Wessle wrote:
> Hi
>
> I am about to order 2 books, and thought I should talk to you first.
> I am getting Python Cookbook by Alex Martelli, David Ascher, Anna
> Martelli Ravenscroft, Anna Martelli Ravenscroft, since Bruce Eckel's
> Thinking in Python is not finished and didn't have any new r
[EMAIL PROTECTED] wrote:
> Ok, this is true.
>
> Well, you consider that my app has a first windows, where I choose, for
> example, the application 1.
> The application 1 will be started, and it will allocate 200Mb total.
> Now I want to abort this operation, and i will return to main initial
> w
mardif wrote:
> In python 2.5 this was resolved, ok, but i can't use any python version
> then 2.3.5.
>
> This project was initializated with this version, and now it can be
> dangerous change version, even because I use McMillan installer for
> compile e build an executable.
Err... I'm sorry I do
Edward Elliott wrote:
(snip)
>>don a écrit :
>>
>>>Also if there is a better way than using regex, please let me know.
>>
(snip)
>
> I wouldn't call these better (or worse) than regexes, but a slight variation
> on the above:
>
> marker = s.index('/CHECKEDOUT')
> branch = s [s.rindex('/', 0, mark
Lad wrote:
> I use Python 2.3.
> I have heard about decorators in Python 2.4.
What Python 2.4 adds is only syntactic sugar for decorators. You can do
the same - somewhat more explicitely - in 2.3.
> What is the decorator useful for?
FWIW, I'm not sure the name 'decorator' is such a great idea. A
[EMAIL PROTECTED] wrote:
> hi
> say i have a text file
>
> line1
> line2
> line3
> line4
> line5
> line6
> abc
> line8 <---to be delete
> line9 <---to be delete
> line10 <---to be delete
> line11 <---to be delete
> line12 <---to be delete
> line13 <---to be delete
> xyz
> line15
> line16
> lin
glomde wrote:
> Hi,
>
> I want to create a function that preprocesses a file and then imports
> the parsed file.
>
> What I found out is that you can do something like this:
>
> def ImportFile(fileName):
> parsedCode = Parser(fileName).Parse()
> module = new.module(name)
> exec parse
bruno at modulix wrote:
> [EMAIL PROTECTED] wrote:
>
(snip)
>
> Don't know if it's better for your actual use case, but this avoids
> reading up the whole file:
> def skip(iterable, skipfrom, skipuntil):
> """ example usage :
> >>&
Fredrik Lundh wrote:
(snip)
> to print to a file instead of stdout, just replace the print line with a
> f.write call.
>
Or redirect stdout to a file when calling the program !-)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTEC
Tim Chase wrote:
(snip)
> starLines = [line for line in p.readlines() if line.startswith("*")]
files are iterators, so no need to use readlines() (unless it's an old
Python version of course):
starLines = [line for line in p if line.startswith("*")]
> or you may optionally want to prune of the "
Fredrik Lundh wrote:
> bruno at modulix" wrote:
>
>
>>*please* re-read carefully what I and Diez wrote earlier in this thread
>>before jumping to possibly erroneous conclusion. I didn't say that the
>>problem *actually* was with Python - just that it *may*
Carl J. Van Arsdall wrote:
(snip)
> I just wanted to make the comment that there already exists a
> Condition() class in the threading module. If you plan on using your
> class with the threading module you might wish to use another name.
>
As far as I remember, Python has namespaces, so I don't
[EMAIL PROTECTED] wrote:
> Hello,
>
> i posted for suggestions a little idea even if it still needs further
> thoughts but as i'm sure you could help :)
>
> if would like to implement some kind of Condition class which i coud
> use to build bricks of more complex condition, conditions are based o
Tim Chase wrote:
>>> starLines = [line for line in p.readlines() if line.startswith("*")]
>>
>>
>> files are iterators, so no need to use readlines() (unless it's an old
>> Python version of course):
>>
>> starLines = [line for line in p if line.startswith("*")]
>
>
> Having started with some old
Martin Blume wrote:
> "bruno at modulix" schrieb
>
(snip)
>>def deco(func):
>> print "decorating %s" % func.__name__
>> def _wrapper(*args, **kw):
>>print "%s called " % func.__name__
>>res = func(*args, **kw)
>>
Duncan Booth wrote:
> bruno at modulix wrote:
>
>
>>>Otherwise, just to be informed, what advantage does rstrip() have over
>>>[:-1] (if the two cases are considered uneventfully the same)?
>>
>>1/ if your line doesn't end with a newline, lin
[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
>
>
>>I basically want to remotely shut down windows from linux and write
>>such a program in python.
>
FWIW, s/from linux/from another machine/
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p
Martin Blume wrote:
> "Sybren Stuvel" schrieb
>
>>Martin Blume enlightened us with:
>
> Don't know if I enlightened anybody ... :-)
Not sure...
But let's hope someone else having doubts about @decorator will find
this thread, so we won't have to point him/her to the documentation.
>>>Another q
Ted wrote:
> Thank you Roy.
>
> It seems if you lurk here long enough you eventually get all you
> questions answered without even asking!
> ;-)
>
+1 QOTW
please avoid top-posting, and please avoid posting back a long message
just to add three lines.
--
bruno desthuilliers
python -c "print '
Martin Blume wrote:
> "bruno at modulix" schrieb
>
>>[snip]
>>
>>The use case for @decorator is for wrapping functions
>>or method *in the module/class itself*.
>
> That was the question. What's the use of doing it
> like that in the modul
Gary Wessle wrote:
> Hi
>
> the second argument in the functions below suppose to retain its value
> between function calls, the first does, the second does not and I
> would like to know why it doesn't?
Fisrt thing to remember is that function's default args are eval'd only
once - when the def
Jacky wrote:
> Hi all,
>
> I just started learning Python and would like to starting writing some
> web-based applications with Python.
>
> I did have pretty much experience with doing so with PHP and Java, but
> Python seems a bit different for me.
>
> Do you guys have some good web framework t
Jacky wrote:
> Hi all,
>
> Thanks all of you for your recommendations, I'll check them out one by one.
>
> Besides, I'd like to say more about what I want to do. Since I'm
> planning to write something for "backend", I might not focus very much
> on the layout (HTML template) yet. Instead, I'd
Alex wrote:
> Hi, this is my first mail to the list so please correct me if Ive done
> anything wrong.
>
> What Im trying to figure out is a good way to organise my code. One
> class per .py file is a system I like, keeps stuff apart. If I do
> that, I usually name the .py file to the same as the
[EMAIL PROTECTED] wrote:
> Is Plone analoguous to ASP.NET?
Certainly not.
> Is it a python web developing platform?
No, it's a CMS. FWIW, it's written in bold on the project's home page:
"""
Plone: A user-friendly and powerful open source Content Management System
"""
(http://www.plone.org)
FW
Alex wrote:
> On 5/15/06, bruno at modulix <[EMAIL PROTECTED]> wrote:
>
(snip)
>
> Thanks for taking your time to help me out. :) You have cleared out
> many of my doubts. BTW, should I post "thank you" stuff here
Ain't that what you just did ?-)
> or
[EMAIL PROTECTED] wrote:
>>ssh [EMAIL PROTECTED] shutdown -s
>
>
> Than indeed workedThanks
>
> > use the subprocess module or shellutils to execute the above.
>
> I am a python newbie and how easy or difficult it is using the sub
> process module and shell utils.
It's as difficult as :
1
John Salerno wrote:
> Bruno Desthuilliers wrote:
>
>> At least someone reading this may learn about the max_split param of
>> str.split() !-)
>
>
> LOL. The first thing I did was scramble to the docs to see what that
> second parameter meant! :)
>
> But I was a little confused about why you inc
egbert wrote:
> What does a gui_event_loop know ?
>
> My gui is based on pygtk,
> but i suppose the mechanism is the same everywhere.
>
> The gui is created within a class-instance within a function.
> Normally, ie without a gui, everything that happens within
> a function is forgotten as soon t
infidel wrote:
>>is there any typical usage that shows their difference?
>
>
> I think the general idea is to use lists for homogenous collections and
> tuples for heterogenous structures.
>
> I think the database API provides a good usage that shows their
> differences. When you do cursor.fetc
[EMAIL PROTECTED] wrote:
> I did some searching for this topic, but couldn't find anything. A
> search of this list only turned up an old post from 2002.
>
> I'd like to add a comprehesive help system to my Python Application. By
> "comprehensive" I mean regular "read-like-a-book" help and context
[EMAIL PROTECTED] wrote:
> I'm currently trying to get access to the Python source code, however
> whenever I try to extract the files
from what ?
> using the latest version of WinZip
> (version 10) I get the following error "error reading header after
> processing 0 entries"
> I was under the im
Edward Elliott wrote:
> Bruno Desthuilliers wrote:
>
>
>>Then it would be better to just alias it:
>>
>># def convert_quote(quote):
>># return make_code(quote)
>>convert_quote = make_code
>
>
> The former makes sense if you're planning to do more with the calling
> function later.
Then it
MackS wrote:
(snip)
>>What's preventing the use of list comprehensions?
>>
>>new_list = [x+1 for x in old_list]
>
> Suppose I want to do anything as trivial as modify the values of the
> list members _and_ print their new values.
Then it's a sure design smell IMHO. Don't mix presentation wi
BartlebyScrivener wrote:
> At the commandline, run:
>
> pydoc -g
>
> In the interpreter:
>
> help("modulename")
>
> or help ()
>
> for interactive.
This is developper doc. I think the OP's talking about end-user doc.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w
Andrew Robert wrote:
> Hi everyone,
>
>
> I have a python program that will need to interact with an MQSeries
> trigger monitor.
>
> It does this fine but it hogs the trigger monitor while it executes.
>
> I'd like to fork the program off and terminate the parent process so
> that the trigger m
Alex Pavluck wrote:
> I am just learning Python and I am using the book, "Thinking like a
> Computer Scientist". There is an exercise that I am not able to get
> working and it is really easy so I thought I would ask for help here.
>
>
> Q: As an exercise, write a single string that:
> Procu
Pierre wrote:
> Hi,
>
> Sorry in advance, english is not my main language :/
>
> I'd like to customize the result obtained by getattr on an object : if
> the object has the requested property then return it BUT if the object
> doesn't has actually this property return something else.
So implemen
SamFeltus wrote:
> I am trying to figure out why so little web development in Python uses
> Flash as a display technology. It seems most Python applications
> choose HTML/CSS/JS as the display technology, yet Flash is a far more
> powerful and elegant display technology. On the other hand, HTML/J
glomde wrote:
> i I would like to extend python so that you could create hiercical
> tree structures (XML, HTML etc) easier and that resulting code would be
> more readable than how you write today with packages like elementtree
> and xist.
> I dont want to replace the packages but the packages cou
Andrew Robert wrote:
> bruno at modulix wrote:
>
>>Andrew Robert wrote:
>>
>>>Hi everyone,
>>>
>>>
>>>I have a python program that will need to interact with an MQSeries
>>>trigger monitor.
>>>
>>>It does this fi
Andrew Robert wrote:
> Gary Herron wrote:
>
>>Andrew Robert wrote:
>>
>
>
>
>>The windows CreateProcess call has many of the same semantics as the
>>Unix fork, i.e., a new process is created sharing all the resources of
>>the original process. The "subprocess" modules uses CreateProcess, but
>
Pierre wrote:
> I don't want to use getattr(object, property, default_value) because
> I'm using external code and I don't want to modify or patch it. In this
> code, the call is getattr(object, property).
Seems like a perfectly valid reason !-)
> On my objects, I must provide default values depe
glomde wrote:
>>What about using data for nodes and '=' for attributes ?
>>Would look like:
>>
>>
>>
>>Page Title
>>
>>
>>Hello World
>>
>>
>>
>>>I think that with the added syntax you get better view of the html
>>>page.
>>
>>indeed !-)
>
>
> I dont think it is very pythonic :-).
[EMAIL PROTECTED] wrote:
> Hi
>
> I have been looking for a active Python community website. Something
> like www.codeproject.com (contains code articles and guide, by
> developers, for developers) for Python users.
>
> Does something like this exist?
- this newsgroup - which is very active, fri
glomde wrote:
>>Adding ugly and unintuitive "operators" to try to turn a general purpose
>>programming language into a half-backed unusable HTML templating
>>language is of course *much* more pythonic...
>
>
> IT is not only for HTML. I do think html and xml are the biggest
> creators of
> hierar
glomde wrote:
>>What about writing a mini-language that gets translated to Python? Think of
>>Cheetah, which does exactly this (albeit not being limited to templating HTML
>>data).
>
> I have implemented my proposal as preprocessor. And it works fine. But
> my
> proposal in not only for HTML
Nor
SamFeltus wrote:
> I guess there isn't much to understand. If you are satisfied with a
> text based, static image web, that is light on artistic possabilities,
> all that HTML stuff is acceptable.
1. artistic != animated.
2. the web has mostly been designed for text-based content.
> Perhaps the
[EMAIL PROTECTED] wrote:
> Evaluation of default values seems to have nothing to do with the case
> I described.
It does. Please *read* the faq:
http://pyfaq.infogami.com/why-are-default-values-shared-between-objects
> The default values are both tags = {}, and still inside mysearch() I
> sometim
glomde wrote:
> I'm answering two of you posts here...
>
>
>>Sweet Lord, have mercy !
>>
>> > Which should create myList = [[0..9], {0:0, ... 9:9}]
>>
>>myList = [
>> range(10),
>> dict((i, i) for i in range(10))
>>]
>
>
>>Let's talk about readability
>
>
> My code was just to show that
glomde wrote:
>>What you are trying to achieve is to make syntactic sugar for making namespace
>>definitions look nicer. But: the way you are trying to do so isn't pythonic,
>>because there isn't one obvious way how your proposal works; you're not even
>>specifying a proper semantic interpretation
Ben Finney wrote:
> Peter Otten <[EMAIL PROTECTED]> writes:
(snip)
>>
>>You want
>>getattr(commands, VARIABLE)()
>
> You'll also need to anticipate the situation where the value bound to
> VARIABLE is not the name of an attribute in 'commands'.
>
> Either deal with the resulting NameError excepti
softwindow wrote:
> the re module is too large and difficult to study
Too bad.
> i need a detaild introduction.
That's fine. Then write it. Or pay someone to do so.
Just for the record : that's the only answers you would have get on most
usenet groups. Hopefully, c.l.py is a very friendly and t
Hari Sekhon wrote:
> I do
>
> import zipfile
> zip=zipfile.ZipFile('d:\somepath\cdimage.zip')
> zip.namelist()
> ['someimage.iso']
>
> then either of the two:
>
> A) file('someimage.iso','w').write(zip.read('someimage.iso'))
> or
> B) content=zip.read('someimage.iso')
>
> but both result in
Brian Blazer wrote:
> OK, I have a very simple class here:
>
> class Student:
class Student(object):
> """Defines the student class"""
>
> def __init__(self, lName, fName, mi):
> self.lName = lName
> self.fName = fName
> self.mi = mi
Do yourself a favour: use me
Brian Blazer wrote:
please, dont top-post, and edit out irrelevant material
> You are right, I do come from a Java background.
Then you may want to read this:
http://dirtsimple.org/2004/12/python-is-not-java.html
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w
PA wrote:
>
> On May 19, 2006, at 15:33, Diez B. Roggisch wrote:
>
>> And it seems as if you have some JAVA-background, putting one class in
>> one
>> file called the same as the class. Don't do that, it's a stupid
>> restriction
>> in JAVA and should be avoided in PYTHON.
>
> Restrictive or no
[EMAIL PROTECTED] wrote:
> Take a look at the pywin32 extension, which I believe has some lower
> level memory allocation and file capabilities that might help you in
> this situation.
But then the solution would not be portable, which would be a shame
since the zlib module (on which ZipFile reli
mardif wrote:
> Hi guys.
> I've a very big big big problem:
I think a lot of people in the world would not find it so big wrt/ their
own situation...
> I've in my windows computer a file named cicciobello.html, located in
> c:\documents and settings\username\desktop\cicciobello.html.
>
> Now,
Sion Arrowsmith wrote:
> Hari Sekhon <[EMAIL PROTECTED]> wrote:
(snip)
>>The python zipfile module is obviously broken...
>
> This isn't at all obvious to me.
zipfile.read() does not seem to take full advantage of zlib's
decompressobj's features. This could perhaps be improved (left as an
exerci
Fredrik Lundh wrote:
> Cameron Laird wrote:
>
>
>>Guys, I try--I try *hard*--to accept the BetterToAskForgiveness
>>gospel, but this situation illustrates the discomfort I consistently
>>feel: how do I know that the NameError means VARIABLE didn't resolve,
>>rather than that it did, but that eva
301 - 400 of 526 matches
Mail list logo