Ivan Van Laningham a écrit :
(snip)
> BTW, my "tortured method" is quicker than Bruno's, because to use his
> method I'd have to start the interactive interpreter.
>
"start the interactive interpreter" ??? What do you mean, "start the
interactive interpreter" ??? It's *always* started as a part
[EMAIL PROTECTED] a écrit :
> Thnks,
> I wrongly took it for a standard method;
> I found where it is defined (it's part of the project);
Then it would be nice to fully answer your question, so everyone may
know what's this method and what it does (and what project it comes from).
--
http://ma
Michael a écrit :
> Hi,
> I'm trying to write a script to parse a .cpp file and begin to create a
> 'translational unit'.
> To do this i need to:
>
> Go through the file and remove all 'C' comments as
> /* Comment 1*/
> (can be on multiple lines)
>
> Go through and remove all 'C++' comments, anyt
Roy Smith a écrit :
> bruno modulix <[EMAIL PROTECTED]> wrote:
>
>>I've always explicitelly used the (implied) 'this' pseudo-pointer in
>>Java, C++ etc. The wart is in all those languages that don't makes it
>>mandatory IMHO !-)
>
>
> And the correlary wart in Python is that the first argument
C Gillespie a écrit :
> Hi,
>
> Does anyone know of any examples on how (& where) to use staticmethods and
> classmethods?
>
Here's an example from a ldap lib (work in progress, not finished, and
all other disclaimers).
The class methods are here:
# ---
Steven D'Aprano a écrit :
(snip)
> Having said that, here is a good example of self-modifying code:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68429
>
> The RingBuffer class dynamically modifies itself once it is full so that
> its behaviour changes.
>
This is nothing more than
Kanthi Kiran Narisetti a écrit :
> Hi ALL,
>
> I am Windows Administrator, moving little ahead from batch files and
> scripts I started learning Python. I found that Python is very easy and
> is very well documented. Still I am looking more than examples. As a
> beginner i want to do lot of excers
nephish a écrit :
> Hey there,
> i am trying to write an online application using the cgi module.
> what i want to do is have an html form display a drop-down list and
> have the values of that list be the lines of text written in a file.
Simplest, Q&D solution :
1/ open the file for reading
2/ pr
infidel a écrit :
> Oh great, just when I thought I was starting to grok this mess.
+1
dont-worry-no-normal-humain-brain-can-handle-this-kind-of-stuff-ly'yrs
--
http://mail.python.org/mailman/listinfo/python-list
Kristian Zoerhoff a écrit :
> On 1 Jun 2005 09:41:53 -0700, infidel <[EMAIL PROTECTED]> wrote:
>
>>Why in the name of all that is holy and just would you need to do such
>>a thing?
>
>
> Is anyone else amused that this came from the mouth of someone named
> "Infidel"?
I was just recovering fro
Mac a écrit :
> Under certain circumstances isinstance() seems to return incorrect
> value for me. I'm using Python 2.3 (latest from Debian's unstable).
> Here's a sample program... the multi-module nature of the code is key.
>
>
> === test.py ===
>
> class Foo:
> pass
>
> def test():
>
Chris Spencer a écrit :
> Kalle Anke wrote:
>
>> On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote
>> (in article <[EMAIL PROTECTED]>):
>>
>> void doSomething( data : SomeClass ){ ... }
>>
>> and I would be sure at compile time that I would only get SomeClass
>> objects as parameters into the meth
[EMAIL PROTECTED] a écrit :
> If two objects are of equal value you can compare them with ==. What I
> want to do is find out if two objects are actually just references to
> the same object, how can I do this in Python?
The most obvious way (as usual ?):
if obj1 is obj2:
// your code here
-
Chris Spencer a écrit :
> Bruno Desthuilliers wrote:
>
>> And *this* is highly unpythonic. And un-OO too, since it makes foo()
>> dependant on *class* Bar, when it should most probably be enough that
>> it only depends on (probably part of) the *interface* of class Ba
[EMAIL PROTECTED] a écrit :
> Sorry about removing my message, I posted with the wrong google
> account, I don't really want my email where those irritating spam bots
> can find it.
>
>
>>The most obvious way (as usual ?):
>>
>>if obj1 is obj2:
>> // your code here
>
>
> I immediately thought o
Andrea Griffini a écrit :
(snip)
> What I know is that every single competent programmer
> I know (not many... just *EVERY SINGLE ONE*) started
> by placing firmly concrete concepts first, and then
> moved on higher abstractions (for example like
> structured programming, OOP, functional languages
rbt a écrit :
> Here's the scenario:
>
> You have many hundred gigabytes of data... possible even a terabyte or
> two. Within this data, you have private, sensitive information (US
> social security numbers) about your company's clients. Your company has
> generated its own unique ID numbers to
Xavier Décoret a écrit :
(snip)
> What I wanted to do is something like this:
>
> def change(x,v):
> x = v
>
> class A(object):
> def __init__(self,v):
> self.x = v
>
> a = A(3)
> print a.x # displays 3
> change(a.x,4)
> print a.x # still displays 3
>
>
> It may seem weird,
Xavier Décoret a écrit :
> Bruno Desthuilliers a écrit :
>
(snip)
>> I really wonder what it can be ???
>
> It's the ability to develop the equivalent of GeoNext (and much more) in
> Python with a very nice syntax.
This is nice, but this does not explain th
mosscliffe a écrit :
> Excellent - thanks for all your help. I now have a form created by a
> python script executing an HTML page,
s/executing/generating/, I think...
> doing everything I need, except
> for Session Data (probably use hidden fields ?? future research)
HTTP is a stateless prot
Steve Holden a écrit :
> mosscliffe wrote:
(snip)
>> Why is a link better than a button ?
>>
> Beats me why you got that advice. Buttons are perfectly adequate for
> that purpose.
Call me a purist if you want, but I don't think forms and buttons are
"perfectly adequate" for normal navigation, wh
7stud a écrit :
> http://www.evolt.org/article/OO_programming_the_Python_way/18/449/
>
> -
> The last article gives you the absolute basics of using Python. This
> time, we'll do the OO side of Python. Yes, Python: a true object-
> oriented language with classes, inheritance and all.
>
> Ok,
Steve Holden a écrit :
(snip)
> Stop thinking of three lines as "extensive coding" and your problem
> disappears immediately.
Lol !
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
Neil Cerutti a écrit :
> On 2007-06-04, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>> Wildemar Wildenburger wrote:
>>> While that is true, I guess it is commonplace to use i, j, k
>>> and n (maybe others) in constructs like
>>>
>>> for i in range(len(data)):
>>>do_stuff(data[i])
>>>
>>> Or shou
Ninereeds a écrit :
> Google Groups appears to have thrown away my original reply, so sorry
> if this appears twice...
>
> On Jun 4, 9:51 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>
>> 'i' and 'j' are the canonical names for for loops indices in languages
>> that don't support proper i
Neil Cerutti a écrit :
> On 2007-06-06, Bruno Desthuilliers
> <[EMAIL PROTECTED]> wrote:
>> Neil Cerutti a écrit :
>>> On 2007-06-04, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>>>> Wildemar Wildenburger wrote:
>>>> I agree with Bruno t
Terry Reedy a écrit :
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> | > Terry Reedy wrote:
> | > > In Python, you have a choice of recursion (normal or tail)
>
> [snip Stroud questions]
>
> | I'm afraid Terry is wrong here, at least if he meant that CPython had
> | tail recur
[EMAIL PROTECTED] a écrit :
> Hi all,
>
> I can use list comprehension to create list quickly. So I expected that I
> can created tuple quickly with the same syntax. But I found that the
> same syntax will get a generator, not a tuple. Here is my example:
>
> In [147]: a = (i for i in range(10))
Neil Cerutti a écrit :
(snip)
> class bar:
> def readgenome(self, filehandle):
> self.s = ''.join(line.strip() for line in filehandle)
=>
self.s = ''.join(line.strip() for line in filehandle if not
'>' in line)
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah a écrit :
> I want to do SOAP like calls from a device who's libraries
> don't include SOAP. I'm thinking of using simple HTTP posts,
> but I'm going to want to send arrays and hashes.
Then I'd second Simon's suggestion to use JSON.
--
http://mail.python.org/mailman/listinfo/python-list
Josiah Carlson a écrit :
(snip)
> Well, the particular operation is typically called 'currying a
> function',
it's not 'currying' but 'partial application'.
Currying is somehow the reverse of partial : it's a way of building a
multiple-args function from single-args functions.
--
http://mai
Amol a écrit :
> Hi, I want to learn Python in less than a month which resources should
> I use.
Your brain ?-)
(actually, a computer with Python installed on it may help too...)
> I prefer to read books .
Books are fine, but won't be of much help unless you actually *code* in
Python.
> Pleas
Neal Becker a écrit :
> To implement logging, I'm using a class:
If I may ask : any reason not to use the logging module in the stdlib ?
> class logger (object):
> def __init__ (self, name):
> self.name = name
> self.f = open (self.name, 'w')
> def write (self, stuff):
>
Alex Martelli a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]>
> wrote:
>
>> Josiah Carlson a écrit :
>> (snip)
>>> Well, the particular operation is typically called 'currying a
>>> function',
>>
>> it's not '
Tom Gur a écrit :
>> Look for @staticmethod inhttp://docs.python.org/lib/built-in-funcs.html
>>
>> Example:
>> class C:
>> @staticmethod
>> def f(arg1, arg2, ...): ...
>
>
> Oops, sorry for the confusion - I've actually meant a static method,
> and Gerald's answer works fine.
FWIW, stati
[EMAIL PROTECTED] a écrit :
> Greetings,
>
> I have been working on a little project today to help me better
> understand classes in Python (I really like Python). I am a self
> taught programmer and consider myself to fall in the "beginner"
> category for sure. It was initially sparked by reading
Ben Finney a écrit :
> "Ethan Kennerly" <[EMAIL PROTECTED]> writes:
>
>> I really like properties for readonly attributes,
>
> Python doesn't have "readonly attributes",
Err... Ever tried to set a class mro ?-)
> and to attempt to use
> properties for that purpose will only lead to confusion.
Ethan Kennerly a écrit :
> Hello,
>
> There are a lot of Python mailing lists. I hope this is an appropriate one
> for a question on properties.
It is.
> I am relatively inexperienced user of Python. I came to it to prototype
> concepts for videogames. Having programmed in C, scripted in Uni
james_027 a écrit :
> hi everyone,
>
> I am now in chapter 5 of Dive Into Python and I have some question
> about it. From what I understand in the book is you define class
> attributes & data attributes like this in python
s/data/instance/
> class Book:
>
> total # is a class attribute
>
Stephen R Laniel a écrit :
> On Wed, Jun 20, 2007 at 12:59:28PM -0700, [EMAIL PROTECTED] wrote:
>> Then you should use another language.
>
> This is what I meant about knowing how Internet discussions
> go.
>
Please let not forget the context.
You said:
"I'm new to Python",
and then :
"if I *w
Stephen R Laniel a écrit :
> On Wed, Jun 20, 2007 at 09:41:09PM +0100, Michael Hoffman wrote:
>> If you asked Java programmers why you couldn't turn *off* Java's static
>> type checking if you wanted to, you'd probably get a similar response.
>
> Perhaps it would help for me to explain what I'd
[EMAIL PROTECTED] a écrit :
> Hi,
>
> I want to take read an input file (sels.txt) that looks like:
>
(snip)
>
> And turn it into an output file for each of the "sels" in the input file, i.e
> sel1.txt:
>
(snip)
> and sel2.txt:
>
(snip)
> And so on.
Yes, fine. All this is documented here:
[EMAIL PROTECTED] a écrit :
(snip)
>>> I would like to be able to get a good hold of the concept
>> state machines ?
>
> Well both state machines and classes (objects). That may be a bit of a
> tall order to take on all at once but the concepts seem to be quite
> related.
They are, since OO was
Steven W. Orr a écrit :
> Does something like that exist?
http://www.myghty.org/
--
http://mail.python.org/mailman/listinfo/python-list
Peter Decker a écrit :
(snip)
> Oh, c'mon. The OP was asking for an explanation, and got an indignant
> response. There is a world of difference between explaining *why*
> Python is the way it is, and getting the equivalent of a 4-year-old's
> "Because!" as a reply.
Python is the way it is becaus
Ethan Kennerly a écrit :
> Thanks for the help! Using the "class name (object)" syntax fixed my
> problem.
>
(snip)
>
> I am having to unteach myself some of the defensive programming techniques
> in C++, such as using name mangling to ensure privacy, when privacy is not
> the most important cri
walterbyrd a écrit :
> On Jun 22, 11:43 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
>
>
>>Can you help us understand, by showing a use case that would in your
>>estimation be improved by the feature you're describing?
>>
>
>
> Suppose you are sequentially processing a list with a routine that
>
walterbyrd a écrit :
> On Jun 24, 10:31 pm, Bruno Desthuilliers
> <[EMAIL PROTECTED]> wrote:
>
>
>>>Especially since variables in python do not have to be explicitly
>>>assigned
>>
>>???
>
>
> I have probably expressed this incorrectly.
7stud a écrit :
> I'm trying to get Apache set up on my system so I can use mod_python.
> I installed Apache 2.2.4 according to the following instructions:
>
> http://switch.richard5.net/isp-in-a-box-v2/installing-apache-on-mac-os-x/#comment-30704
>
> and everything seemed to install correctly, b
walterbyrd a écrit :
>>> On Jun 24, 10:31 pm, Bruno Desthuilliers
>>> <[EMAIL PROTECTED]> wrote:
>> You perhaps don't know this, but most statically typed languages have
>> the notion of either pointers or references, that can cause similar -
>> and u
paul a écrit :
> Bruno Desthuilliers schrieb:
>> Stephen R Laniel a écrit :
>>> On Wed, Jun 20, 2007 at 09:41:09PM +0100, Michael Hoffman wrote:
>>>> If you asked Java programmers why you couldn't turn *off* Java's
>>>> static type che
harri a écrit :
> Bruno Desthuilliers wrote:
> [...]
>> It seems obvious from this that static typecheking would require
>> dropping all dynamism from Python - then turning it into another, very
>> different (and mostly useless as far as I'm concerned) language. IOW :
Stephen R Laniel a écrit :
> On Wed, Jun 27, 2007 at 01:44:17PM +0200, Bruno Desthuilliers wrote:
>> Indeed - static typing is for compilers, not for programmers.
>
> When done well, static typing helps the programmer
The closer thing to "well done static typing" I know
walterbyrd a écrit :
> On Jun 26, 8:23 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote:
>
>>walterbyrda écrit :
>>
>>
>>>>You do program carefully, don't you ?-)
>>
>>>I try. But things like typos are a normal part a life.
>>
Jorgen Bodde a écrit :
> I had the same feeling when I started, coming from a C++ background, I
> forgot about self a lot, creating local copies of what should be an
> assign to a class instance, or methods that could not be found because
> I forgot 'self' .
>
> Now I am 'kinda' used to it, as eve
John Nagle a écrit :
> Bruno Desthuilliers wrote:
>
>> harri a écrit :
>
>
>> Indeed - static typing is for compilers, not for programmers.
>
>
> Actually, static typing is for detecting errors before the
> program is run.
[EMAIL PROTECTED] ~
Stef Mientki a écrit :
> How can I list a type of an object instance ?
>
> I tried:
>
> class tLED (tDevice):
Do yourself (and the world) a favour and give up hungarian notation...
This should be:
class Led(Device):
#...
> def some_proc(self):
> print 'type(self)', type(self)
>
Stephen R Laniel a écrit :
> On Thu, Jun 28, 2007 at 09:08:16AM +0200, Bruno Desthuilliers wrote:
>> You said ?
>
> I could link again to Mark-Jason Dominus, who writes that
> people often make the following inference:
>
> 1) C is strongly typed.
Lol. C is well known f
stef a écrit :
> Bruno Desthuilliers wrote:
>> Stef Mientki a écrit :
>>> How can I list a type of an object instance ?
>>>
>>> I tried:
>>>
>>> class tLED (tDevice):
>>
>>
>> Do yourself (and the world) a favour and
massimo s. a écrit :
>> At this point, it seems too much a deep object-oriented hell to be
>> able to dig it myself. Would you help me getting some cue on the
>> problem?
>
> Update. Now I know that:
> - every sane Python class should return after
> type(self)
Certainly not, unless you're using
massimo s. a écrit :
> On 28 Giu, 13:45, Bruno Desthuilliers [EMAIL PROTECTED]> wrote:
>>
>> wrt/ this snippet:
>>
>> for plugin_name in self.config['plugins']:
>> try:
>> plugin=__import__(plugin_name)
>
massimo s. a écrit :
> On 28 Giu, 14:41, "massimo s." <[EMAIL PROTECTED]> wrote:
>
>> The new-style behaviour only appears when wxFrame is plugged with the
>> current hack.
>> That is:
>>
>> - print type(self) in wxFrame alone returns
>> - print type(self) in the plugged (multiply inherited) wxFr
Bjoern Schliessmann a écrit :
> Bruno Desthuilliers wrote:
>> John Nagle a écrit :
>
>>> Actually, static typing is for detecting errors before the
>>> program is run.
>> [EMAIL PROTECTED] ~ $ gcc -ototo toto.c
>> [EMAIL PROTECTED] ~ $ ./toto
>
Neil Cerutti a écrit :
> On 2007-06-28, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>> Stef Mientki a écrit :
>>> How can I list a type of an object instance ?
>>>
>>> I tried:
>>>
>>> class tLED (tDevice):
>>
>> Do your
walterbyrd a écrit :
>> Did you try to sort a tuple ?
>>
>> >>> (1, "aaa").sort()
>> Traceback (most recent call last):
>>File "", line 1, in ?
>> AttributeError: 'tuple' object has no attribute 'sort'
>
> I can do this:
>
x = (3,2,1)
x = tuple(sorted(list(x)))
>
> Which, although
[EMAIL PROTECTED] a écrit :
> Hello,
>
> I would like to create a minimalist file browser using pyGTK.
>
> Having read lot of tutorials, it seems to me that that in my case, the
> best solution is
> to have a gtk.TreeStore containing all the files and folders so that
> it would map the
> file sys
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>Nope, he just asserted something wrong. Static typing is for compiler
>>optimization. Type checking is at most a side effect, and in some
>>languages (at least C, C++ and Java) can be tot
John Nagle a écrit :
(snip)
> It looks like
> a compromise between the "no declarations" position and the "make
> the language strongly typed" position.
(snip)
> The main advantage of strongly typed systems is that more errors
> are detected at compile time.
(snip)
s/strongly/statically/
1/ s
Eduardo "EdCrypt" O. Padoan a écrit :
> On 6/22/07, John Nagle <[EMAIL PROTECTED]> wrote:
> Remember that pure CPython has no different "compile time" and
> runtiime.
Oh yes ? So what's the compiler doing, and what are those .pyc files ?
(hint: read the doc)
--
http://mail.python.org/mailman/lis
Kuo a écrit :
> Hi,
> I'm trying to read a file (fileA) and append to another file(fileB).
> However, I always get "^M" at the end. Does anyone know why ? Here is my
> code ?
>
> os.system("../syn/pin_assign.pl customer_netlist.txt")
> shutil.copy("../fileB", "fileB")
> ucf = open("fileB", "a")
David a écrit :
> I am looking for an ORM for Python that fulfills a few simple needs.
>
> - ability to support a number of backends (probably mysql and sqlite
> at present, csv a bonus)
I didn't knew csv was a relational database.
> - ability to be used easily from console python scripts, a b
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>>[A type system is a] tractable syntactic method for proving the
>>>absence of certain program behaviors by classifying phrases
>>>according to the kinds of values the
CarlP a écrit :
> How do I run a Python script.
usually, it's:
$ python /path/to/somescript.py arg1 argN
on a command line prompt.
> I have one that gmail loader needs to
> run on my email box. Here's the script
>
> http://www.marklyon.org/gmail/cleanmbox.py
>
> I can't seem to find what I ne
Alex Martelli a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>...
>
>>I still maintain that the primary *practical* reason behind static
>>typing is to provide optimization clues for the compiler. You can (or at
>
>
> It's defin
Diez B. Roggisch a écrit :
>>
>> wrt/ proofs of correctness, I'll just point to the spectacular failure
>> of Ariane, which was caused by a *runtime* type error in a system
>> programmed in ADA - one of the languages with the most psychorigid
>> declarative static type systems.
>
>
> That's si
Frank Swarbrick a écrit :
> dmitrey wrote:
>
>> Thanks all, I have solved the problem.
>
>
> Why do people do this without posting what the actual solution is
Probably because those people think usenet is a free help desk ?
--
http://mail.python.org/mailman/listinfo/python-list
Nathan Harmston a écrit :
> Hi,
>
> I m sorry but I m bored at work (and no ones looking so I can write
> some Python) and following a job advertisement post,I decided to write
> the code to do its for the one entitled Ninjas or something like that.
> I was wondering what could be done to my follo
Evan Klitzke a écrit :
> On 7/2/07, Cathy Murphy <[EMAIL PROTECTED]> wrote:
>> Is python a compiler language or interpreted language. If it is
>> interpreter
>> , then why do we have to compile it?
>
> It's an interpreted language. It is compiled into bytecode
By this definition, Java is an int
Nathan Harmston a écrit :
> HI,
(snip)
> I have one question though:
>
> Using a module global for this kind of data is usually a bad idea
> (except eventually for run-once throw-away scripts, and even then...)
>
> Why is this a bad idea?
Don't you have any idea ?
--
http://mail.python.org/mail
Nathan Harmston a écrit :
>> > Using a module global for this kind of data is usually a bad idea
>> > (except eventually for run-once throw-away scripts, and even then...)
>> >
>> > Why is this a bad idea?
>>
>> Don't you have any idea ?
>
> Not really.problem with access, using unneeded memor
noamtm a écrit :
> Hi,
>
> Some functions, like os.walk(), return multiple items packed as a
> tuple:
>
> for (dirpath, dirnames, filenames) in os.walk(...):
>
> Now, if you don't care about one of the tuple members, is there a
> clean way to ignore it,
Yes : just ignore it !-)
> in a way that
Paul Rubin a écrit :
> greg <[EMAIL PROTECTED]> writes:
>>> E.g. your program might pass its test and run properly for years
>>> before some weird piece of input data causes some regexp to not quite
>>> work.
>> Then you get a bug report, you fix it, and you add a test
>> for it so that particular
[EMAIL PROTECTED] a écrit :
> Dear all,
>
> what is the difference? Middleware?
>
> I'm wondering because the only variables I ever needed were PATH_INFO,
> REQUEST_METHOD, QUERY_STRING and maybe one more, all of which should
> be available from CGI, too.
>
> Thanks.
>
WSGI is intented as a ga
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>Because static type checks impose a lot of arbitrary restrictions,
>>boilerplate code etc, which tends to make code more complicated than
>>it needs to be, which is a good way of introdu
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>Haskell - as other languages using type-inference like OCaml - are in
>>a different category. Yes, I know, don't say it, they are statically
>>typed - but it's mostly structural
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>>> Some users in fact recommend writing an explicit type signature for
>>> every Haskell function, which functions sort of like a unit test.
>> Stop here. explicit type signature == declarat
Hardy a écrit :
> On 5 Jul., 18:07, infidel <[EMAIL PROTECTED]> wrote:
>> On Jul 5, 8:58 am, Hardy <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>> I experience a problem with append(). This is a part of my code:
>>> for entity in temp:
>>> md['module']= entity.addr.get('module')
>>>
mshiltonj a écrit :
> On Jul 8, 8:29 pm, Paul McGuire <[EMAIL PROTECTED]> wrote:
>> On Jul 8, 2:11 pm, mshiltonj <[EMAIL PROTECTED]> wrote:
>
>> I have some comments on the Pythonicity of your suggestions. Same
>> assumption, object attr is a unique key of some sort. How to create
>> the dict of
Marc 'BlackJack' Rintsch a écrit :
> On Fri, 06 Jul 2007 17:31:50 +, DeveloperX wrote:
>
>> I am trying to figure out how to rewrite the following chunk of code
>> in Python:
>>
>> C source
>> [code]
>> typedef struct PF
>> {
>> int flags;
>> long user;
>> char*filename;
>> unsigned ch
Daniel Nogradi a écrit :
>> I have an issue I think Python could handle. But I do not have the
>> knowledge
>> to do it.
>>
>> Suppose I have a class 'myClass' and instance 'var'. There is function
>> 'myFunc(..)'. I have to add (or bind) somehow the function to the
>> class, or
>> the instance.
Thorsten Kampe a écrit :
> Hi,
>
> I've already sent this to the Komodo mailing list (which seemed to me
> the more appropriate place) but unfortunately I got no response.
>
> I'd like to build a Python GUI app. Neither Tkinter nor Wxpython nor
> PyQT are actually what I want (because the lack
Rustom Mody a écrit :
> yaml by its indent-orientation is quite pythonic. In comparison xml
> is cumbersome and laborious.
>
> Strangely ruby supports yaml out of the box but python requires a
> third party package PyYAML.
>
> Now this may not seem like a big deal for us -- installing pyYAML
> t
Rustom Mody a écrit :
> On 7/11/07, Stefan Behnel <[EMAIL PROTECTED]> wrote:
>
>> Rustom Mody wrote:
>
>
>> > So is it likely that yaml will make it to the standard python library
>> > at some point??
>>
>> That's up to the maintainers of PyYAML. If they want to get it in,
>> there will
>> be w
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>>If the assertion is wrong, the compiler signals an error. In
>>>that sense it's like a unit test; it makes sure the function does what
>>>the user expects.
>>
>>
Daniel Nogradi a écrit :
(snip)
>> > def method_for_instance( message ):
>> >print message
>> >
>> > class myClass( object ):
>> >pass
>> >
>> > inst = myClass( )
>> > inst.method = method_for_instance
>> >
>> > inst.method( 'hello' )
(snip)
>> This won't work as expected:
>>
>> class Bidul
Paul Rubin a écrit :
> Duncan Booth <[EMAIL PROTECTED]> writes:
>>> status = not (False in list)
>> That is an equality test, not an identity test:
>>
> False in [0]
>> True
>
> Arrh! Strongly typed language, my eye ;-) Thanks.
We're quite a few to still think that the introduction of
Steven D'Aprano a écrit :
(snip)
> I mean, really, does anyone *expect* True+True to give 2, or that 2**True
> even works,
I may be biased since I learned C before Python and learned Python
before it had a Boolean type, but I'd think that having False==0 and
True==1 is not that surprising for m
Steven Bethard a écrit :
(snip)
> Remember that while Python 3 is allowed to break backwards
> compatibility, it's only supposed to do it when there are concrete
> benefits. Clearly there are existing use cases for treating bools like
> ints, e.g. from Alexander Schmolck's email:
>
> (x < b
Lachlan Gunn a écrit :
> Hello.
>
> I have a library (SQLObject) that stores data as class variables. I would
> like to set a class variable in a certain context, specific to a certain
> instance of an object. This would require some sort of anonymous class. I
> have attempted to use the follow
Alex Popescu a écrit :
(snip)
>
> You are defining the list in the class context and so it becomes a
> class field/member.
'attribute' is the pythonic term.
--
http://mail.python.org/mailman/listinfo/python-list
901 - 1000 of 3705 matches
Mail list logo