Le Fri, 12 Jun 2009 14:20:24 +0200,
"A.T.Hofkamp" s'exprima ainsi:
> spir wrote:
> > Hello,
> >
> > I have (again) some issue using __new__.
> > What I need is basically to catch an object creation and yield an object
> > of an alternate type,
Le Fri, 12 Jun 2009 22:37:17 +1000,
Lie Ryan s'exprima ainsi:
> spir wrote:
> > Hello,
> >
> > I have (again) some issue using __new__.
> > What I need is basically to catch an object creation and yield an object
> > of an alternate type, when a condition i
Le Fri, 12 Jun 2009 22:37:17 +1000,
Lie Ryan s'exprima ainsi:
> >>> class Normal(object):
> ... def __new__(cls, arg):
> ... if arg:
> ... return Special(arg)
> ... else:
> ... ret = super(Normal, cls).__new__(cls)
> ... ret.__init__(arg)
Le Fri, 12 Jun 2009 09:05:35 -0400,
Kent Johnson s'exprima ainsi:
> On Fri, Jun 12, 2009 at 8:37 AM, Lie Ryan wrote:
> class Normal(object):
> > ... def __new__(cls, arg):
> > ... if arg:
> > ... return Special(arg)
> > ... else:
> > ... ret = supe
Le Sat, 13 Jun 2009 09:20:36 +0100,
"Alan Gauld" s'exprima ainsi:
> Any time you have a class that just has an __init__ it means
> its not doing anything. And that's a bad sign. Classes are there
> to *do* things not just store data. We can use a tuple or
> dictionary to do that.
While this i
Le Sat, 13 Jun 2009 13:55:58 +0100,
"Alan Gauld" s'exprima ainsi:
> I think that you have a valid point but that "pure value" objects
> occur far less often than you might think. I always treat a value
> object as a sign that I've probably put some processing code
> in the wrong place! Only wh
Hello,
a question for people who know how to write MANIFEST.in:
How to tell to simply include all files in the package (and subdirs)? I tried:
recursive-include *.*
==> warning: sdist: MANIFEST.in, line 1: 'recursive-include' expects
...
recursive-include . *.*
==> warning: no files found ma
No one has a clue about this?
Le Tue, 16 Jun 2009 22:59:24 +0200,
spir s'exprima ainsi:
> Hello,
>
> a question for people who know how to write MANIFEST.in:
> How to tell to simply include all files in the package (and subdirs)? I
> tried:
>
> recursive-includ
Le Wed, 17 Jun 2009 12:51:09 -0500,
Chris Fuller s'exprima ainsi:
>
> Use os.path.walk or similar to build the file before you call setup().
>
> Cheers
Thanks, that's what I thought I would end up doing...
Denis
--
la vita e estrany
___
Tutor ma
Hello,
when trying to create an archive with
python setup.py sdist --formats=gztar,zip
all works fine (archives are created) except temp dir deletion. Program blocks
on
removing 'foobar-1.0' (and everything under it)
Actually, don't know how to check further for don't where this temp di
Solved -- actually it was an error of mine in a wrapping subprocess.Popen()
call.
Le Fri, 19 Jun 2009 10:58:02 +0200,
spir s'exprima ainsi:
> Hello,
>
> when trying to create an archive with
>
>python setup.py sdist --formats=gztar,zip
>
> all works fine (ar
[back to the list after a rather long break]
Hello,
I stepped on a unicode issue ;-) (one more)
Below an illustration:
===
class U(unicode):
def __str__(self):
return self
# if you can't properly see the string below,
# 128
¶ÿµ ¶ÿµ ¶ÿµ
¶ÿµ ¶ÿ
Le Fri, 30 Oct 2009 18:39:42 -0400,
Robert Lummis s'exprima ainsi:
> I want to move some functions from my "main" program file to a module
> file because the main file is getting too big for convenience. The
> functions access arrays (lists of lists) that are defined and
> initialised in the main
Le Sun, 01 Nov 2009 20:34:56 -0500,
Dave Angel s'exprima ainsi:
> And from what you said earlier, you WILL need function objects, probably
> as parameters to the Simulation constructor. So each instance of
> Simulation will be given several function objects to specify the
> distribution funct
Hello,
as I was crawling in endless complications with unadequate ranges, I decided to
create a "PolyRange" type able to hold arbitrary many "sub-range"; which means
finally a big range with wholes in it. This whole stuff again to cope with
unicode -- a poly-range would be able to hold a range
Hello,
I jump on the opportunity offered by the previous thread to tell a little story
(serious only people disgard). Guess this is a candidate for Bug of the Year.
I was filtering (parse) results to keep only nodes from a given set of types:
for child in node:
if child.pattern in item_type
Le Sat, 7 Nov 2009 14:06:15 -,
"Alan Gauld" s'exprima ainsi:
> "C.T. Matsumoto" wrote
>
> > class Foo: # the book says this is a class header
> >pass
>
> Hmm, that's pretty dubious usage of header in my view.
> Its the class definition and there is nothing "header" about it.
Engli
Le Fri, 13 Nov 2009 17:58:30 +,
Stephen Nelson-Smith s'exprima ainsi:
> I think I'm having a major understanding failure.
>
> So having discovered that my Unix sort breaks on the last day of the
> month, I've gone ahead and implemented a per log search, using heapq.
>
> I've tested it with
Le Sat, 14 Nov 2009 10:43:47 -0700,
Modulok s'exprima ainsi:
> List,
>
> This is kind off topic, but:
>
> Does anyone else find, writing code while tired to be counterproductive?
>
> It just seems like when I push myself to stay up late finishing a
> project, I sorely regret it the following d
Le Sat, 14 Nov 2009 20:49:52 +,
Stephen Nelson-Smith s'exprima ainsi:
> My brother in law is learning python. He's downloaded 3.1 for
> Windows, and is having a play. It's already confused him that print
> "hello world" gives a syntax error
>
> He's an absolute beginner with no program
Le Sun, 15 Nov 2009 09:11:16 +0530,
Shashwat Anand s'exprima ainsi:
> > No, I'm trying to find all integer co-ordinates which lies on a circle.
> Say for a circle of radius 5 the co-ordinates are [(5, 0), (0, 5), (-5, 0),
> (0, -5), (3, 4), (4,3), (3, -4), (4, -3), (-3,
> 4), (-4, 3), (-3, -4),
Le Sun, 15 Nov 2009 19:23:33 -,
"Alan Gauld" s'exprima ainsi:
> What does 'unpack' mean? I've seen a few Python errors about packing
> and unpacking. What does it mean?
Unpacking is rarely needed. It matches some kind of problems.
Imagine you parse "codes" each made of name-sep-number. T
Le Mon, 16 Nov 2009 13:54:26 -0700,
Modulok stated:
> List,
>
> A general question:
>
> How many of you guys use unit testing as a development model, or at
> all for that matter?
I do. Systematically. Has become a reflex.
I would rather ask the opposite question: how do know a part of your co
Le Tue, 17 Nov 2009 08:01:32 -,
"Alan Gauld" stated:
Hello, Alan,
> The real benefits of unit tests are:
> a) You test stuff as you write it so you know where the bug must lie
Yes! (tried to say the same much clearly ;-)
> b) You can go back and run the tests again 6 months later,
> c) if
Le Tue, 17 Nov 2009 09:56:23 +0100,
spir stated:
> > b) You can go back and run the tests again 6 months later,
> > c) if you have to add a new test its easy to make sure you don't break
> > what used to work (regression testing).
>
> Do not understand this
"Ken G." wrote:
> I have not use the DBMS as I am unaware of them in both languages.
DBMS is short for Data Base Management System, see wikipedia entry on the topic.
Actually, the term is a bit ambiguous:
* From a user point of view, a BDMS will be an application allowing managing
data sets
Serdar Tumgoren wrote:
> Lie and Kent,
>
> Thanks for the quick replies.
>
> I've started writing some "requirements", and combined with your
> advice, am starting to feel a bit more confident on how to approach
> this project.
>
> Below is an excerpt of my requirements -- basically what I've
Hello,
1) encoding guess
>From the library manual:
file.encoding
The encoding that this file uses. When Unicode strings are written to a
file, they will be converted to byte strings using this encoding. In addition,
when the file is connected to a terminal, the attribute gives the encoding t
Albert-Jan Roskam wrote:
> # CODE:
> for element in doc.getiterator():
> try:
> m = re.match(search_text, str(element.text))
> except UnicodeEncodeError:
> raise # I want to get rid of this exception.
First, you should separate both actions done in a single statement to isolate
the
Serdar Tumgoren wrote:
> And the more I hear from you folks, the more I start thinking that my
> confusion arose because I don't have a formal set of requirements and
> therefore have to wear multiple hats
I think a base confusion was between your app's own job (validation), on one
hand, and te
Hello,
How does python get the time in microseconds? (In other words, how would I get
it if python (like some other languages) would provide time in whole seconds
only?)
Thank you,
Denis
la vita e estrany
http://spir.wikidot.com/
Lie Ryan wrote:
> > funnychars = u"éèêëóòôöáàâäÉÈÊËÓÒÔÖÁÀÂÄ"
> > asciichars = ""
> >
In addition to Lie's reply, you will very probably need diacritic-free chars to
be unicode, too. Otherwise prepare for later UnocideEn/De-codeError-s. As a
rule of thumb, if you work wi
Kent Johnson wrote:
> On Wed, Nov 25, 2009 at 11:11 AM, spir wrote:
> > Hello,
> >
> > How does python get the time in microseconds? (In other words, how would I
> > get it if python (like some other languages) would provide time in whole
> > seconds only?)
&g
Garrett Hartshaw wrote:
> The program I am writing gives the following error message when run.
>
> Traceback (most recent call last):
> File "./space.py", line 177, in
> main()
> File "./space.py", line 173, in main
> player = Ship("space/models/fighter.3ds",
> "space/models/realist
"Alan Gauld" wrote:
Thank you, Alan.
> "spir" wrote
>
> > So, python uses C's gettimeofday() func when available
>
> It's not C's function, it's a Unix system call.
> It's been part of Unix since BSD 4.2
>
> > ft
Lie Ryan dixit:
> > - functions should return one value (im not 100% of this one)
>
> I 100% disagree or with this one.
Could you explain this bit, Lie? I'm very interested.
I use multiple-value result myself, for it's so practicle in given cases. But
it makes me uneasy; also have the impres
Hello,
Below startup definitions:
x = 1
def f():
n = 1
def g0(a):
print (x + n + a)
return g0
I'm surprised the snippet below works as expected (py 2.6) without any trick:
g = f()
g(1)# --> 3
This means a (real) closure is built for g0, or what?
Thought I would need instead to
ALAN GAULD dixit:
> But as I said earlier the concept of multiple return
> values in Python is similar to returning a struct in C.
> The key thing is that the function has a single purpose
> so if returning multiple values or a struct the values
> within that group should be related to the sin
biboy mendz dixit:
> http://pastebin.ca/1693849
>
> This is end-of-chapter3 exercise of the book Core Python Programming.
>
> I'm reading/searching in the book and other materials but is
> unsuccessful. There are at least 50 exceptions listed but I can't find
> anything close.
>
> I commente
Hello Eike!
Eike Welk dixit:
> Hello Spir!
>
> On Monday 30 November 2009, spir wrote:
> > which seems to indicate python really embeds "symbolic references"
> > (*) to outer *variables*, when creating a closure for g0. Not
> > "pointer references&q
ecent call last):
> > File "", line 1, in
> > f()
> > File "", line 2, in f
> > x = x + 1
> > UnboundLocalError: local variable 'x' referenced before assignment
> Ah... what a pity I didn't try this. I used similar c
biboy mendz dixit:
>
>
> spir wrote:
> >
> > What is your question?
> > If it's about the type of exception raised when os.path.exists fails, well,
> > sure it's hard to find:
> >
> > print os.path.exists("foo".bar)
>
bibi midi dixit:
> Like i thought so, there is no exception to catch if a file already exist.
> I've been browsing the many types of exceptions and cant find anything thats
> close. Thank you for clarifying.
>
Actually, you can. I guess it's not the book author's intent, but you can try
it for
Dave Angel dixit:
> Maybe a more complex example might show the various linkages.
>
> glob = 42
>
> def outer(parm1):
> free = 12
> free3 = 19
> def inner(parm2, parm3=free3):
> print "global", glob, ", free vars", parm1, free, free3, ",
> locals", parm2, parm3
> free =
May I suggest that upvalues are analog to parameters passed by name? (which is
indeed not Python's paradigm)
Denis
la vita e estrany
http://spir.wikidot.com/
___
Tutor maillist - Tutor@python.org
To unsubscribe or c
Albert Sweigart dixit:
> You need to specify an ordering function, in your case, len():
By the way, is there any reason why the compare func parameter is called 'key'?
Denis
la vita e estrany
http://spir.wikidot.com/
_
Prasad Mehendale dixit:
> I am a beginner. I want to save the output data of the following programme in
> a file through the programme. Please suggest me the way. I am using Python
> 2.3.3 on mandrake linux 10 and using "Idle" to save the output to a file
> presently.
> Thanks in advance.
Yo
Lie Ryan dixit:
> note that:
> >>> [(y, x) for y in list("khalid") for x in range(6)]
> [('k', 0), ('k', 1), ('k', 2), ('k', 3), ('k', 4), ('k', 5), ('h', 0),
> ('h', 1), ('h', 2), ('h', 3), ('h', 4), ('h', 5), ('a', 0), ('a', 1),
> ('a', 2), ('a', 3), ('a', 4), ('a', 5), ('l', 0), ('l', 1),
Hugo Arts dixit:
> bc = {y: x for x, y in enumerate("khalid")}
>
> Note that your output is like so:
> {'a': 2, 'd': 5, 'i': 4, 'h': 1, 'k': 0, 'l': 3}
>
> The first character in your original string gets a zero, the second a
> one, so on and so forth. I'm hoping that's what you meant. If you
>
Dave Kuhlman dixit:
> On Fri, Dec 04, 2009 at 01:13:42PM +0530, Prasad Mehendale wrote:
> > I am a beginner. I want to save the output data of the following programme
> > in
> > a file through the programme. Please suggest me the way. I am using Python
> > 2.3.3 on mandrake linux 10 and using
Christopher schueler dixit:
>
> My name is Chris Schueler and i am having some troubles with my Python
> programming
>
>
>
> Our current project is to create the game of cribbage from scratch.
>
> The only problem is we are not allowed to use classes, only user-defind
> functions and arra
Luke Paireepinart dixit:
> I'd say my personal hard-limit for functions before I start refactoring is
> probably around 150-200 lines. But it's rare that functions get that long
> anyway.
!
Aside questions of personal style & taste, _I_ could not hold such long funcs.
Far too much to manage f
Lie Ryan dixit:
> On 12/8/2009 9:39 PM, Dave Angel wrote:
> > Richard Hultgren wrote:
> >> a = 0
> >> b = 1
> >> count = 0
> >> max_count = 20
> >> while count < max_count:
> >> count = count + 1
> >> # we need to keep track of a since we change it
> >> old_a = a # especially here
> >> old_b = b
Roy Hinkelman dixit:
> I can't find anything on this error I am getting when renaming some files.
> I'm pulling info from a csv file and parsing it to build new file names.
>
> Any pointers appreciated
>
> Roy
>
> My code:
> # RENAME FILES using META file - new name = [place]_[state]_[sku].tif
Roy Hinkelman dixit:
> Why don't you simply print out fname? This should point you to the error.
>
> Denis
>
>
> I did here:
> > if fname == old_name:
> > print fname # test
>
> and it looks correct.
>
> On an WinXP, should I use shutil instead?
>
> Roy
Sorry Roy, I rea
Serdar Tumgoren dixit:
> Hi everyone,
> I'm trying to apply some lessons from the recent list discussions on
> unit testing and Test-Driven Development, but I seem to have hit a
> sticking point.
>
> As part of my program, I'm planning to create objects that perform
> some initial data clean-up
"Alan Gauld" dixit:
>
> "Khalid Al-Ghamdi" wrote
>
> > I wan't to buy some books about python 3. Do you have any
> > recommendations?
>
> There are very few Python 3 books out there.
> The only one I've used and can recommend is Programming in Python3 by
> Summerfield
>
> Other general Pyt
Serdar Tumgoren dixit:
> I'll admit, I learned the hard way on a project earlier this year. I
> got that project done (again with the help of folks on this list), but
> didn't do any test-writing up front. And now, as the inevitable bugs
> crop up, I'm forced to patch them hoping that I don't bre
Wayne Werner dixit:
> On Wed, Dec 9, 2009 at 6:15 PM, Alan Gauld wrote:
>
> >
> > Remember, in testing you are not trying to prove it works but rather to
> > demonstrate that it doesn't!
> >
>
> So in that way it's a bit like the the scientific method (or exactly like)?
> You create a hypothesi
"Roshan S" dixit:
> class Student:
> print"We have a new student "
> def __init__(self,name='',credit=0,grade=0,quality=0):
> self.name=name
> self.credit=credit
> self.grade=grade
> self.quality=quality
>
>
> def inputstudent(self):
>
Serdar Tumgoren dixit:
> > I often use a list of test cases to drive a single test. Using a
> > series of tests is just too painful compared to making a simple list
> > of test cases.
>
> I kinda suspected that but wasn't sure. These tests are for a REALLY
> basic regex and I was having nightmar
Hugo Arts dixit:
> The function will give you the exact value of any
> floating point number stored in memory.
To be even clearer: Seems you messed up "the exact value of any floating point
number stored in memory" with "an accurate value (= the intended value)".
_
Michael Morrissey dixit:
> I'm just a philosophy teacher, and I don't know much about mathematics or
> computers. I'm writing a python program (not the best language for this
> topic, but it is what I know), and I need to solve a problem which requires
> more knowledge than I have. I'm hoping you
Serdar Tumgoren dixit:
> > Thank you - can you please assume that the data provided is the following:
> >
> > Columns 1 - 4 = Name (in record 1 of example = "John")
> > Column 5 = Answer1 (in record 1 of example = "9")
> > Column 6 = Answer2 (in record 1 of example = "8")
> > Column 7 = AreaCode
Emad Nawfal (عمـ نوفل ـاد) dixit:
> Dear Tutors,
> The purpose of this script is to see how many vocalized forms map to a
> single consonantal form. For example, the form "fn" could be fan, fin, fun.
>
> The input is a large list (taken from a file) that has ordinary words. The
> script creates
MK dixit:
> First function the ip is splitted as i did it. Alright.
> The use 256 as it is the maximum for any digit. ok.
> But what is that ** and exp meaning
>
> --
> def ip_to_int(dotted_ip):
> exp = 3
> intip = 0
>
Special offer for coders coding on Christmas day!
I'm looking for the simplest way to decode/encode unicode ordinals (called
'codes' below) to/from utf8. Find this rather tricky, esp because of variable
number of meaningful bits in first octet. Specifically, for encoding, is there
a way to avoi
OK, I'll answer myself ;-)
Found needed information at http://www1.tip.nl/~t876506/utf8tbl.html
See below new version,
Denis
la vita e estrany
http://spir.wikidot.com/
=
# coding: utf8
import sys ; end = sys.exit
# constant
max_co
Lie Ryan dixit:
> class Error(Exception):
> def __init__(self, value):
> self.value = value
> def printer(self, value):
> print self.value
You can also use __str__ instead of printer. This will give a standard output
form for your error automatically used by print and
MK dixit:
> At first, happy new year to all of you.
>
> I am trying to write a little script which uses one file
> as input and looks if the string from this file are in target file. And
> if not prints out that line/string so that i know which strings must
> be added to complete the target file.
Robert Berman dixit:
> Hi,
>
> I am trying to build an algorithm or methodology which will let me tell
> if a decimal has a repeating sequence of digits and if it does have that
> attribute, what is the sequence of digits. For example, 1/3.0 =
> 0.3..By eyeballing we know it has a repeati
Shashwat Anand dixit:
> @Alan, @Lie thanks
> The approach which I am taking right now is taking some test-cases, and
> creating rules for them. Later on after expanding the cases there aroused
> some cases which didn't followed earlier pattern so I tweaked some rules so
> as to match all of them.
Hello,
Just found something rather misleading with negative indices:
s = [1,2,3,4,5,6,7,8,9]
print s, s[-3], s[-4] # [1, 2, 3, 4, 5, 6, 7, 8, 9] 7 6
s.insert(-3, 0)
print s, s[-3], s[-4] # [1, 2, 3, 4, 5, 6, 0, 7, 8, 9] 7 0
So, I did insert 0 at index -3, but s[-3] is still 7, & 0 is in fact
galaxywatc...@gmail.com dixit:
> I often
> wish that I had a private tutor or a Python guru that I could just ask
> how to get past a certain wall. Perhaps this list has that person or
> people on it.
The list as a whole certainly _can_ be this, & more ;-)
(depends on how _you_ deal with i
Garry Bettle dixit:
[...series of data with same format...]
> 2010-01-07 1437 Crayfd H3 380m
> ... etc.
>
> The above are RaceDate + RaceTime + Fixture + RaceDetails, and are
> output in RaceTime order.
>
> What I'd like to do, is output a transposed-like summary of just the
> Fixture + RaceTime
Garry Bettle dixit:
> for fixture in FixtureList:
> print fixture.ljust(6), FixtureList[fixture]
...
> for fixture, racetimes in FixtureList:
> print fixture, racetimes
>
> Traceback (most recent call last):
> File "", line 1, in
> for fixture, racetimes in FixtureList:
> ValueErro
Lowell Tackett dixit:
> An odd aside, however--I went into the Tutor Archives forum and pulled up the
> Page Source (HTML formatting template) and lo and behold all my paragraphs
> were correctly formatted (i.e. page-wrapped just as they had been when they
> left my mail notepad) and displayed
galaxywatc...@gmail.com dixit:
> I wrote a simple Python script to process a text file, but I had to
> run a shell one liner to get the text file primed for the script. I
> would much rather have the Python script handle the whole task without
> any pre-processing at all. I will show 1) a sm
Lie Ryan dixit:
> only use "from module import *" if the
> module was designed for such use
In most cases, this translates to: the imported module defines __names__, which
holds the list of names (of the objects) to be exported. Check it.
Below, a,b,c,f,g,X,Y are defined, but only c,g,Y are ex
Richard D. Moores dixit:
> I'm working on a function that seems to cry out for some of its code
> to be put in a function. For convenience sake, I've put this new
> function inside the one that calls it.
>
> Question 1: Is this bad practice? It works fine that way, but..
>
> Question 2: If the a
Hello,
New to the list. I'm a self-taught, amateur programmer. Also, non-native
english speaker -- so, don't be surprised with weird expression.
Q: Is there a way to write /type/ (class) functions, meaning methods not
bound to an instance, in python?
Context: I'm developping an application
[forwarded, only A.T.Hofkamp got this answer]
A.T.Hofkamp a écrit :
spir wrote:
Q: Is there a way to write /type/ (class) functions, meaning methods
not bound to an instance, in python?
As Bob Gailer already said, staticmethod seems to do what you want.
Thank you for you answers about
Hello again,
I just tried with the classmethod() built_in function. Well, this is
exactly what I was looking for. It supplies a way of defining type_level
methods -- what was missing before.
[I still think this is a workaround: we would not need this if the
syntax was the same for methods and
Hello,
I have read tons of reviews of editors for python. But they seem to be
all biased, meaning that what the author finds important is well
documented while the rest not at all.
I'm looking for something like a simple table showing main features for
all editors or IDEs. Do you know of anyt
[EMAIL PROTECTED] a écrit:
Hello again,
Thanks for the replies on my previous post, but I have a different
problem now and don't see how to deal with it in a smooth way.
I have two csv files where:
1.csv
"1", "text", "aa"
"2", "text2", "something else"
"3", "text3", "som
Thank you for this relevant & precise review, Albert. I will answer
specific topic, then give a overall introduction of the problem(s)
adressed by this project, that may clarify a bit some topics.
A.T.Hofkamp a écrit :
> However, by moving the 'type' information to a seperate object, your
[EMAIL PROTECTED] a écrit :
Dear Friends,
I have just started learning python programming. I have no previous
programming knowledge.
Welcome! I'm an amateur, too. Some words to add to Kent's answer.
I am presently using Python 2.6 windows version.
I am struggling with how to enable executable f
Sander Sweers a écrit :
Hi,
What is the better way to process data in a list? Make the changes in
place, for example
somelist = [1,2,3,4]
for x in range(len(somelist)):
somelist[x] = somelist[x] + 1
Or would making a new list like
somelist = [1,2,3,4]
newlist = []
for x in somelist:
Sander Sweers a écrit :
On Sun, Nov 2, 2008 at 13:32, Kent Johnson <[EMAIL PROTECTED]> wrote:
Use a list comprehension:
somelist = [ x+1 for x in somelist ]
Got it.
Note that this creates a new list, replacing the one that was in
somelist. If you need to actually modify somelist in place (ra
Excuse me for such a stupid question, I just wish to stop and lose my time
searching for something that maybe simply does not exist.
I'm looking for the builtin function for sequences that would return a list of
(index,item) pairs to be used in loops. analog to dict's items() function.
[I was wri
I have just read the following article:
http://effbot.org/zone/python-objects.htm
(thanks to a link on Kent's site). It is very good, I really recommend it.
Still, a short passage has troubled my model about object names:
"The names are a bit different — they’re not really properties of the obje
Hello,
I'm learning to use parsers: trying pyParsing, construct and simpleparse to
have a better overview. I know a bit regular expressions and rather used to
BNF-like formats such as used for specification of languages. But I have never
really employed them personly, so the following may be t
Paul McGuire a écrit :
> Question 1:
> format_code:= '+' | '-' | '*' | '#'
> I need to specify that a single, identical, format_code code may be
> repeated.
> Not that a there may be several one on a sequence.
> format := (format_code)+
> would catch '+-', which is wrong. I wan
[EMAIL PROTECTED] a écrit :
Hello tutors,
I'm trying to generate a plot using gnuplot from within a python gui. In
Windows, if after the plot is drawn I use a raw_input string demanding a
'RETURN' be hit, the plot will persist on the screen until the 'RETURN' is
pressed. In *nix, one can use
Hello pyhonistas,
Example:
=== module content ===
a = 1
b = 2
==
I'm looking for a way to get something like {'a':a, b':2}. Actually, names
defind in the module will be instances of a custom type. I want to give them an
attribute that holds their own name. E.g.:
for key,ob
(forwarded to the list)
Hello pyhonistas,
Example:
=== module content ===
a = 1
b = 2
==
I'm looking for a way to get something like {'a':a, b':2}. Actually,
names defind in the module will be instances of a custom type. I want to
give them an attribute that holds their own
ppend(5)
x = gd.pop()
gd.store_strings(["string","data"])
gd.store_string("i'm relevant info")
print gd, gd.strings
print "average: %2.2f ; removed: %i" %(gd.average(), x)
==>
[1, 2, 3, 4] ['string', 'data', "i'm relevant i
You may have a look at easygui. Probably not for final release, rather for
design stage. It's based on tkinter I guess. I found it very helpful as long as
the app does not require sophisticated widgets and there is a proper separation
of process and UI. Once everything works, it is fast enough t
Below an illustration of what troubles me a bit.
denis
class Seq(list):
''' specialized sequence type with improved str
Override list's behaviour that list.__str__
calls __repr__ instead of __str__ on items.
???
'''
def __str__(self):
text = str(self[0])
for item in self[1:]:
if isinstance(item, list):
item = Seq(item)
# will now call str on nested Seqs
text += " ,%s" %item
ret
201 - 300 of 627 matches
Mail list logo