Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Return not exiting function??
Post: RE: Return not exiting function??

okey, I see, so it exiting the recursion and continues with the rest. Got it, that was silly **wall** Thank you
rudihammad General Coding Help 3 5,307 Dec-01-2020, 06:58 PM
    Thread: Return not exiting function??
Post: Return not exiting function??

Hello, I have this simple example where I simple want to exit a function when i == 5. def foo(i): print i, "--" if i < 5: foo(i+1) print "++++++" elif i == 5: p...
rudihammad General Coding Help 3 5,307 Dec-01-2020, 06:32 PM
    Thread: an algorithm for this?
Post: RE: an algorithm for this?

Awesome thanks, DeaD_EyE. What I was trying to do was to create a new list each time where the next number was not equal + 1 to the previous,with the exception of the 0.
rudihammad General Coding Help 5 2,126 Jul-18-2020, 07:14 PM
    Thread: an algorithm for this?
Post: an algorithm for this?

Hello, I have this list myList = [0, 1, 2, 3, 4, 3, 4, 1, 2]And I was wondering how can I convert it in this myList = [[0], [1, 2, 3, 4], [3, 4], [1, 2]]any algorithm for this? thanks
rudihammad General Coding Help 5 2,126 Jul-18-2020, 10:42 AM
    Thread: How does numpy do this?
Post: RE: How does numpy do this?

oh ok, it was simpler than that sorry. That is what I wanted to do. I just overthought it class Foo(object): def __init__(self, someVar): self._x = someVar def asList(self):...
rudihammad General Coding Help 5 2,922 Jun-19-2020, 07:17 AM
    Thread: How does numpy do this?
Post: RE: How does numpy do this?

Ok let me explain it with a very simple example then. I know the following doesn't work but it to shows what I am trying to do. class Foo(object): def __new__(cls): cls.someVar = 5 ...
rudihammad General Coding Help 5 2,922 Jun-19-2020, 06:41 AM
    Thread: How does numpy do this?
Post: How does numpy do this?

Hello, let me explain what I mean with this example array = np.array([[2, 0], [5, 9]]) print(array) # Result: [[2, 0], [5, 9]] print(type(array)) # Result: <type 'numpy.ndarray'>...
rudihammad General Coding Help 5 2,922 Jun-19-2020, 06:08 AM
    Thread: adding properties to variables
Post: adding properties to variables

Hello, The code below does exactly what I want. Basically the goal is to get an object, and then from that object, get some properties. This is better explained with this example: class Binary(objec...
rudihammad General Coding Help 0 1,693 May-06-2020, 05:09 AM
    Thread: Being explicit about the items inside a tuple argument
Post: RE: Being explicit about the items inside a tuple ...

thanks, that might be an option, I'll think about it.
rudihammad General Coding Help 3 2,465 Dec-04-2019, 08:09 AM
    Thread: Being explicit about the items inside a tuple argument
Post: Being explicit about the items inside a tuple argu...

Hello, this might be a strange question but I was wondering if I can give a hint about the tuple argument items. For isntance, in the example bellow: # I don't want 2 arguments def matchObjects(sourc...
rudihammad General Coding Help 3 2,465 Dec-04-2019, 05:37 AM
    Thread: are numeric types passed by value or reference?
Post: RE: are numeric types passed by value or reference...

(Nov-18-2019, 07:06 PM)ThomasL Wrote: And by the way: You should start switching from Python 2.7 to Python 3.6 at least. Python 2.7 is deprecated in 6 weeks.In the vfx industry we are stuck for now ...
rudihammad General Coding Help 4 2,631 Nov-19-2019, 06:25 AM
    Thread: are numeric types passed by value or reference?
Post: are numeric types passed by value or reference?

Hello, I would like to know if python passed certain data types by value, and other data types by reference. Here is an example: def multiply(myArg): myArg = myArg * 2 return myArg y = 5 ...
rudihammad General Coding Help 4 2,631 Nov-18-2019, 04:42 AM
    Thread: Design question will __call__
Post: Design question will __call__

Hello, I am currently refactoring my API. I have been reading some because like Robert C. Martin clean code, and I am trying to right a cleaner code. So I came up with this: from PySide2 import QtWid...
rudihammad General Coding Help 1 1,907 Aug-11-2019, 07:51 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020