Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73250 > unrolled thread
| Started by | hito koto <hitokoto2014@gmail.com> |
|---|---|
| First post | 2014-06-12 20:47 -0700 |
| Last post | 2014-06-12 22:44 -0700 |
| Articles | 3 — 1 participant |
Back to article view | Back to comp.lang.python
Python deepcopy to while statement hito koto <hitokoto2014@gmail.com> - 2014-06-12 20:47 -0700
Re: Python deepcopy to while statement hito koto <hitokoto2014@gmail.com> - 2014-06-12 22:40 -0700
Re: Python deepcopy to while statement hito koto <hitokoto2014@gmail.com> - 2014-06-12 22:44 -0700
| From | hito koto <hitokoto2014@gmail.com> |
|---|---|
| Date | 2014-06-12 20:47 -0700 |
| Subject | Python deepcopy to while statement |
| Message-ID | <a3d1a72c-31d3-4526-8888-c65cbb69f2d8@googlegroups.com> |
Hi, all
I want to make the function use while statement,and without a deepcopy functions.
this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement:
def foo(x):
if not isinstance(x, list):
return x
return [foo(y) for y in x]
[toc] | [next] | [standalone]
| From | hito koto <hitokoto2014@gmail.com> |
|---|---|
| Date | 2014-06-12 22:40 -0700 |
| Message-ID | <d599821b-6d56-4d03-ab9e-664e98910402@googlegroups.com> |
| In reply to | #73250 |
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto:
> Hi, all
>
>
>
> I want to make the function use while statement,and without a deepcopy functions.
>
>
>
> this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement:
>
>
>
> def foo(x):
>
> if not isinstance(x, list):
>
> return x
>
> return [foo(y) for y in x]
I write this code but this is not copy:
maybe noe more write while statements: but i can't.
def foo(x):
y = []
i = len(x)-1
while i >= 0:
y.append(x[i])
i -= 1
return y
[toc] | [prev] | [next] | [standalone]
| From | hito koto <hitokoto2014@gmail.com> |
|---|---|
| Date | 2014-06-12 22:44 -0700 |
| Message-ID | <86893e87-a387-4da7-a14a-346431912bd4@googlegroups.com> |
| In reply to | #73250 |
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto:
> Hi, all
>
>
>
> I want to make the function use while statement,and without a deepcopy functions.
>
>
>
> this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement:
>
>
>
> def foo(x):
>
> if not isinstance(x, list):
>
> return x
>
> return [foo(y) for y in x]
I write this code but this is not copy:
maybe have to write one more the while statements: but i can't.
def foo(x):
y = []>
i = len(x)-1
while i >= 0:
y.append(x[i])
i -= 1
return y
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web