I just tried it in Python 3 (both at the interactive prompt and in idle)
and both places I get:
>>> "food is very nice" #lets eat
'food is very nice'
>>>
So it looks like it *should* work. You might copy and paste exactly what
you get into a post, including the full error traceso that we can s
"jims" wrote
I apologize for asking such a dumb question
The only dumb questions are the ones you don;t ask.
Its how to learn!
Simply put here is where I am stuck. (Python version 3.0)
I type in the example using the comment command:
(example) *>>> "food is very nice" #lets eat
The >>
At the >>> prompt (which is the interactive) interpreter, try:
print('food is very nice') #lets eat
On Fri, Jan 30, 2009 at 5:45 PM, jims wrote:
> I apologize for asking such a dumb question but I have no prior programming
> experience and am trying to learn by following examples from a book.
I apologize for asking such a dumb question but I have no prior
programming experience and am trying to learn by following examples from
a book. And also from the web.
Simply put here is where I am stuck. (Python version 3.0)
I type in the example using the comment command:
(example) *>>> "f
Title: Signature.html
That's plenty of food for thought. Thanks to all. I'll see if I can
absorb it in the next 36 hours. After that, I'll be out of town for 3
days.
Kent Johnson wrote:
On Fri, Jan 30, 2009 at 8:57 AM, A.T.Hofkamp wrote:
Kent Johnson wrote:
Anoth
"Eike Welk" wrote
In a rather consistent approach, Python does not provide any
standard way to simply define/describe/structure an object -- or a
class.
The added flexibility of Python gives great powers to the
programmers
of libraries.
It goves a lot of flexibility, whether that really is
> Python 2.x can add new methods to a user-defined class or instance or
> redefine existing methods.
> In [6]: def sayFoo(self): print 'foo'
>
> In [7]: Data.sayFoo = sayFoo
>
> In [8]: d1.sayFoo()
> foo
>
Now for some reason I was sure that didn't work. So sure I never even tried!
(despite
Hello Spir!
On Friday 30 January 2009, spir wrote:
> In a rather consistent approach, Python does not provide any
> standard way to simply define/describe/structure an object -- or a
> class.
The added flexibility of Python gives great powers to the programmers
of libraries.
There is for examp
On Fri, Jan 30, 2009 at 3:50 PM, Alan Gauld wrote:
> "spir" wrote
>
>> I was not thinking at data hiding or protection, rather at object
>> structure
>> (or behaviour) specification. First, to the human -- and alse to the
>> machine.
>
> Ah, OK, then in that case I am happier to agree that Python
"spir" wrote
I was not thinking at data hiding or protection, rather at object
structure
(or behaviour) specification. First, to the human -- and alse to the
machine.
Ah, OK, then in that case I am happier to agree that Python is unusual
(although not unique - Lisp can do the same) in its ab
Le Fri, 30 Jan 2009 19:05:40 -,
"Alan Gauld" a écrit :
> "spir" wrote
>
> > There is no real native support for ordinary OOP in python, meaning
> > as is done in most other languages, or according to the theory.
>
> I have to disagree. I think you are confusing OOP with C++ and Java.
> The
"spir" wrote
There is no real native support for ordinary OOP in python, meaning
as is done in most other languages, or according to the theory.
I have to disagree. I think you are confusing OOP with C++ and Java.
The early OOP languages had a variety of approaches to this. Several
took the s
"David" wrote
def main():
x = 3
f(x)
def f(whatever):
print whatever
main()
I am not quite sure what is going on here. Could you please correct
my line of thought?
As others have said you are pretty much correct apart from some
terminology.
However one of the insanely great
David wrote:
Dear List,
the following comes from Harrington's "Hands-on Python" (section
1.11.8): http://www.cs.luc.edu/~anh/python/hands-on/
'''Avoiding any error by passing a parameter'''
def main():
x = 3
f(x)
def f(whatever):
print whatever
main()
I am not quite sure
Lie Ryan wrote:
[snip]
AFAIK no CPU implements hardware logical operation).
I disagree. But perhaps logical operation means different things to you.
Please expand.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.o
Le Sat, 31 Jan 2009 00:30:18 +0800,
David a écrit :
> Dear List,
>
> the following comes from Harrington's "Hands-on Python" (section
> 1.11.8): http://www.cs.luc.edu/~anh/python/hands-on/
>
>
>
>
> '''Avoiding any error by passing a parameter'''
>
> def main():
> x = 3
> f(x)
>
Dear List,
the following comes from Harrington's "Hands-on Python" (section
1.11.8): http://www.cs.luc.edu/~anh/python/hands-on/
'''Avoiding any error by passing a parameter'''
def main():
x = 3
f(x)
def f(whatever):
print whatever
main()
I am not quite sure what is going
On Fri, Jan 30, 2009 at 8:57 AM, A.T.Hofkamp wrote:
> Kent Johnson wrote:
>>
>> Another way is to use a .ini file. The ConfigParser module can read
>> ini files but not write them.
>> http://docs.python.org/library/configparser.html
>
> What do you mean 'not write them'?
>
>
> from the Python docs
Le Fri, 30 Jan 2009 14:17:34 +0100,
Willi Richert a écrit :
> Hi,
>
> I have often found that just initializing all the necessary stuff in one
> Configuration.py module. You just import it and it works.
I support this as it's far the most straightforward way!
Now, depending on the actual use,
Kent Johnson wrote:
Another way is to use a .ini file. The ConfigParser module can read
ini files but not write them.
http://docs.python.org/library/configparser.html
What do you mean 'not write them'?
from the Python docs:
RawConfigParser.write(fileobject)
Write a representation of the
Hi,
I have often found that just initializing all the necessary stuff in one
Configuration.py module. You just import it and it works.
If you like the Windows .ini format, ConfigParser is your friend
(http://docs.python.org/library/configparser.html).
Regards,
wr
On Freitag, 30. Januar 2009 1
Hi,
you make it non-greedy with "?":
import re
text="axa axa"
greedy_x, greedy_y = re.match("a.*a", text).span()
print text[greedy_x:greedy_y]
non_greedy_x, non_greedy_y = re.match("a.*?a", text).span()
print text[non_greedy_x:non_greedy_y]
Will print out:
axa axa
axa
Regards,
wr
On Freitag,
On Fri, Jan 30, 2009 at 7:40 AM, Wayne Watson
wrote:
> I'm about to provide a config file for an application I've been working
> with.
> I suspect there may be a standard way of doing this in Python that relies on
> more complex operations that simplify matters than just reading the file one
> li
Wayne Watson wrote:
mask file: c:\operation/horizon.jpg
latitutde: -140.22
longitude 38.22
start time: 18:25:00
stop time: 06:30:00
event directory: d:\events_2009
grey scale: yes
autoexpose format: gif
I suspect there may be a standard way of doing this in Python that relies on
more complex o
spir wrote:
Hello,
imagine you need to match such a pattern:
pat : (@@ [charset]* @@) | [charset]*
... where [charset] has to include '@'
My questions are:
* Is there any other way than using a non-greedy form of [charset]* ?
Something like this?
(in pseudo-RE syntax)
"(@@" ( [...@]* "@" [.
Title: Signature.html
I'm about to provide a config file for an application I've been working
with. One can set a number of values via the GUI during the use of the
program only to see the settings disappear when restarted. Fortunately,
most of the time the program runs for days. Nevertheless,
On Fri, Jan 30, 2009 at 12:43, Kent Johnson wrote:
>
> A note on terminology: In Python, what you are describing is called an
> attribute. 'property' has a very specific meaning, it is a way to
> associate a value with an instance that uses attribute notation for
> access, i.e. a.b, but actually
Le Fri, 30 Jan 2009 12:22:10 +0100,
Vicent a écrit :
> Thanks to all for your clear answers. I learned a lot about the way Python
> manages properties or attributes.
>
> In my particular case, I think, as Spir said, that the best implementation
> depends on wether I am going to update the "base"
Hello,
imagine you need to match such a pattern:
pat : (@@ [charset]* @@) | [charset]*
... where [charset] has to include '@'
My questions are:
* Is there any other way than using a non-greedy form of [charset]* ?
* How, actually, is non-greedy character string matching performed?
Thank you,
de
On Thu, Jan 29, 2009 at 1:59 PM, Vicent wrote:
> This is an easy question, I guess, but I am not able to find out the answer.
>
> In fact, it is both a Python question and a general programming "style"
> question.
>
> I want to define a class that contains a list (or a NumPy array) of elements
> o
Thanks to all for your clear answers. I learned a lot about the way Python
manages properties or attributes.
In my particular case, I think, as Spir said, that the best implementation
depends on wether I am going to update the "base" properties very often or
not, and wether I am going to access "t
31 matches
Mail list logo