could ildg wrote:
I want to add a string such as "I love you" to the beginning of a binary file,
How to? and how to delete the string if I want to get the original file?
You shouldn't use Python to write a virus :-)
-pu
--
http://mail.python.org/mailman/listinfo/python-list
The Python shell you get with IDLE is actually not a system shell like
cmd.exe or sh, bsh, csh etc. It is a shell that allows the Python
interpreter to evaluate each line of Python code as you type.
This is why when you type 'hello.py' it tells you 'hello.py' is not
defined. On a higher level it s
Su Wei <[EMAIL PROTECTED]> wrote:
> if i have a xml file like this:
>
>
>
>
>
> i want to save this information,and used by other moduls later.
>
> how should i do it? ths
First you need an xml library. There's one built into Python, but
ElementTree is a simpler one: http://effbot.o
"Mr. Magoo" wrote:
>> $ python -t test.py
>> test.py: inconsistent use of tabs and spaces in indentation
>> hello
>> goodbye
>
> On more question. When using py_compile from with a script, is there any
> way to force the -t flag?
if you want to check for tab problems from inside a script, use the
Su Wei <[EMAIL PROTECTED]> wrote:
> if i want to make a global class to save configuration information of
> app that is read from a xml file,what can i do?
Just put it in a module. Say, 'progconfig.py'. Your configuration
code can then look like:
import progconfig
# parse configuration informat
Tian wrote:
import ModuleA
classname = "Dog"
module = globals()["ModuleA"]
classobj = ??? <---using classname
instanct = classobj()
classobj = getattr(module, classname)
STeVe
--
http://mail.python.org/mailman/listinfo/python-list
Hi Everyone,
I am new to python. I have just installed it. I am went to the python
website and used it to download python and a beginners tutorial. I set
the environment variables as explained in the faq.
However when I start idle and run a program from it; I get the
following types of errors; ho
I have a module called ModuleA.py, in which there is a class called
Dog, what should I put in the "" part to get the instance of class
Dog???
import ModuleA
classname = "Dog"
module = globals()["ModuleA"]
classobj = ??? <---using classname
instanct = classobj()
--
http://mai
Tian wrote:
I also have some problem about the "import". How should I design my
packages?
Say, I have all code locates at c:\projects\sami, "c:\project" is in my
PYTHONPATH environment variable. Suppose my folder structure is like
this:
c:
projects\ <-this directory is in PYTHONPATH
Doug Helm wrote:
> form = cgi.FieldStorage()
> if lobjUp.Save('filename', 'SomeFile.jpg'):
> class BLOB(staticobject.StaticObject):
> def Save(self, pstrFormFieldName, pstrFilePathAndName):
> form = cgi.FieldStorage()
You are instantiating cgi.FieldStorage twice. This won't work for POST
On Sunday 27 March 2005 07:56 pm, could ildg wrote:
> I want to add a string such as "I love you" to the beginning of a binary
> file, How to? and how to delete the string if I want to get the original
> file?
There are many ways.
Define large.
--
James Stroud, Ph.D.
UCLA-DOE Institute for Geno
Look up "Aspect Oriented Programming" and Python.
You should find several packages that can do this,
together with discussions of how to make cuts and all
that fun stuff. The feeling of power is very heady - until
you have to maintain the resulting mess.
John Roth
"Alex VanderWoude" <[EMAIL PROTEC
"Tian" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I am writing a python program which needs to support some plug-ins. I
have an XML file storing some dynamic structures. XML file records some
class names whose instance needs to be created in the run time while
parsing the XML file
Alex VanderWoude wrote:
Basically I want to change wxFrame.__init__ so that it looks sort of like
this:
def __init__(self, *args, **kwargs):
# Some enhancements here.
# The original code of this method, including the call to its
ancestor.
# Some more enhancements here.
A
On Mon, 28 Mar 2005 03:57:16 GMT, Alex VanderWoude <[EMAIL PROTECTED]> wrote:
>Is there a way to override a method on a class whose source you cannot
> change in such a way that you can hook into that method's code? After doing
> some research, it appears that one way to do such a thing is to crea
Thanks, thats a really handy function
"Ron_Adam" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]>
> wrote:
>
> >I've hit a brick wall on something that I'm guessing is pretty simple but
> >it's driving me nuts.
>
> Yes, I
Here's the solution to previous post.
---
perl code:
sub sort_matrix($$) {
my $ref_matrix = $_[0];
my @indexMatrix = @{$_[1]};
my @indexes = map {$_->[0]} @indexMatrix;
my @operators = map {$_->[1] ? ' cmp ' : ' <=> '} @indexMatrix;
my @directions
Jp Calderone wrote:
On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud <[EMAIL PROTECTED]> wrote:
"ATT/GATA/G"
gets split to
[['A'], ['T'], ['T', 'G'], ['A'], ['T'], ['A', 'G']]
I have written a very ugly function to do this (listed below for the curious),
but intuitively I think this should only ta
I am writing a python program which needs to support some plug-ins. I
have an XML file storing some dynamic structures. XML file records some
class names whose instance needs to be created in the run time while
parsing the XML file. I wonder what is the best solution for this
problem?
I also have
Is there a way to override a method on a class whose source you cannot
change in such a way that you can hook into that method's code? After doing
some research, it appears that one way to do such a thing is to create a new
(non-class) method, and then assign the new method to the class in questio
I want to add a string such as "I love you" to the beginning of a binary file,
How to? and how to delete the string if I want to get the original file?
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
I should have been more clear in my subject line. I was also the poster in
the "File Uploads" topic. I'm not having any luck getting file uploads to
work (multi-part HTML form) on a Windows server. I'm using a very close
approximation of public domain code that I found. I've tried a couple of
d
I'm just starting to work with Python. Have had a little experience
with basic. I am using Python on a Windows XP system.
How to I print a line of output generated in a python script to a
printer attached to the windows computer?
--
http://mail.python.org/mailman/listinfo/python-list
Ron Garret wrote:
In article <[EMAIL PROTECTED]>,
Steven Bethard <[EMAIL PROTECTED]> wrote:
Why don't you just write a function to create class objects?
def f(*params):
class C(...):
... # based on params
return C
I suppose I could. When I originally started writing this code I w
A subject line should say what the message is about, for example
"Create HTML tag using objects (newbie Q)"
and enable people who are not interested in or knowledgable about a
topic to skip it, while grabbing the attention of people who are
knowledgable/interested.
--
http://mail.python.org/mai
On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud
<[EMAIL PROTECTED]> wrote:
>Hello,
>
>I have strings represented as a combination of an alphabet (AGCT) and a an
>operator "/", that signifies degeneracy. I want to split these strings into
>lists of lists, where the degeneracies are members of th
Brian van den Broek wrote:
Much nicer than mine. =| :-)
^
|
(hats off)
Cool ascii art (but thanks for the translation)!
Michael
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Steven Bethard <[EMAIL PROTECTED]> wrote:
> Ron Garret wrote:
> > I need to dynamically generate new types at run time. I can do this in
> > two ways. I can use the "type" constructor, or I can generate a "class"
> > statement as a string and feed that to the e
I'm still very new to Python, after decideding to learn a true
programming language (rather then a scripting language, i like to think
i'm a intermediate PHP user). I decided for my first project I would
try to make a IRCbot. It would run on the commandline with a frontend
for commands such as "rec
In article <[EMAIL PROTECTED]>,
Leif K-Brooks <[EMAIL PROTECTED]> wrote:
> Ron Garret wrote:
> > I need to dynamically generate new types at run time. I can do this in
> > two ways. I can use the "type" constructor, or I can generate a "class"
> > statement as a string and feed that to the ex
On Sunday 27 March 2005 05:04 pm, Michael Spencer wrote:
> >>> def group(src):
> ... stack = []
> ... srciter = iter(src)
> ... for i in srciter:
> ... if i == "/":
> ... stack[-1].append(srciter.next())
> ... else:
> ... stack.app
On Mon, 28 Mar 2005 01:15:34 +, Jp Calderone wrote:
>
> Notice that you have a method named "url" as well as an attribute
> named "url". You have the same problem for "thumb". These methods
> and attributes are in collision with each other. When you try to
> look up the
..and there are more seemingly every day...
Table of Contents
Beginners (12)
Database (6)
Extending and Embedding (4)
General and Advanced (15)
Grimoire (1)
GUI Programming: General and Miscellaneous (6)
GUI Programming: Tkinter (4)
GUI Programming: wxPython and PythonCard (7)
GUI Programming: pyG
See http://www.oreilly.com/catalog/pythoncook2/index.html
I don't see it on Amazon yet, but you can order it from O'Reilly.
Ron Stephens
www.awaretek.com
--
http://mail.python.org/mailman/listinfo/python-list
Michael Spencer said unto the world upon 2005-03-27 20:04:
James Stroud wrote:
Hello,
I have strings represented as a combination of an alphabet (AGCT) and
a an operator "/", that signifies degeneracy. I want to split these
strings into lists of lists, where the degeneracies are members of the
s
On Sun, 27 Mar 2005 17:06:05 -0800, Captain Dondo <[EMAIL PROTECTED]> wrote:
> [snip]
>
> def url (self):
> self.url = ...
>
> def thumb (self):
> self.thumb = ...
>
> [snip]
>
> The problem is that m.html in the test section fails with
>
> TypeError: cannot concatenat
OK, I know this is covered somewhere in Python 101, but for the life of me
I cannot figure this out. I really need a basic intro to Python book
I am trying to do something very simple - create an HTML tag using objects:
class Movie:
def __init__ (self, t="", a="", d=""):
#
James Stroud wrote:
Hello,
I have strings represented as a combination of an alphabet (AGCT) and a an
operator "/", that signifies degeneracy. I want to split these strings into
lists of lists, where the degeneracies are members of the same list and
non-degenerates are members of single item lis
On Sun, 27 Mar 2005 12:48:46 +0200, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
<[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> >>> hex(-2*0x4000+0x40047a80)
>> __main__:1: FutureWarning: hex()/oct() of negative int will return a signed
>> string in Python 2.4
>> and up
>> '0xc0047a8
James Stroud said unto the world upon 2005-03-27 17:39:
Hello,
I have strings represented as a combination of an alphabet (AGCT) and a an
operator "/", that signifies degeneracy. I want to split these strings into
lists of lists, where the degeneracies are members of the same list and
non-degene
Ron Garret wrote:
I need to dynamically generate new types at run time. I can do this in
two ways. I can use the "type" constructor, or I can generate a "class"
statement as a string and feed that to the exec function. The former
technique is much cleaner all else being equal, but I want to b
No, I am on a Linux server. I am not sure how CGI is configured
because I do not control the server, I only use it.
bye,
Dimitri
On Sun, 27 Mar 2005 16:19:00 -0700, Doug Helm <[EMAIL PROTECTED]> wrote:
> Thanks, Dimitri. Yes, I found that same code too and tried it with the
> exact same result
Thanks, Dimitri. Yes, I found that same code too and tried it with the
exact same result as the code I've uploaded (just hangs). But, OK. You
have it working, so it must be a systems issue. Are you also on a Windows
IIS web server? Do you have CGI configured the same way (i.e. .py =
python.exe
[Ron Garret]
> Is it really impossible to specify __slots__ using the "type"
> constructor?
It does not work? I vaguely remember having needed to do this once or
twice, and it worked immediatly as expected. Unless I remember wrongly,
you only have to preset `__slots__' in the dict you give to `
In article <[EMAIL PROTECTED]>,
James Stroud <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have strings represented as a combination of an alphabet (AGCT) and a an
> operator "/", that signifies degeneracy. I want to split these strings into
> lists of lists, where the degeneracies are members of
On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud <[EMAIL PROTECTED]> wrote:
>Hello,
>
> I have strings represented as a combination of an alphabet (AGCT) and a an
> operator "/", that signifies degeneracy. I want to split these strings into
> lists of lists, where the degeneracies are members of
Using a parser may sound like overkill, but why not when it's this
easy? Get the latest pyparsing at http://pyparsing.sourceforge.net.
-- Paul
from pyparsing import oneOf, Group, OneOrMore, Literal
testdata = "ATT/GATA/G"
marker = oneOf( "A T G C")
SLASH = Literal("/").suppress()
genDegenList
Hello,
I have strings represented as a combination of an alphabet (AGCT) and a an
operator "/", that signifies degeneracy. I want to split these strings into
lists of lists, where the degeneracies are members of the same list and
non-degenerates are members of single item lists. An example will
Thanks, man! That was one fast reply...
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Jon Perez wrote:
>
>
>>Question:
>>
>>Is there a way to somehow put the output of 'print exc_obj' into
>>a string?
>
>
> There are ways to do even that, but maybe ``str(exc_obj)`` is enough for
> you
In <[EMAIL PROTECTED]>, Jon Perez wrote:
> Question:
>
> Is there a way to somehow put the output of 'print exc_obj' into
> a string?
There are ways to do even that, but maybe ``str(exc_obj)`` is enough for
your needs!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/l
There are objects whose repr() is not the same
as what gets printed out when you apply the
print statement to them. Usually these are
complex objects like exceptions.
Example:
>>> import smtplib
>>> server=smtplib.SMTP("smtp.yourisp.com")
>>> try:
server.sendmail("[EMAIL PROTECTED]",
Ron Garret wrote:
I need to dynamically generate new types at run time. I can do this in
two ways. I can use the "type" constructor, or I can generate a "class"
statement as a string and feed that to the exec function. The former
technique is much cleaner all else being equal, but I want to b
Maybe this helps:
http://www.voidspace.org.uk/python/cgi.shtml#upload
I use it, it works for fine me
Maybe it will give you some clues on how to tweak your own script.
Dimitri
On Sun, 27 Mar 2005 10:32:20 -0700, Doug Helm <[EMAIL PROTECTED]> wrote:
> Hey, Folks:
>
> I'm trying to write a very
Ron Garret wrote:
>
> I need to dynamically generate new types at run time. I can do this in
> two ways. I can use the "type" constructor, or I can generate a "class"
> statement as a string and feed that to the exec function. The former
> technique is much cleaner all else being equal, but I
Inspired by the PyCon tradition, the Brazilian Python Community
is organising a PyCon-like event called: PyConDayBrasil.
We have gathered 14 people to give speeches exclusively about
Python in an event that will take place in April 28th/29th.
The event's URL is below (only in Brazilian Por
Reinhold Birkenfeld wrote:
Jacob Lee wrote:
About slices:
I agree that Python's slice boundaries (some_list[a:b] being all elements
with a <= index < b) are counterintuitive at first. But this method does
satisfy some handy properties, the first of which being:
l[:n] + l[n:] = l
And best of all,
On 2005-03-27, Joal Heagney <[EMAIL PROTECTED]> wrote:
> Couldn't help myself. I had to write the Dragon Fractal in python.turtle
>:)
>
That's nice. I ported it to use the pygsear Turtle class.
http://www.nongnu.org/pygsear/
--- Dragon.py 2005-03-27 08:48:13.0 -0500
+++ pDragon.py 200
I need to dynamically generate new types at run time. I can do this in
two ways. I can use the "type" constructor, or I can generate a "class"
statement as a string and feed that to the exec function. The former
technique is much cleaner all else being equal, but I want to be able to
specif
Michele Simionato wrote:
FWIW, here is my take on the defaultdict approach:
def defaultdict(defaultfactory, dictclass=dict):
class defdict(dictclass):
def __getitem__(self, key):
try:
return super(defdict, self).__getitem__(key)
except KeyError:
Michele Simionato wrote:
I am surprised nobody suggested we put those two methods into a
separate module (say dictutils or even UserDict) as functions:
from dictutils import tally, listappend
tally(mydict, key)
listappend(mydict, key, value)
Sorry to join the discussion so late (I've been away from
don't count out py2exe, especially if your using pywin32's
--
http://mail.python.org/mailman/listinfo/python-list
I very much take your point. And thanks: that answers my syntax
question (I think!) -- *and* tells me that I don't care.
Charles Hartman
On Mar 27, 2005, at 2:16 PM, [EMAIL PROTECTED] wrote:
...
>>> simpler == complexities
True
>>>
I've not the glimmer of a clue which would be faster, and don't c
On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]>
wrote:
>I've hit a brick wall on something that I'm guessing is pretty simple but
>it's driving me nuts.
Yes, I've ran across that too a few times.
>How on earth can I make a complete seperate copy of a list with out it
>being a
I want to get the selection of several wxChoice boxes.
But i do not want to have to catch the events for all the boxes
I should be able to access the current selection outside of an
event,but i am not seeing how to do this.
This is a hack of the wxpython choice demo to demonstrate my question
#-
Heiko Wundram <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Why not try the following:
I did try it, and it didn't work either. It appears there must be
something wrong with my computer, hopefully something benign. Thanks
anyway.
Peace,
STM
--
http://mail.python.org/mailm
Brian van den Broek said unto the world upon 2005-03-27 14:12:
Charles Hartman said unto the world upon 2005-03-27 13:35:
On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote:
>>> def some_arbitrary_function(y):
... return ( (y * 42) - 19 ) % 12
...
>>> [some_arbitrary_function(len(x)) for x
+1
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Johan Hahn wrote:
Wouldn't it be nice if list.count, called without any arguments,
returned a dict with the list's unique items as keys and their
frequency of occurance as values?
No. It would require all sequences to support this protocol, which
would be tedious to implement. Some day, we may have
> See copy.deepcopy(). It will make sure that everything gets copied and
> nothing just referenced (more or less).
So far copy.deepcopy() seems to be working perfectly.
Thanks for the input
Nick
--
http://mail.python.org/mailman/listinfo/python-list
Charles Hartman said unto the world upon 2005-03-27 13:35:
On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote:
>>> def some_arbitrary_function(y):
... return ( (y * 42) - 19 ) % 12
...
>>> [some_arbitrary_function(len(x)) for x in lines.split()]
[5, 5, 11, 11, 5, 11, 5, 11]
>>>
I could be m
Giovanni Bajo wrote:
Terry Reedy wrote:
3) Sometimes the structure of the algorithm is not the structure
of the code as written, people who prefer that the indentation
reflects the structure of the algorithm instead of the structure
of the code, are forced to indent wrongly.
Do you have any sim
Mahesh wrote:
> Hi,
>
> One of my clients does not want the Python VM installed on his
> production machine (because it is not a supported IT language) so the
> only way I can program in Python and release the application to him is
> to make a standalone executable and deploy it. The last time I lo
On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote:
>>> def some_arbitrary_function(y):
... return ( (y * 42) - 19 ) % 12
...
>>> [some_arbitrary_function(len(x)) for x in lines.split()]
[5, 5, 11, 11, 5, 11, 5, 11]
>>>
I could be missing some edge cases, but it seems to me that if you
hav
Maurice LING wrote:
> That's almost like asking which way of cooking chicken is the best?
> steam, fried, stew, roast?
BBQ'ed of course.
I believe that fits your point. :)
Andrew
[EMAIL PROTECTED]
--
http://mail.python.org/mailma
On Fri, 25 Mar 2005 00:50:36 -0700, Jules Dubois
<[EMAIL PROTECTED]> wrote:
>On Wednesday 23 March 2005 22:03, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>(<[EMAIL PROTECTED]>) wrote:
>
>> Is there something out there like "Python for kids" which would explain
>> *basic* programming concepts in a way w
Charles Hartman said unto the world upon 2005-03-27 09:51:
I understand this toy example:
lines = "this is a group\nof lines of\nwords"
def getlength(w): return len(w)
s = map(getlength, [word for ln in lines.split() for word in
ln.splitlines()])
(now s is [4, 2, 1, 5, 2, 5, 2, 5])
My question i
Erwan VITIERE a écrit :
Hello,
I want to convert the contents of a string into name of variable.
For example:
var1="toto"
...
toto=5
print toto
exec "toto = 5"
print toto
But I would use another solution if possible.
--
http://mail.python.org/mailman/listinfo/python-list
Hey, Folks:
I'm trying to write a very simple file upload CGI. I'm on a Windows server.
I *am* using the -u switch to start Python for CGIs, as follows:
c:\python\python.exe -u %s %s
I *do* have write permissions on the directory I'm trying to write to. But,
when I click submit, it just hangs.
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
>>s t r i n g
>> ^ ^ ^ ^ ^ ^ ^
>> 0 1 2 3 4 5 6
>>
>> so that [1:2] is "t".
>
> Incidentally, the Python Tutorial tells us exactly the same...
Ah! I've just forgotten t
Hi,
One of my clients does not want the Python VM installed on his
production machine (because it is not a supported IT language) so the
only way I can program in Python and release the application to him is
to make a standalone executable and deploy it. The last time I looked
at something like th
Here is a short program that sets Tk's window icon on Linux. My window
manager is icewm, and it uses a scaled version of the "flagup" image
both at the upper-left corner of the window and on the task bar entry
for the window.
import Tkinter
app = Tkinter.Tk()
app.iconbitmap("@/usr/X11
Howdy,
I am having some problems woth sizers adding panels to a
scrolledwindow.
I have 3 classes (wx.Panels) which I want to add to a ScrolledWindow
(The Parent). I can get it to work except the ScrollWindow never
scrolls.
Also as I am new to (wx)Python, so I am sure it is a simple mistake.
But
"Nick L" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've hit a brick wall on something that I'm guessing is pretty simple but
> it's driving me nuts. I noticed that with python lists, generally when
> you
> make a copy of a list (ie, List1 = List2)
Python is not C, etc. Assi
In article <[EMAIL PROTECTED]>,
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> $ python -t test.py
> test.py: inconsistent use of tabs and spaces in indentation
> hello
> goodbye
On more question. When using py_compile from with a script, is there any
way to force the -t flag?
M
--
http://mail.
In article <[EMAIL PROTECTED]>,
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> "Mr. Magoo" wrote:
>
> > Can someone provide a snippet which, when run, generates a TabError?
> >
> > I can only seem to get SyntaxError and IndentationError.
>
> $ python -c "print repr(open('test.py').read())"
> 'if
Charles Hartman wrote:
> On Mar 27, 2005, at 11:50 AM, Nicolas Évrard wrote:
>
>>>
>>> I hope the question is clear enough. I have a feeling I'm ignoring a
>>> simple technique . . .
>>
>> lambda !
>>
>> map(lambda x: timestwo(getlength(x)), ...)
>
> Ah, lambda! I've heard so much bad-mouthing
Javier Bezos wrote:
> MetaFont explains this by saying that the index
> doesn't refer to a character but to a position
> between characters, which when traslated to Python
> would mean:
>
>s t r i n g
> ^ ^ ^ ^ ^ ^ ^
> 0 1 2 3 4 5 6
>
> so that [1:2] is "t
Jacob Lee wrote:
> About slices:
>
> I agree that Python's slice boundaries (some_list[a:b] being all elements
> with a <= index < b) are counterintuitive at first. But this method does
> satisfy some handy properties, the first of which being:
> l[:n] + l[n:] = l
And best of all, this is true
"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Terry Reedy wrote:
>
>>> 3) Sometimes the structure of the algorithm is not the structure
>>> of the code as written, people who prefer that the indentation
>>> reflects the structure of the algorithm instead of the
On Mar 27, 2005, at 11:50 AM, Nicolas Évrard wrote:
I hope the question is clear enough. I have a feeling I'm ignoring a
simple technique . . .
lambda !
map(lambda x: timestwo(getlength(x)), ...)
Ah, lambda! I've heard so much bad-mouthing of lambda that I forgot to
learn it . . . This is quite
Kent Johnson wrote:
>> Wikiquote is nice. I missed it because I googled for Mark Twain and parts of
>> the Churchill quote -- for that I'm now convinced it is as wikiquote gives
>> a slightly longer excerpt and the date and location of the speech (November
>> 11, 1947, in the House of Commons).
>
Jeff Epler wrote:
> Here is a short program that sets Tk's window icon on Linux. My window
> manager is icewm, and it uses a scaled version of the "flagup" image
> both at the upper-left corner of the window and on the task bar entry
> for the window.
>
> import Tkinter
> app = Tkinter.T
On 26 Mar 2005 22:51:14 -0800, [EMAIL PROTECTED] (Oren
Tirosh) wrote:
>Ron_Adam <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
>> Is there a way to hide global names from a function or class?
>>
>> I want to be sure that a function doesn't use any global variables by
>> mistake.
"Mr. Magoo" wrote:
> Can someone provide a snippet which, when run, generates a TabError?
>
> I can only seem to get SyntaxError and IndentationError.
$ python -c "print repr(open('test.py').read())"
'if 1:\n\tprint "hello"\nprint "goodbye"\n'
$ python test.py
hello
goodbye
$ python -t
When running with "-tt", you can get this error.
[EMAIL PROTECTED] src]$ python -tt
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exec "def f():\n\ta\nb"
Traceback
Tudo sobre hospedagem de sites , planos profissionais , economicos e
muitos outros , sua empresa na internet por apenas 2,99 ao mês!
http://www.hosting4u.com.br
hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem hospedagem
hospedagem hospedagem hospedagem
Can someone provide a snippet which, when run, generates a TabError?
I can only seem to get SyntaxError and IndentationError.
Thanks,
M
--
http://mail.python.org/mailman/listinfo/python-list
"Jacob Lee" <[EMAIL PROTECTED]> escribió en el mensaje
>> things which compesate that (another annoying point
>> of Python are slices -- mine are always off by 1).
>About slices:
Thank you, but I knew the motivations for this
odd behaviour, which can be found as well in, for
example, MetaFont.
Wouldn't it be nice if list.count, called without any arguments,
returned a dict with the list's unique items as keys and their
frequency of occurance as values?
>>> [1,2,1,'a'].count()
{'a': 1, 1: 2, 2: 1}
>>> 'hello world'.count()
{' ': 1, 'e': 1, 'd': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1}
* Charles Hartman [16:51 27/03/05 CEST]:
I understand this toy example:
lines = "this is a group\nof lines of\nwords"
def getlength(w): return len(w)
s = map(getlength, [word for ln in lines.split() for word in
ln.splitlines()])
(now s is [4, 2, 1, 5, 2, 5, 2, 5])
My question is whether there'
1 - 100 of 122 matches
Mail list logo