On May 30, 7:39 pm, Lie <[EMAIL PROTECTED]> wrote:
> An example is python's notion for 'for' loop, which can
> only loop a list[...]
Actually, the for statement steps through any object that provides an
iterator interface. Lists just happen to be one such object type.
--
http://mail.python.org/ma
On May 24, 5:59 am, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> Hello group,
>
> I'm just starting with Python and am extremely unexperienced with it so
> far. Having a strong C/C++ background, I wish to do something like
>
> if (q = getchar()) {
> printf("%d\n", q);
>
> }
>
> or translated
On 19:14, sabato 24 maggio 2008 Johannes Bauer wrote:
> Well, I do not really see your point
You wrote C statements and I felt that you were trying to apply to python
interpreter.
I think that a minimun of knoweledge on python grammar it's the base for
doing some programming.
If your examples were
On May 24, 7:12 am, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> Carl Banks schrieb:
>
> > p = myfunction()
> > if p:
> > print p
>
> > (I recommend doing it this way in C, too.)
>
> This is okay for if-clauses, but sucks for while-loops:
>
> while (fgets(buf, sizeof(buf), f)) {
> printf
On Sat, 24 May 2008 13:12:13 +0200, Johannes Bauer wrote:
> char *tmp;
> tmp = fgets(buf, sizeof(buf), f);
> while (tmp) {
> printf("%s\n", buf);
> tmp = fgets(buf, sizeof(buf), f);
> }
I think a more Pythonic way to write this, in general, would be:
while (1) {
char *tmp = fgets
On 2008-05-23, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> I'm just starting with Python and am extremely unexperienced with it so
> far. Having a strong C/C++ background, I wish to do something like
>
> if (q = getchar()) {
> printf("%d\n", q);
> }
>
> or translated to Python:
>
> if (p =
On May 24, 6:12 am, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> Carl Banks schrieb:
>
> > p = myfunction()
> > if p:
> > print p
>
> > (I recommend doing it this way in C, too.)
>
> This is okay for if-clauses, but sucks for while-loops:
>
> while (fgets(buf, sizeof(buf), f)) {
> printf
Johannes Bauer pisze:
> I'm just starting with Python and am extremely unexperienced with it so
> far. Having a strong C/C++ background, I wish to do something like
>
> if (q = getchar()) {
> printf("%d\n", q);
> }
>
> or translated to Python:
>
> if (p = myfunction()):
> print p
>
> H
On Sat, 24 May 2008 13:13:08 +0200, Johannes Bauer wrote:
> George Sakkis schrieb:
>
>>> However, this "assignment and comparison" is not working. What's the
>>> "Python way" of doing this kind of thing?
>>
>> The most obvious and readable of course: use two statements, as one
>> should do regar
On Sat, 24 May 2008 13:12:13 +0200, Johannes Bauer wrote:
> Carl Banks schrieb:
>
>> p = myfunction()
>> if p:
>> print p
>>
>> (I recommend doing it this way in C, too.)
>
> This is okay for if-clauses, but sucks for while-loops:
>
> while (fgets(buf, sizeof(buf), f)) {
> printf("%s
TheSaint schrieb:
On 06:59, sabato 24 maggio 2008 Johannes Bauer wrote:
However, this "assignment and comparison" is not working. What's the
"Python way" of doing this kind of thing?
If you want speak a language that isn't understood mostly you'll face
unexpected risults.
When you got started
George Sakkis schrieb:
However, this "assignment and comparison" is not working. What's the
"Python way" of doing this kind of thing?
The most obvious and readable of course: use two statements, as one
should do regardless of the language, instead of resorting to error-
prone hacks.
As I sai
Carl Banks schrieb:
p = myfunction()
if p:
print p
(I recommend doing it this way in C, too.)
This is okay for if-clauses, but sucks for while-loops:
while (fgets(buf, sizeof(buf), f)) {
printf("%s\n", buf);
}
is much shorter than
char *tmp;
tmp = fgets(buf, sizeof(buf), f);
wh
On 06:59, sabato 24 maggio 2008 Johannes Bauer wrote:
> However, this "assignment and comparison" is not working. What's the
> "Python way" of doing this kind of thing?
If you want speak a language that isn't understood mostly you'll face
unexpected risults.
When you got started with C/C++, were
On May 23, 6:59 pm, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> Hello group,
>
> I'm just starting with Python and am extremely unexperienced with it so
> far. Having a strong C/C++ background, I wish to do something like
>
> if (q = getchar()) {
> printf("%d\n", q);
>
> }
>
> or translated
On May 23, 6:59 pm, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> Hello group,
>
> I'm just starting with Python and am extremely unexperienced with it so
> far. Having a strong C/C++ background, I wish to do something like
>
> if (q = getchar()) {
> printf("%d\n", q);
>
> }
>
> or translated
Hello group,
I'm just starting with Python and am extremely unexperienced with it so
far. Having a strong C/C++ background, I wish to do something like
if (q = getchar()) {
printf("%d\n", q);
}
or translated to Python:
if (p = myfunction()):
print p
However, this "assignment
17 matches
Mail list logo