Python Forum
match type with value in csv parsing function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
match type with value in csv parsing function
#2
What I've understood thus far is that this wouldn't/shouldn't work:
row = [ func(row) for func in types ]
I am applying the function (str) to the entire list and it doesn't make sense. Whereas iterating over the list should work.

The reason why I thought it was behaving differently was that I didn't actually test it correctly. Applying str on a list works, but applying anything else doesn't. And I was trying to test it by changing str to int (for a date format), and it didn't work and I thought this was expected behaviour, but I hadn't properly test int/float which wouldn't have worked either way.
Reply


Messages In This Thread
RE: match type with value in csv parsing function - by vinci - Jan-21-2022, 11:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  determine parameter type in definition function akbarza 1 630 Aug-24-2023, 01:46 PM
Last Post: deanhystad
  i want to use type= as a function/method keyword argument Skaperen 9 2,009 Nov-06-2022, 04:28 AM
Last Post: Skaperen
  Creating function inside classes using type wolfmansbrother 3 2,409 Mar-20-2020, 01:21 AM
Last Post: wolfmansbrother
  Type hinting - return type based on parameter micseydel 2 2,547 Jan-14-2020, 01:20 AM
Last Post: micseydel
  Getting type from input() function in Python 3.0 leodavinci1990 7 3,879 Jul-29-2019, 08:28 PM
Last Post: avorane
  Type function does not work sunnyarora 2 2,536 Mar-15-2019, 10:50 AM
Last Post: sunnyarora
  Should a function ever be more permissive than its type hints? Shay 1 1,982 Mar-13-2019, 05:36 PM
Last Post: Larz60+
  Parameters type in a function girbinho 2 2,767 Oct-09-2018, 10:36 PM
Last Post: micseydel
  function type? microphone_head 3 3,390 Sep-13-2018, 05:44 AM
Last Post: vijayhackr
  Why args type is always tuple, when passed it as argument to the function. praveena 5 5,408 Jan-16-2018, 09:07 AM
Last Post: praveena

Forum Jump:

User Panel Messages

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